From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 02:36:04 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11DE21065673; Mon, 27 Oct 2008 02:36:04 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3D108FC08; Mon, 27 Oct 2008 02:36:03 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9R2a3q7019154; Mon, 27 Oct 2008 02:36:03 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9R2a3cS019151; Mon, 27 Oct 2008 02:36:03 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200810270236.m9R2a3cS019151@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 27 Oct 2008 02:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184319 - in head/sys/powerpc: aim booke include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2008 02:36:04 -0000 Author: marcel Date: Mon Oct 27 02:36:03 2008 New Revision: 184319 URL: http://svn.freebsd.org/changeset/base/184319 Log: Add support for kernel profiling for both AIM and BookE. Obtained from: Juniper Networks, Inc (BookE support). Modified: head/sys/powerpc/aim/locore.S head/sys/powerpc/booke/locore.S head/sys/powerpc/include/profile.h Modified: head/sys/powerpc/aim/locore.S ============================================================================== --- head/sys/powerpc/aim/locore.S Mon Oct 27 01:51:30 2008 (r184318) +++ head/sys/powerpc/aim/locore.S Mon Oct 27 02:36:03 2008 (r184319) @@ -111,11 +111,14 @@ openfirmware_entry: srsave: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + .text + .globl btext +btext: + /* * This symbol is here for the benefit of kvm_mkdb, and is supposed to * mark the start of kernel text. */ - .text .globl kernel_text kernel_text: Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Mon Oct 27 01:51:30 2008 (r184318) +++ head/sys/powerpc/booke/locore.S Mon Oct 27 02:36:03 2008 (r184319) @@ -41,11 +41,14 @@ #define TMPSTACKSZ 16384 + .text + .globl btext +btext: + /* * This symbol is here for the benefit of kvm_mkdb, and is supposed to * mark the start of kernel text. */ - .text .globl kernel_text kernel_text: Modified: head/sys/powerpc/include/profile.h ============================================================================== --- head/sys/powerpc/include/profile.h Mon Oct 27 01:51:30 2008 (r184318) +++ head/sys/powerpc/include/profile.h Mon Oct 27 02:36:03 2008 (r184319) @@ -81,61 +81,87 @@ typedef u_int fptrdiff_t; #define _PLT #endif -#define MCOUNT \ -__asm(" .globl _mcount \n" \ -" .type _mcount,@function \n" \ -"_mcount: \n" \ -" stwu %r1,-64(%r1) /* alloca for reg save space */ \n" \ -" stw %r3,16(%r1) /* save parameter registers, */ \n" \ -" stw %r4,20(%r1) /* r3-10 */ \n" \ -" stw %r5,24(%r1) \n" \ -" stw %r6,28(%r1) \n" \ -" stw %r7,32(%r1) \n" \ -" stw %r8,36(%r1) \n" \ -" stw %r9,40(%r1) \n" \ -" stw %r10,44(%r1) \n" \ -" \n" \ -" mflr %r4 /* link register is 'selfpc' */ \n" \ -" stw %r4,48(%r1) /* save since bl will scrub */ \n" \ -" lwz %r3,68(%r1) /* get 'frompc' from LR-save */ \n" \ -" bl __mcount" _PLT " /* __mcount(frompc, selfpc)*/ \n" \ -" lwz %r3,68(%r1) \n" \ -" mtlr %r3 /* restore caller's lr */ \n" \ -" lwz %r4,48(%r1) \n" \ -" mtctr %r4 /* set up ctr for call back */ \n" \ -" /* note that blr is not used!*/ \n" \ -" lwz %r3,16(%r1) /* restore r3-10 parameters */ \n" \ -" lwz %r4,20(%r1) \n" \ -" lwz %r5,24(%r1) \n" \ -" lwz %r6,28(%r1) \n" \ -" lwz %r7,32(%r1) \n" \ -" lwz %r8,36(%r1) \n" \ -" lwz %r9,40(%r1) \n" \ -" lwz %r10,44(%r1) \n" \ -" addi %r1,%r1,64 /* blow away alloca save area */ \n" \ -" bctr /* return with indirect call */ \n" \ -"_mcount_end: \n" \ -" .size _mcount,_mcount_end-_mcount"); - +#define MCOUNT \ +__asm( " .globl _mcount \n" \ + " .type _mcount,@function \n" \ + " .align 4 \n" \ + "_mcount: \n" \ + " stwu %r1,-64(%r1) \n" \ + " stw %r3,16(%r1) \n" \ + " stw %r4,20(%r1) \n" \ + " stw %r5,24(%r1) \n" \ + " stw %r6,28(%r1) \n" \ + " stw %r7,32(%r1) \n" \ + " stw %r8,36(%r1) \n" \ + " stw %r9,40(%r1) \n" \ + " stw %r10,44(%r1) \n" \ + " mflr %r4 \n" \ + " stw %r4,48(%r1) \n" \ + " lwz %r3,68(%r1) \n" \ + " bl __mcount" _PLT " \n" \ + " lwz %r3,68(%r1) \n" \ + " mtlr %r3 \n" \ + " lwz %r4,48(%r1) \n" \ + " mtctr %r4 \n" \ + " lwz %r3,16(%r1) \n" \ + " lwz %r4,20(%r1) \n" \ + " lwz %r5,24(%r1) \n" \ + " lwz %r6,28(%r1) \n" \ + " lwz %r7,32(%r1) \n" \ + " lwz %r8,36(%r1) \n" \ + " lwz %r9,40(%r1) \n" \ + " lwz %r10,44(%r1) \n" \ + " addi %r1,%r1,64 \n" \ + " bctr \n" \ + "_mcount_end: \n" \ + " .size _mcount,_mcount_end-_mcount"); #ifdef _KERNEL -#define MCOUNT_ENTER(s) s = intr_disable(); -#define MCOUNT_EXIT(s) intr_restore(s); -#define MCOUNT_DECL(s) register_t s - -void bintr(void); -void btrap(void); -void eintr(void); -void user(void); - -#define MCOUNT_FROMPC_USER(pc) \ - ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc) - -#define MCOUNT_FROMPC_INTR(pc) \ - ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \ - ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \ - (uintfptr_t)btrap) : ~0U) +#define MCOUNT_ENTER(s) s = intr_disable() +#define MCOUNT_EXIT(s) intr_restore(s) +#define MCOUNT_DECL(s) register_t s; + +#ifndef COMPILING_LINT +#ifdef AIM +#include +#define __PROFILE_VECTOR_BASE EXC_RST +#define __PROFILE_VECTOR_TOP (EXC_LAST + 0x100) +#endif /* AIM */ +#ifdef E500 +extern char interrupt_vector_base[]; +extern char interrupt_vector_top[]; +#define __PROFILE_VECTOR_BASE (uintfptr_t)interrupt_vector_base +#define __PROFILE_VECTOR_TOP (uintfptr_t)interrupt_vector_top +#endif /* E500 */ +#endif /* !COMPILING_LINT */ + +#ifndef __PROFILE_VECTOR_BASE +#define __PROFILE_VECTOR_BASE 0 +#endif +#ifndef __PROFILE_VECTOR_TOP +#define __PROFILE_VECTOR_TOP 1 +#endif + +static __inline void +powerpc_profile_interrupt(void) +{ +} + +static __inline void +powerpc_profile_userspace(void) +{ +} + +#define MCOUNT_FROMPC_USER(pc) \ + ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? \ + (uintfptr_t)powerpc_profile_userspace : pc) + +#define MCOUNT_FROMPC_INTR(pc) \ + ((pc >= __PROFILE_VECTOR_BASE && \ + pc < __PROFILE_VECTOR_TOP) ? \ + (uintfptr_t)powerpc_profile_interrupt : ~0U) +void __mcount(uintfptr_t frompc, uintfptr_t selfpc); #else /* !_KERNEL */