Source-Changes-HG archive

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

[src/netbsd-7]: src/lib/libc/arch/sh3/gen Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/bd3e251dcc41
branches:  netbsd-7
changeset: 799223:bd3e251dcc41
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sun Apr 19 05:05:41 2015 +0000

description:
Pull up following revision(s) (requested by uwe in ticket #709):
        lib/libc/arch/sh3/gen/swapcontext.S: revision 1.11
        lib/libc/arch/sh3/gen/swapcontext.S: revision 1.12
 - Adjust _UC_MACHINE_SP(oucp) to "drop" values we pushed to the stack.
   t_swapcontext tests pass now with gcc 4.8. From Yasushi Oshima in
   PR port-sh3/49597.
 - On swapcontext(3) preserve r12 too.  Properly fixes PR port-sh3/49597.

diffstat:

 lib/libc/arch/sh3/gen/swapcontext.S |  40 ++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diffs (70 lines):

diff -r 77395793f220 -r bd3e251dcc41 lib/libc/arch/sh3/gen/swapcontext.S
--- a/lib/libc/arch/sh3/gen/swapcontext.S       Sun Apr 19 05:03:02 2015 +0000
+++ b/lib/libc/arch/sh3/gen/swapcontext.S       Sun Apr 19 05:05:41 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: swapcontext.S,v 1.10 2013/09/12 15:36:15 joerg Exp $   */
+/*     $NetBSD: swapcontext.S,v 1.10.4.1 2015/04/19 05:05:41 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <machine/asm.h>
 #if defined(SYSLIBC_SCCS) && !defined(lint)
-       RCSID("$NetBSD: swapcontext.S,v 1.10 2013/09/12 15:36:15 joerg Exp $")
+       RCSID("$NetBSD: swapcontext.S,v 1.10.4.1 2015/04/19 05:05:41 msaitoh Exp $")
 #endif /* SYSLIBC_SCCS and not lint */
 
 /*
@@ -40,33 +40,33 @@
  */
 ENTRY(swapcontext)
        PIC_PROLOGUE(.L_got)
-       mov.l   r5, @-sp
        sts.l   pr, @-sp
 
        mov.l   .L__getcontext, r0
-1:     CALL    r0                      /* _getcontext(oucp) */
+       mov.l   r5, @-sp
+1:     CALL    r0                      ! _getcontext(oucp)
         mov.l  r4, @-sp
-       mov.l   @sp+, r1
+       !! getcontext captures oucp resuming here with r12 (when PIC),
+       !! pr, r5 and r4 pushed onto the stack
+
        tst     r0, r0
-       bf      3f                      /* return error from getcontext */
+       bf.s    3f                      ! return error from getcontext
+        mov.l  @sp, r1                 ! saved oucp
 
-       /* Note: getcontext does _UC_MACHINE_INTRV(oucp) = 0 for us */
-       mov.l   @sp, r0
-       mov.l   r0, @(36 + 1 * 4, r1)   /* _UC_MACHINE_SET_PC(oucp, pr) */
+       !! adjust oucp to resume after setcontext below
+       mova    3f, r0
+       mov.l   r0, @(36 + 1 * 4, r1)   ! _UC_MACHINE_SET_PC(oucp, pr)
+
        mov.l   .L_setcontext, r2
-2:     CALL    r2                      /* setcontext(ucp) */
-        mov.l  @(4, sp), r4
-       /* if we get here, return error from setcontext */
-3:
+2:     CALL    r2                      ! setcontext(ucp)
+        mov.l  @(4, sp), r4            ! saved ucp
+
+       .align  2
+3:     !! we get here on errors and when resuming oucp
+       add     #8, sp                  ! skip r4 and r5
        lds.l   @sp+, pr
-#ifdef __PIC__
-       add     #4, sp
        rts
-        PIC_EPILOGUE
-#else
-       rts
-        add    #4, sp
-#endif
+        PIC_EPILOGUE_SLOT
 
        .align  2
 .L_got:                        PIC_GOT_DATUM



Home | Main Index | Thread Index | Old Index