diff options
author | andreast <andreast@FreeBSD.org> | 2012-01-20 22:34:19 +0000 |
---|---|---|
committer | andreast <andreast@FreeBSD.org> | 2012-01-20 22:34:19 +0000 |
commit | cec8421d4715d2e43f8630ea6ad39766eeb4d0b6 (patch) | |
tree | 76275af2450ac7e58277331e71af5cce366f1f7d /sys/powerpc/include | |
parent | d22191faaa1982f92120c293792798a829424159 (diff) | |
download | FreeBSD-src-cec8421d4715d2e43f8630ea6ad39766eeb4d0b6.zip FreeBSD-src-cec8421d4715d2e43f8630ea6ad39766eeb4d0b6.tar.gz |
This commit adds profiling support for powerpc64. Now we can do application
profiling and kernel profiling. To enable kernel profiling one has to build
kgmon(8). I will enable the build once I managed to build and test powerpc
(32-bit) kernels with profiling support.
- add a powerpc64 PROF_PROLOGUE for _mcount.
- add macros to avoid adding the PROF_PROLOGUE in certain assembly entries.
- apply these macros where needed.
- add size information to the MCOUNT function.
MFC after: 3 weeks, together with r230291
Diffstat (limited to 'sys/powerpc/include')
-rw-r--r-- | sys/powerpc/include/asm.h | 24 | ||||
-rw-r--r-- | sys/powerpc/include/profile.h | 1 |
2 files changed, 23 insertions, 2 deletions
diff --git a/sys/powerpc/include/asm.h b/sys/powerpc/include/asm.h index 0c6b6a5..bfc939b 100644 --- a/sys/powerpc/include/asm.h +++ b/sys/powerpc/include/asm.h @@ -76,15 +76,35 @@ #endif #if defined(PROF) || (defined(_KERNEL) && defined(GPROF)) -# define _PROF_PROLOGUE mflr 0; stw 0,4(1); bl _mcount +# ifdef __powerpc64__ +# define _PROF_PROLOGUE mflr 0; \ + std 3,48(1); \ + std 4,56(1); \ + std 5,64(1); \ + std 0,16(1); \ + stdu 1,-112(1); \ + bl _mcount; \ + nop; \ + ld 0,112+16(1); \ + ld 3,112+48(1); \ + ld 4,112+56(1); \ + ld 5,112+64(1); \ + mtlr 0; \ + addi 1,1,112 +# else +# define _PROF_PROLOGUE mflr 0; stw 0,4(1); bl _mcount +# endif #else # define _PROF_PROLOGUE #endif -#define ENTRY(y) _ENTRY(CNAME(y)); _PROF_PROLOGUE #define ASENTRY(y) _ENTRY(ASMNAME(y)); _PROF_PROLOGUE +#define ENTRY(y) _ENTRY(CNAME(y)); _PROF_PROLOGUE #define GLOBAL(y) _GLOBAL(CNAME(y)) +#define ASENTRY_NOPROF(y) _ENTRY(ASMNAME(y)) +#define ENTRY_NOPROF(y) _ENTRY(CNAME(y)) + #define ASMSTR .asciz #define RCSID(x) .text; .asciz x diff --git a/sys/powerpc/include/profile.h b/sys/powerpc/include/profile.h index a354e38..9192cee 100644 --- a/sys/powerpc/include/profile.h +++ b/sys/powerpc/include/profile.h @@ -85,6 +85,7 @@ __asm( " .text \n" \ "_mcount: \n" \ " .quad .L._mcount,.TOC.@tocbase,0\n" \ " .previous \n" \ + " .size main,24 \n" \ " .type _mcount,@function \n" \ " .align 4 \n" \ ".L._mcount: \n" \ |