]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / powerpc / powerpc32 / swapcontext-common.S
index 90270b3c7f26ddef4b9c288bc7d2e1a8bd145572..9e2739fbb9611a80cd22ad340df209d91cce3380 100644 (file)
@@ -1,5 +1,5 @@
 /* Save current context and jump to a new context.
-   Copyright (C) 2005,2006,2008,2009,2011,2012 Free Software Foundation, Inc.
+   Copyright (C) 2005-2019 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
@@ -14,7 +14,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 /* This is the common implementation of setcontext for powerpc32.
    It not complete in itself should be included in to a framework that
@@ -23,7 +23,7 @@
    and if appropriate:
      __CONTEXT_ENABLE_FPRS
      __CONTEXT_ENABLE_VRS
-   Any archecture that implements the Vector unit is assumed to also
+   Any architecture that implements the Vector unit is assumed to also
    implement the floating unit.  */
 
 /* Stack frame offsets.  */
@@ -152,15 +152,15 @@ ENTRY(__CONTEXT_FUNC_NAME)
 #  ifdef SHARED
        lwz     r7,_rtld_global_ro@got(r7)
        mtlr    r8
-       lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+       lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
 #  else
        lwz     r7,_dl_hwcap@got(r7)
        mtlr    r8
-       lwz     r7,4(r7)
+       lwz     r7,LOWORD(r7)
 #  endif
 # else
-       lis     r7,(_dl_hwcap+4)@ha
-       lwz     r7,(_dl_hwcap+4)@l(r7)
+       lis     r7,(_dl_hwcap+LOWORD)@ha
+       lwz     r7,(_dl_hwcap+LOWORD)@l(r7)
 # endif
 
 # ifdef __CONTEXT_ENABLE_VRS
@@ -267,7 +267,8 @@ ENTRY(__CONTEXT_FUNC_NAME)
 
 /* Restore ucontext (parm1) from stack.  */
        lwz     r12,_FRAME_PARM_SAVE1(r1)
-       li      r4,0
+       lwz     r4,_FRAME_PARM_SAVE2(r1)
+       addi    r4,r4,_UC_SIGMASK
        stw     r3,_UC_REGS_PTR(r12)
        addi    r5,r12,_UC_SIGMASK
        li      r3,SIG_SETMASK
@@ -275,47 +276,28 @@ ENTRY(__CONTEXT_FUNC_NAME)
        cmpwi   r3,0
        bne     3f      /* L(error_exit) */
 
-       /*
-        * If the new ucontext refers to the point where we were interrupted
-        * by a signal, we have to use the rt_sigreturn system call to
-        * return to the context so we get both LR and CTR restored.
-        *
-        * Otherwise, the context we are restoring is either just after
-        * a procedure call (getcontext/swapcontext) or at the beginning
-        * of a procedure call (makecontext), so we don't need to restore
-        * r0, xer, ctr.  We don't restore r2 since it will be used as
-        * the TLS pointer.
-        */
        lwz     r4,_FRAME_PARM_SAVE2(r1)
        lwz     r31,_UC_REGS_PTR(r4)
-       lwz     r0,_UC_GREGS+(PT_MSR*4)(r31)
-       cmpwi   r0,0
-       bne     4f      /* L(do_sigret) */
 
 #ifdef __CONTEXT_ENABLE_FPRS
 # ifdef __CONTEXT_ENABLE_VRS
 
 #  ifdef PIC
        mflr    r8
-#   ifdef HAVE_ASM_PPC_REL16
        SETUP_GOT_ACCESS(r7,got_label)
        addis   r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
        addi    r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
-#   else
-       bl      _GLOBAL_OFFSET_TABLE_@local-4
-       mflr    r7
-#   endif
        mtlr    r8
 #   ifdef SHARED
        lwz     r7,_rtld_global_ro@got(r7)
-       lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+       lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
 #   else
        lwz     r7,_dl_hwcap@got(r7)
-       lwz     r7,4(r7)
+       lwz     r7,LOWORD(r7)
 #   endif
 #  else
-       lis     r7,(_dl_hwcap+4)@ha
-       lwz     r7,(_dl_hwcap+4)@l(r7)
+       lis     r7,(_dl_hwcap+LOWORD)@ha
+       lwz     r7,(_dl_hwcap+LOWORD)@l(r7)
 #  endif
        andis.  r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
        la      r10,(_UC_VREGS)(r31)
@@ -516,10 +498,4 @@ ENTRY(__CONTEXT_FUNC_NAME)
        mtlr    r0
        blr
 
-4:/*L(do_sigret):*/
-       addi    r1,r4,-0xd0
-       li      r0,SYS_ify(rt_sigreturn)
-       sc
-       /* NOTREACHED */
-
 END(__CONTEXT_FUNC_NAME)