svn commit: r205392 - in projects/ppc64: contrib/gcc/config/rs6000
sys/powerpc/include
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sat Mar 20 20:58:09 UTC 2010
Author: nwhitehorn
Date: Sat Mar 20 20:58:08 2010
New Revision: 205392
URL: http://svn.freebsd.org/changeset/base/205392
Log:
Support profiling on powerpc64. The only remaining thing on the todo
list is DMA bounce buffers.
Modified:
projects/ppc64/contrib/gcc/config/rs6000/freebsd.h
projects/ppc64/sys/powerpc/include/profile.h
Modified: projects/ppc64/contrib/gcc/config/rs6000/freebsd.h
==============================================================================
--- projects/ppc64/contrib/gcc/config/rs6000/freebsd.h Sat Mar 20 19:47:30 2010 (r205391)
+++ projects/ppc64/contrib/gcc/config/rs6000/freebsd.h Sat Mar 20 20:58:08 2010 (r205392)
@@ -237,3 +237,9 @@
are compatible. */
#define OS_MISSING_POWERPC64 !TARGET_64BIT
+/* Function profiling bits */
+#undef RS6000_MCOUNT
+#define RS6000_MCOUNT ((TARGET_64BIT) ? "._mcount" : "_mcount")
+#define PROFILE_HOOK(LABEL) \
+ do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
+
Modified: projects/ppc64/sys/powerpc/include/profile.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/profile.h Sat Mar 20 19:47:30 2010 (r205391)
+++ projects/ppc64/sys/powerpc/include/profile.h Sat Mar 20 20:58:08 2010 (r205392)
@@ -76,10 +76,47 @@ typedef __ptrdiff_t fptrdiff_t;
*/
#ifdef __powerpc64__
-/* XXX not implemented */
-
-#define MCOUNT int _mcount(void) {return (0);}
-
+#define MCOUNT \
+__asm( " .text \n" \
+ " .align 2 \n" \
+ " .globl _mcount \n" \
+ " .section \".opd\",\"aw\" \n" \
+ " .align 3 \n" \
+ "_mcount: \n" \
+ " .quad ._mcount,.TOC. at tocbase,0 \n" \
+ " .previous \n" \
+ " .align 4 \n" \
+ " .globl ._mcount \n" \
+ " .type ._mcount, at function \n" \
+ "._mcount: \n" \
+ " stdu %r1,-(288+120)(%r1) \n" \
+ " std %r3,48(%r1) \n" \
+ " std %r4,56(%r1) \n" \
+ " std %r5,64(%r1) \n" \
+ " std %r6,72(%r1) \n" \
+ " std %r7,80(%r1) \n" \
+ " std %r8,88(%r1) \n" \
+ " std %r9,96(%r1) \n" \
+ " std %r10,104(%r1) \n" \
+ " mflr %r4 \n" \
+ " std %r4,112(%r1) \n" \
+ " ld %r3,0(%r1) \n" \
+ " ld %r3,0(%r3) \n" \
+ " ld %r3,16(%r3) \n" \
+ " bl .__mcount \n" \
+ " nop \n" \
+ " ld %r4,112(%r1) \n" \
+ " mtlr %r4 \n" \
+ " ld %r3,48(%r1) \n" \
+ " ld %r4,56(%r1) \n" \
+ " ld %r5,64(%r1) \n" \
+ " ld %r6,72(%r1) \n" \
+ " ld %r7,80(%r1) \n" \
+ " ld %r8,88(%r1) \n" \
+ " ld %r9,96(%r1) \n" \
+ " ld %r10,104(%r1) \n" \
+ " addi %r1,%r1,(288+120) \n" \
+ " blr \n");
#else
#ifdef PIC
More information about the svn-src-projects
mailing list