Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/include Profiling fixes from Ethan Solomita <e...



details:   https://anonhg.NetBSD.org/src/rev/0bfbac8505b9
branches:  trunk
changeset: 487795:0bfbac8505b9
user:      castor <castor%NetBSD.org@localhost>
date:      Mon Jun 12 23:42:10 2000 +0000

description:
Profiling fixes from Ethan Solomita <ethan%geocast.com@localhost>.

Merge Kernel MCOUNT and user MCOUNT.

The earlier code which was inserted to call _mcount in profiling
assembler routines is busted badly.  This gets it working with PIC
code and should work with any arbitrary assembler routine.

diffstat:

 sys/arch/mips/include/asm.h |  31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diffs (48 lines):

diff -r 0aecae1c2354 -r 0bfbac8505b9 sys/arch/mips/include/asm.h
--- a/sys/arch/mips/include/asm.h       Mon Jun 12 23:38:03 2000 +0000
+++ b/sys/arch/mips/include/asm.h       Mon Jun 12 23:42:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asm.h,v 1.22 1999/04/24 08:10:33 simonb Exp $  */
+/*     $NetBSD: asm.h,v 1.23 2000/06/12 23:42:10 castor Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -62,21 +62,26 @@
 
 /*
  * Define -pg profile entry code.
- * XXX assume .set noreorder for kernel, .set reorder for user code.
+ * Must always be noreorder, must never use a macro instruction
+ * Final addiu to t9 must always equal the size of this _KERN_MCOUNT
  */
-#define _KERN_MCOUNT           \
-       .set    noat;           \
-       move    $1,$31;         \
-       jal     _mcount;        \
-       subu    sp,sp,8;        \
-       .set at
+#define _KERN_MCOUNT                                           \
+       .set    push;                                           \
+       .set    noreorder;                                      \
+       .set    noat;                                           \
+       sw      t9,-4(sp);                                      \
+       move    AT,ra;                                          \
+       lui     t9,%hi(_mcount);                                \
+       addiu   t9,t9,%lo(_mcount);                             \
+       jalr    t9;                                             \
+       subu    sp,sp,16;                                       \
+       lw      t9,4(sp);                                       \
+       addiu   sp,sp,8;                                        \
+       addiu   t9,t9,36;                                       \
+       .set    pop;                                    
 
 #ifdef GPROF
-# if defined(_KERNEL) || defined(_LOCORE)
-#  define MCOUNT _KERN_MCOUNT
-# else
-#  define MCOUNT .set noreorder; _KERN_MCOUNT ;  .set reorder;
-# endif
+#define MCOUNT _KERN_MCOUNT
 #else
 #define        MCOUNT
 #endif



Home | Main Index | Thread Index | Old Index