Source-Changes-HG archive

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

[src/netbsd-2-0]: src/lib/libc/arch/sparc64/gen Pull up revision 1.6 (request...



details:   https://anonhg.NetBSD.org/src/rev/cdba57294ba2
branches:  netbsd-2-0
changeset: 564650:cdba57294ba2
user:      jdc <jdc%NetBSD.org@localhost>
date:      Fri Jan 07 14:40:49 2005 +0000

description:
Pull up revision 1.6 (requested by martin in ticket #1020).

Replace the stack unwinding by a much simpler solution taken from
../../arch/sparc/gen/_setjmp.S rev. 1.6. This ended up to be ~identical
to the OpenBSD change triggered by the same sparc change.
Thanks to Stoned Elipot for pointing out the problem.

diffstat:

 lib/libc/arch/sparc64/gen/_setjmp.S |  49 ++++++++++++------------------------
 1 files changed, 17 insertions(+), 32 deletions(-)

diffs (75 lines):

diff -r 48e47311664d -r cdba57294ba2 lib/libc/arch/sparc64/gen/_setjmp.S
--- a/lib/libc/arch/sparc64/gen/_setjmp.S       Fri Jan 07 14:28:19 2005 +0000
+++ b/lib/libc/arch/sparc64/gen/_setjmp.S       Fri Jan 07 14:40:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _setjmp.S,v 1.5 2003/08/07 16:42:27 agc Exp $  */
+/*     $NetBSD: _setjmp.S,v 1.5.2.1 2005/01/07 14:40:49 jdc Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
        .asciz "@(#)_setjmp.s   8.1 (Berkeley) 6/4/93"
 #else
-       RCSID("$NetBSD: _setjmp.S,v 1.5 2003/08/07 16:42:27 agc Exp $")
+       RCSID("$NetBSD: _setjmp.S,v 1.5.2.1 2005/01/07 14:40:49 jdc Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -51,41 +51,26 @@
  * will generate a "return(v?v:1)" from
  * the last call to
  *     _setjmp(a)
- * by unwinding the call stack.
  * The previous signal state is NOT restored.
  */
 
 ENTRY(_setjmp)
-       stx     %sp, [%o0+0x00] /* store caller's stack pointer */
-       stx     %o7, [%o0+0x08] /* ... return pc */
-       stx     %fp, [%o0+0x10] /* ... and frame pointer */
+       stx     %sp, [%o0+0]    /* store caller's stack pointer */
+       stx     %o7, [%o0+8]    /* and return pc */
        retl
         clr    %o0             ! return 0
 
 ENTRY(_longjmp)
-       mov     1, %g6
-       movrnz  %o1, %o1, %g6   ! compute v ? v : 1 in a global register
-       mov     %o0, %g1        ! save a in another global register
-       ldx     [%g1+0x10], %g7 /* get caller's frame */
-1:
-       cmp     %fp, %g7        ! compare against desired frame
-       bl,a    1b              ! if below,
-        restore                !    pop frame and loop
-       be,a    2f              ! if there,
-        ldx    [%g1+0], %o2    !    fetch return %sp
-
-Lbotch:
-       call    _C_LABEL(longjmperror)  ! otherwise, went too far; bomb out
-       nop
-       unimp   0
-
-2:
-       cmp     %o2, %sp        ! %sp must not decrease
-       bge,a   3f
-        mov    %o2, %sp        ! it is OK, put it in place
-       b,a     Lbotch
-3:
-       ldx     [%g1+0x8], %o3  ! fetch pc
-       jmp     %o3 + 8         ! success, return %g6
-        mov    %g6, %o0
-
+       save    %sp, -CC64FSZ, %sp
+       flushw
+       /*
+        * We restore the saved stack pointer to %fp, then issue
+        * a `restore' instruction which will reload the register
+        * window from the stack.
+        */
+       ldx     [%i0+8], %i7
+       ldx     [%i0+0], %fp
+       mov     1, %i0
+       movrnz  %i1, %i1, %i0   ! compute v ? v : 1
+       ret
+        restore



Home | Main Index | Thread Index | Old Index