Source-Changes-HG archive

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

[src/trunk]: src/lib/csu/arch/mips For O32, don't save $gp on the stack, save...



details:   https://anonhg.NetBSD.org/src/rev/2cf78109cfba
branches:  trunk
changeset: 787733:2cf78109cfba
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Jun 30 08:00:34 2013 +0000

description:
For O32, don't save $gp on the stack, save $s0 instead and just keep $gp
in $s0.

diffstat:

 lib/csu/arch/mips/crtbegin.h |   6 ++----
 lib/csu/arch/mips/crti.S     |  18 ++++++++++++------
 lib/csu/arch/mips/crtn.S     |  14 +++++++++++---
 3 files changed, 25 insertions(+), 13 deletions(-)

diffs (99 lines):

diff -r f332058abd3c -r 2cf78109cfba lib/csu/arch/mips/crtbegin.h
--- a/lib/csu/arch/mips/crtbegin.h      Sun Jun 30 07:50:54 2013 +0000
+++ b/lib/csu/arch/mips/crtbegin.h      Sun Jun 30 08:00:34 2013 +0000
@@ -32,8 +32,7 @@
 #ifdef __mips_o32
        ".set noreorder"                                        "\n\t"
        ".set nomacro"                                          "\n\t"
-       "lw     $28,16($sp)"                                    "\n\t"
-       "nop"                                                   "\n\t"
+       "move   $28,$16"                                        "\n\t"
        "lw     $25,%got(__do_global_ctors_aux)($28)"           "\n\t"
        "nop"                                                   "\n\t"
        "addiu   $25,$25,%lo(__do_global_ctors_aux)"            "\n\t"
@@ -52,8 +51,7 @@
 #ifdef __mips_o32
        ".set noreorder"                                        "\n\t"
        ".set nomacro"                                          "\n\t"
-       "lw     $28,16($sp)"                                    "\n\t"
-       "nop"                                                   "\n\t"
+       "move   $28,$16"                                        "\n\t"
        "lw     $25,%got(__do_global_dtors_aux)($28)"           "\n\t"
        "nop"                                                   "\n\t"
        "addiu   $25,$25,%lo(__do_global_dtors_aux)"            "\n\t"
diff -r f332058abd3c -r 2cf78109cfba lib/csu/arch/mips/crti.S
--- a/lib/csu/arch/mips/crti.S  Sun Jun 30 07:50:54 2013 +0000
+++ b/lib/csu/arch/mips/crti.S  Sun Jun 30 08:00:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.1 2013/06/22 02:37:09 matt Exp $ */
+/* $NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <mips/asm.h>
 
-RCSID("$NetBSD: crti.S,v 1.1 2013/06/22 02:37:09 matt Exp $")
+RCSID("$NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $")
 
 #include "sysident.S"
 
@@ -39,16 +39,22 @@
 NESTED_NOPROFILE(_init, CALLFRAME_SIZ, ra)
         SETUP_GP
         PTR_SUBU sp, sp, CALLFRAME_SIZ # allocate stack frame
-        SAVE_GP(CALLFRAME_GP)
+       REG_S   ra, CALLFRAME_RA(sp)    # save RA
+#ifdef __mips_o32
+       REG_S   s0, CALLFRAME_S0(sp)    # save s0
+       move    s0, gp 
+#endif
         SETUP_GP64(CALLFRAME_GP, _init)
-       REG_S   ra, CALLFRAME_RA(sp)    # save RA
 END(_init)
 
        .section ".fini", "ax", @progbits
 NESTED_NOPROFILE(_fini, CALLFRAME_SIZ, ra)
         SETUP_GP
         PTR_SUBU sp, sp, CALLFRAME_SIZ # allocate stack frame
-        SAVE_GP(CALLFRAME_GP)
+       REG_S   ra, CALLFRAME_RA(sp)    # save RA
+#ifdef __mips_o32
+       REG_S   s0, CALLFRAME_S0(sp)    # save s0
+       move    s0, gp 
+#endif
         SETUP_GP64(CALLFRAME_GP, _fini)
-       REG_S   ra, CALLFRAME_RA(sp)    # save RA
 END(_fini)
diff -r f332058abd3c -r 2cf78109cfba lib/csu/arch/mips/crtn.S
--- a/lib/csu/arch/mips/crtn.S  Sun Jun 30 07:50:54 2013 +0000
+++ b/lib/csu/arch/mips/crtn.S  Sun Jun 30 08:00:34 2013 +0000
@@ -29,16 +29,24 @@
 
 #include <mips/asm.h>
 
-RCSID("$NetBSD: crtn.S,v 1.1 2013/06/22 02:37:09 matt Exp $")
+RCSID("$NetBSD: crtn.S,v 1.2 2013/06/30 08:00:34 matt Exp $")
 
        .section ".init", "ax", @progbits
-       RESTORE_GP64
        REG_L   ra, CALLFRAME_RA(sp)
+#if defined(__mips_o32) || defined(__mips_o64)
+       REG_L   s0, CALLFRAME_S0(sp)
+#else
+       REG_L   gp, CALLFRAME_GP(sp)
+#endif
        PTR_ADDU sp, sp, CALLFRAME_SIZ
        jr      ra
 
        .section ".fini", "ax", @progbits
-       RESTORE_GP64
        REG_L   ra, CALLFRAME_RA(sp)
+#ifdef __mips_o32
+       REG_L   s0, CALLFRAME_S0(sp)
+#else
+       REG_L   gp, CALLFRAME_GP(sp)
+#endif
        PTR_ADDU sp, sp, CALLFRAME_SIZ
        jr      ra



Home | Main Index | Thread Index | Old Index