Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/arch ABI police: avoid cluttering global registers ...



details:   https://anonhg.NetBSD.org/src/rev/a1e0baeecdad
branches:  trunk
changeset: 763629:a1e0baeecdad
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Mar 28 11:19:12 2011 +0000

description:
ABI police: avoid cluttering global registers %g2 and %g7. Not quite there
yet for %g2, but the target is not very well defined. %g7 should be clean
now.

diffstat:

 lib/libc/arch/sparc/SYS.h               |  20 ++++++++++----------
 lib/libc/arch/sparc64/SYS.h             |  14 ++++++--------
 lib/libc/arch/sparc64/gen/swapcontext.S |   9 ++++-----
 3 files changed, 20 insertions(+), 23 deletions(-)

diffs (138 lines):

diff -r 1e6d5487a77e -r a1e0baeecdad lib/libc/arch/sparc/SYS.h
--- a/lib/libc/arch/sparc/SYS.h Mon Mar 28 10:08:06 2011 +0000
+++ b/lib/libc/arch/sparc/SYS.h Mon Mar 28 11:19:12 2011 +0000
@@ -33,7 +33,7 @@
  *     @(#)SYS.h       8.1 (Berkeley) 6/4/93
  *
  *     from: Header: SYS.h,v 1.2 92/07/03 18:57:00 torek Exp
- *     $NetBSD: SYS.h,v 1.17 2007/10/08 13:06:00 uwe Exp $
+ *     $NetBSD: SYS.h,v 1.18 2011/03/28 11:19:12 martin Exp $
  */
 
 #include <machine/asm.h>
@@ -59,10 +59,10 @@
  */
 #ifdef PIC
 #define CALL(name)                             \
-       PIC_PROLOGUE(%g1, %g2);                 \
-       set     name, %g2;                      \
-       ld      [%g1 + %g2], %g2;               \
-       jmp     %g2;                            \
+       PIC_PROLOGUE(%g1, %g5);                 \
+       set     name, %g5;                      \
+       ld      [%g1 + %g5], %g5;               \
+       jmp     %g5;                            \
         nop
 #else
 #define        CALL(name)                              \
@@ -91,15 +91,15 @@
 
 /*
  * RSYSCALL is used when the system call should just return.  Here we
- * use the SYSCALL_G2RFLAG to put the `success' return address in %g2
+ * use the SYSCALL_G5RFLAG to put the `success' return address in %g5
  * and avoid a branch.
  *
  * PSEUDO(x,y) is like RSYSCALL(y), except that the name is x.
  */
 #define        _RSYSCALL(x,y)                                  \
 ENTRY(x);                                              \
-       mov     (_CAT(SYS_,y)) | SYSCALL_G2RFLAG, %g1;  \
-       add     %o7, 8, %g2;                            \
+       mov     (_CAT(SYS_,y)) | SYSCALL_G5RFLAG, %g1;  \
+       add     %o7, 8, %g5;                            \
        t       ST_SYSCALL;                             \
        ERROR()
 
@@ -141,8 +141,8 @@
  */
 #define _RSYSCALL_NOERROR(x,y)                         \
 ENTRY(x);                                              \
-       mov     (_CAT(SYS_,y)) | SYSCALL_G2RFLAG, %g1;  \
-       add     %o7, 8, %g2;                            \
+       mov     (_CAT(SYS_,y)) | SYSCALL_G5RFLAG, %g1;  \
+       add     %o7, 8, %g5;                            \
        t       ST_SYSCALL
 
 #define RSYSCALL_NOERROR(x)    _RSYSCALL_NOERROR(x,x)
diff -r 1e6d5487a77e -r a1e0baeecdad lib/libc/arch/sparc64/SYS.h
--- a/lib/libc/arch/sparc64/SYS.h       Mon Mar 28 10:08:06 2011 +0000
+++ b/lib/libc/arch/sparc64/SYS.h       Mon Mar 28 11:19:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: SYS.h,v 1.13 2003/08/07 16:42:26 agc Exp $     */
+/*     $NetBSD: SYS.h,v 1.14 2011/03/28 11:19:13 martin Exp $  */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -82,18 +82,18 @@
 
 /*
  * RSYSCALL is used when the system call should just return.  Here
- * we use the SYSCALL_G7RFLAG to put the `success' return address in %g7
+ * we use the SYSCALL_G5RFLAG to put the `success' return address in %g5
  * and avoid a branch.
  */
 #define        RSYSCALL(x) \
-       ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
+       ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
        t ST_SYSCALL; ERROR()
 
 /*
  * PSEUDO(x,y) is like RSYSCALL(y) except that the name is x.
  */
 #define        PSEUDO(x,y) \
-       ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
+       ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
        t ST_SYSCALL; ERROR()
 
 /*
@@ -120,16 +120,14 @@
  * XXX - This should be optimized.
  */
 #define RSYSCALL_NOERROR(x) \
-       ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
+       ENTRY(x); mov (_CAT(SYS_,x))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
        t ST_SYSCALL
 
 /*
  * PSEUDO_NOERROR(x,y) is like RSYSCALL_NOERROR(y) except that the name is x.
  */
 #define PSEUDO_NOERROR(x,y) \
-       ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G7RFLAG,%g1; add %o7,8,%g7; \
+       ENTRY(x); mov (_CAT(SYS_,y))|SYSCALL_G5RFLAG,%g1; add %o7,8,%g5; \
        t ST_SYSCALL
 
-       .register       %g7,#scratch
-
        .globl  _C_LABEL(__cerror)
diff -r 1e6d5487a77e -r a1e0baeecdad lib/libc/arch/sparc64/gen/swapcontext.S
--- a/lib/libc/arch/sparc64/gen/swapcontext.S   Mon Mar 28 10:08:06 2011 +0000
+++ b/lib/libc/arch/sparc64/gen/swapcontext.S   Mon Mar 28 11:19:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: swapcontext.S,v 1.4 2008/04/28 20:22:57 martin Exp $   */
+/*     $NetBSD: swapcontext.S,v 1.5 2011/03/28 11:19:13 martin Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -32,10 +32,9 @@
 #include "SYS.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-       RCSID("$NetBSD: swapcontext.S,v 1.4 2008/04/28 20:22:57 martin Exp $")
+       RCSID("$NetBSD: swapcontext.S,v 1.5 2011/03/28 11:19:13 martin Exp $")
 #endif /* LIBC_SCCS && !lint */
 
-       .register       %g2,#scratch
 
 ENTRY(swapcontext)
        mov     %o0, %o2                        /* must save pointer */
@@ -52,7 +51,7 @@
        stx     %o1, [%o2 + 64 + 1 * 8]         /* gr[_REG_PC] = retaddr */
 
        mov     %o3, %o0
-       mov     %o1, %g2                        /* optimize `return' */
-       mov     SYS_setcontext|SYSCALL_G2RFLAG, %g1
+       mov     %o1, %g5                        /* optimize `return' */
+       mov     SYS_setcontext|SYSCALL_G5RFLAG, %g1
        t       ST_SYSCALL
        ERROR()



Home | Main Index | Thread Index | Old Index