* sysdeps/mips/machine-gmon.h (MCOUNT): Define for N32 and N64 as well.
authorAlexandre Oliva <aoliva@redhat.com>
Mon, 17 Mar 2003 15:53:37 +0000 (15:53 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Mon, 17 Mar 2003 15:53:37 +0000 (15:53 +0000)
* sysdeps/mips/machine-gmon.h (MCOUNT): Define for N32 and N64 as
well.

ChangeLog
sysdeps/mips/machine-gmon.h

index b972b82638d9d856b43b4b0bfa21e8cb8d98ad96..a9a2786a8639a3c5ccf20585eceb83c5546a54e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2003-03-17  Alexandre Oliva  <aoliva@redhat.com>
 
+       * sysdeps/mips/machine-gmon.h (MCOUNT): Define for N32 and N64 as
+       well.
+
        * sysdeps/unix/sysv/linux/mips/configure.in: New.  Pre-process
        asm/unistd.h into asm-unistd.h.
        * sysdeps/unix/sysv/linux/mips/configure: Generated.
@@ -9,8 +12,6 @@
        * sysdeps/unix/sysv/linux/mips/clone.S: Don't include
        asm/unistd.h.
 
-2003-03-17  Alexandre Oliva  <aoliva@redhat.com>
-
        * sysdeps/unix/sysv/linux/mips/sys/ptrace.h: New file.
        * sysdeps/unix/sysv/linux/mips/ptrace.c: New file.  Use long
        long type for registers on n32.
index 102da2c36d79c17b3560eae93895288911ac76fe..5a87c85bf06b459c8b14c01782f7ab29e0006e65 100644 (file)
@@ -1,5 +1,6 @@
 /* Machine-specific calling sequence for `mcount' profiling function.  MIPS
-   Copyright (C) 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003
+       Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #define _MCOUNT_DECL(frompc,selfpc) \
 static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
 
-/* Call __mcount with our the return PC for our caller,
+/* Call __mcount with the return PC for our caller,
    and the return PC our caller will return to.  */
+
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+
 #ifdef __PIC__
-#define CPLOAD ".cpload $25;"
-#define CPRESTORE ".cprestore 44\n\t"
+# define CPLOAD ".cpload $25;"
+# define CPRESTORE ".cprestore 44\n\t"
 #else
-#define CPLOAD
-#define CPRESTORE
+# define CPLOAD
+# define CPRESTORE
 #endif
 
 #define MCOUNT asm(\
@@ -66,3 +70,70 @@ static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
         ".set reorder;\n\t" \
         ".set at\n\t" \
         ".end _mcount");
+
+#else
+
+#ifdef __PIC__
+# define CPSETUP ".cpsetup $25, 88, _mcount;"
+# define CPRETURN ".cpreturn;"
+#else
+# define CPSETUP
+# define CPRETURN
+#endif
+
+#if defined _ABIN32 && _MIPS_SIM == _ABIN32
+# define PTR_ADDU_STRING "add" /* no u */
+# define PTR_SUBU_STRING "sub" /* no u */
+#elif defined _ABI64 && _MIPS_SIM == _ABI64
+# define PTR_ADDU_STRING "daddu"
+# define PTR_SUBU_STRING "dsubu"
+#else
+# error "Unknown ABI"
+#endif
+
+#define MCOUNT asm(\
+       ".globl _mcount;\n\t" \
+       ".align 3;\n\t" \
+       ".type _mcount,@function;\n\t" \
+       ".ent _mcount\n\t" \
+        "_mcount:\n\t" \
+        ".frame $sp,88,$31\n\t" \
+        ".set noreorder;\n\t" \
+        ".set noat;\n\t" \
+        PTR_SUBU_STRING " $29,$29,96;\n\t" \
+        CPSETUP \
+        "sd $4,24($29);\n\t" \
+        "sd $5,32($29);\n\t" \
+        "sd $6,40($29);\n\t" \
+        "sd $7,48($29);\n\t" \
+        "sd $8,56($29);\n\t" \
+        "sd $9,64($29);\n\t" \
+        "sd $10,72($29);\n\t" \
+        "sd $11,80($29);\n\t" \
+        "sd $2,16($29);\n\t" \
+        "sd $1,0($29);\n\t" \
+        "sd $31,8($29);\n\t" \
+        "move $5,$31;\n\t" \
+        "move $4,$1;\n\t" \
+        "jal __mcount;\n\t" \
+        "nop;\n\t" \
+        "ld $4,24($29);\n\t" \
+        "ld $5,32($29);\n\t" \
+        "ld $6,40($29);\n\t" \
+        "ld $7,48($29);\n\t" \
+        "ld $8,56($29);\n\t" \
+        "ld $9,64($29);\n\t" \
+        "ld $10,72($29);\n\t" \
+        "ld $11,80($29);\n\t" \
+        "ld $2,16($29);\n\t" \
+        "ld $31,8($29);\n\t" \
+        "ld $1,0($29);\n\t" \
+        CPRETURN \
+        PTR_ADDU_STRING " $29,$29,96;\n\t" \
+        "j $31;\n\t" \
+        "move $31,$1;\n\t" \
+        ".set reorder;\n\t" \
+        ".set at\n\t" \
+        ".end _mcount");
+
+#endif