summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/powerpc/powerpc32
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-01-16 04:50:59 +0000
committerUlrich Drepper <drepper@redhat.com>2004-01-16 04:50:59 +0000
commit5ef6ae4bdb04ed21b8efc70566d22fab821ec6b2 (patch)
tree15f431839d8211e34b54bd4294f48a25770a0170 /sysdeps/unix/sysv/linux/powerpc/powerpc32
parent39b04aa39823faf1cc414e7f3eca4f43e01426e4 (diff)
downloadglibc-5ef6ae4bdb04ed21b8efc70566d22fab821ec6b2.tar
glibc-5ef6ae4bdb04ed21b8efc70566d22fab821ec6b2.tar.gz
glibc-5ef6ae4bdb04ed21b8efc70566d22fab821ec6b2.tar.bz2
glibc-5ef6ae4bdb04ed21b8efc70566d22fab821ec6b2.zip
Update.
2004-01-14 Steven Munroe <sjmunroe@us.ibm.com> * include/libc-symbols.h [HAVE_ASM_GLOBAL_DOT_NAME] (_symbol_version): Use C_SYMBOL_DOT_NAME to create '.'ed symbols. (_default_symbol_version): Use C_SYMBOL_DOT_NAME to create '.'ed symbols. * sysdeps/powerpc/Makefile: Add rtld-global-offsets.sym to gen-as-const-headers. * sysdeps/powerpc/elf/rtld-global-offsets.sym: New file. * sysdeps/powerpc/sysdep.h: Define v# symbols for vector registers. Define PPC_FEATURE_* masks for Aux Vector AT_HWCAP. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SWAPCONTEXT_SYSCALL): Define for PPC and 2.6.0 kernels. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h [!__WORDSIZE == 32]: Declare mcontext_t inline and include altivec state for 64-bit. * sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions: Add GLIBC_2.3.4 versions for setcontext, getcontext, and swapcontext. * sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions: Add GLIBC_2.3.4 versions for setcontext, getcontext, swapcontext, and makecontext. * sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S (__getcontext): Upgrade to save Altivec regs and version GLIBC_2_3_4. [SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)](__novec_getcontext): Compatible with GLIBC_2.3.3 release. * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S (__makecontext): Use parm save area instead of compiler_dw to hold context pointer. * sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S (__setcontext): Upgrade to restore Altivec regs and version GLIBC_2_3_4. [SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)](__novec_setcontext): Compatible with GLIBC_2.3.3 release. * sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S (__swapcontext): Upgrade to swap Altivec regs and version GLIBC_2_3_4. [SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4)](__novec_swapcontext): Compatible with GLIBC_2.3.3 release. * sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h (SIGCONTEXT_V_REGS_PTR, SIGCONTEXT_V_RESERVE): Defined. 2004-01-12 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions: Add GLIBC_2.3.4 versions for setcontext, getcontext, swapcontext, and makecontext. * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S (__getcontext): Upgrade to save Altivec regs and version GLIBC_2_3_4. [SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)](__novec_getcontext): Compatible with GLIBC_2.3.3 release. * sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S (__makecontext): Upgrade to align for Altivec regs and version GLIBC_2_3_4. [SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)](__novec_makecontext): Compatible with GLIBC_2.3.3 release. * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S (__setcontext): Upgrade to restore Altivec regs and version GLIBC_2_3_4. [SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)](__novec_setcontext): Compatible with GLIBC_2.3.3 release. * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S (__swapcontext): Upgrade to swap Altivec regs and version GLIBC_2_3_4. [SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)] (__novec_swapcontext): Compatible with GLIBC_2.3.3 release. * sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h: (_UC_VSCR, _UC_VRSAVE): Define. (_FRAME_BACKCHAIN, _FRAME_LR_SAVE,_FRAME_PARM_SAVE1,_FRAME_PARM_SAVE2, _FRAME_PARM_SAVE3, _FRAME_PARM_SAVE4): Defined.
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/powerpc32')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S236
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S94
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S253
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S461
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h9
6 files changed, 1040 insertions, 16 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
index d667eadbce..181d70150c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
@@ -24,4 +24,7 @@ libc {
posix_fadvise64; posix_fallocate64;
setcontext; getcontext; swapcontext; makecontext;
}
+ GLIBC_2.3.4 {
+ setcontext; getcontext; swapcontext; makecontext;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
index 3b1b3b9449..760e9b5534 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
@@ -1,5 +1,5 @@
/* Save current context.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <rtld-global-offsets.h>
#include <shlib-compat.h>
#define __ASSEMBLY__
@@ -25,6 +26,231 @@
#include "ucontext_i.h"
ENTRY(__getcontext)
+ stw r3,_FRAME_PARM_SAVE1(r1)
+ addi r3,r3,_UC_REG_SPACE+12
+ clrrwi r3,r3,4
+ stw r0,_UC_GREGS+(PT_R0*4)(r3)
+ mflr r0
+ stw r1,_UC_GREGS+(PT_R1*4)(r3)
+ stwu r1,-16(r1)
+ stw r0,_UC_GREGS+(PT_LNK*4)(r3)
+ stw r0,_UC_GREGS+(PT_NIP*4)(r3)
+ stw r0,_FRAME_LR_SAVE+16(r1)
+ stw r2,_UC_GREGS+(PT_R2*4)(r3)
+ stw r4,_UC_GREGS+(PT_R4*4)(r3)
+ stw r5,_UC_GREGS+(PT_R5*4)(r3)
+ stw r6,_UC_GREGS+(PT_R6*4)(r3)
+ stw r7,_UC_GREGS+(PT_R7*4)(r3)
+ stw r8,_UC_GREGS+(PT_R8*4)(r3)
+ stw r9,_UC_GREGS+(PT_R9*4)(r3)
+ stw r10,_UC_GREGS+(PT_R10*4)(r3)
+ stw r11,_UC_GREGS+(PT_R11*4)(r3)
+ stw r12,_UC_GREGS+(PT_R12*4)(r3)
+ stw r13,_UC_GREGS+(PT_R13*4)(r3)
+ stw r14,_UC_GREGS+(PT_R14*4)(r3)
+ stw r15,_UC_GREGS+(PT_R15*4)(r3)
+ stw r16,_UC_GREGS+(PT_R16*4)(r3)
+ stw r17,_UC_GREGS+(PT_R17*4)(r3)
+ stw r18,_UC_GREGS+(PT_R18*4)(r3)
+ stw r19,_UC_GREGS+(PT_R19*4)(r3)
+ stw r20,_UC_GREGS+(PT_R20*4)(r3)
+ stw r21,_UC_GREGS+(PT_R21*4)(r3)
+ stw r22,_UC_GREGS+(PT_R22*4)(r3)
+ stw r23,_UC_GREGS+(PT_R23*4)(r3)
+ stw r24,_UC_GREGS+(PT_R24*4)(r3)
+ stw r25,_UC_GREGS+(PT_R25*4)(r3)
+ stw r26,_UC_GREGS+(PT_R26*4)(r3)
+ stw r27,_UC_GREGS+(PT_R27*4)(r3)
+ stw r28,_UC_GREGS+(PT_R28*4)(r3)
+ stw r29,_UC_GREGS+(PT_R29*4)(r3)
+ stw r30,_UC_GREGS+(PT_R30*4)(r3)
+ stw r31,_UC_GREGS+(PT_R31*4)(r3)
+ mfctr r0
+ stw r0,_UC_GREGS+(PT_CTR*4)(r3)
+ mfxer r0
+ stw r0,_UC_GREGS+(PT_XER*4)(r3)
+ mfcr r0
+ stw r0,_UC_GREGS+(PT_CCR*4)(r3)
+
+ /* Set the return value of getcontext to "success". R3 is the only
+ register whose value is not preserved in the saved context. */
+ li r0,0
+ stw r0,_UC_GREGS+(PT_R3*4)(r3)
+
+ /* Zero fill fields that can't be set in user state. */
+ stw r0,_UC_GREGS+(PT_MSR*4)(r3)
+ stw r0,_UC_GREGS+(PT_MQ*4)(r3)
+
+ /* Save the floating-point registers */
+ stfd fp0,_UC_FREGS+(0*8)(r3)
+ stfd fp1,_UC_FREGS+(1*8)(r3)
+ stfd fp2,_UC_FREGS+(2*8)(r3)
+ stfd fp3,_UC_FREGS+(3*8)(r3)
+ stfd fp4,_UC_FREGS+(4*8)(r3)
+ stfd fp5,_UC_FREGS+(5*8)(r3)
+ stfd fp6,_UC_FREGS+(6*8)(r3)
+ stfd fp7,_UC_FREGS+(7*8)(r3)
+ stfd fp8,_UC_FREGS+(8*8)(r3)
+ stfd fp9,_UC_FREGS+(9*8)(r3)
+ stfd fp10,_UC_FREGS+(10*8)(r3)
+ stfd fp11,_UC_FREGS+(11*8)(r3)
+ stfd fp12,_UC_FREGS+(12*8)(r3)
+ stfd fp13,_UC_FREGS+(13*8)(r3)
+ stfd fp14,_UC_FREGS+(14*8)(r3)
+ stfd fp15,_UC_FREGS+(15*8)(r3)
+ stfd fp16,_UC_FREGS+(16*8)(r3)
+ stfd fp17,_UC_FREGS+(17*8)(r3)
+ stfd fp18,_UC_FREGS+(18*8)(r3)
+ stfd fp19,_UC_FREGS+(19*8)(r3)
+ stfd fp20,_UC_FREGS+(20*8)(r3)
+ stfd fp21,_UC_FREGS+(21*8)(r3)
+ stfd fp22,_UC_FREGS+(22*8)(r3)
+ stfd fp23,_UC_FREGS+(23*8)(r3)
+ stfd fp24,_UC_FREGS+(24*8)(r3)
+ stfd fp25,_UC_FREGS+(25*8)(r3)
+ stfd fp26,_UC_FREGS+(26*8)(r3)
+ stfd fp27,_UC_FREGS+(27*8)(r3)
+ stfd fp28,_UC_FREGS+(28*8)(r3)
+ stfd fp29,_UC_FREGS+(29*8)(r3)
+ mffs fp0
+ stfd fp30,_UC_FREGS+(30*8)(r3)
+ stfd fp31,_UC_FREGS+(31*8)(r3)
+ stfd fp0,_UC_FREGS+(32*8)(r3)
+
+#ifdef PIC
+ mflr r8
+ bl _GLOBAL_OFFSET_TABLE_@local-4
+ mflr r7
+#ifdef SHARED
+ lwz r7,_rtld_global@got(r7)
+ mtlr r8
+ lwz r7,RTLD_GLOBAL_DL_HWCAP_OFFSET(r7)
+#else
+ lwz r7,_dl_hwcap@got(r7)
+ mtlr r8
+ lwz r7,0(r7)
+#endif
+#else
+ lis r7,_dl_hwcap@ha
+ lwz r7,_dl_hwcap@l(r7)
+#endif
+ andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ beq L(no_vec)
+
+ la r10,(_UC_VREGS)(r3)
+ la r9,(_UC_VREGS+16)(r3)
+
+ stvx v0,0,r10
+ stvx v1,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v2,0,r10
+ stvx v3,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v4,0,r10
+ stvx v5,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v6,0,r10
+ stvx v7,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v8,0,r10
+ stvx v9,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v10,0,r10
+ stvx v11,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v12,0,r10
+ stvx v13,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v14,0,r10
+ stvx v15,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v16,0,r10
+ stvx v17,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v18,0,r10
+ stvx v11,0,r9
+ addi r19,r10,32
+ addi r9,r9,32
+
+ stvx v20,0,r10
+ stvx v21,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v22,0,r10
+ stvx v23,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v24,0,r10
+ stvx v25,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v26,0,r10
+ stvx v27,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v28,0,r10
+ stvx v29,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v30,0,r10
+ stvx v31,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v10,0,r10
+ stvx v11,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ mfvscr v0
+ mfspr r0,VRSAVE
+ stvx v0,0,r10
+ sync
+ stw r0,0(r10)
+
+L(no_vec):
+/* Restore ucontext (parm1) from stack. */
+ lwz r12,_FRAME_PARM_SAVE1+16(r1)
+ li r4,0
+ stw r3,_UC_REGS_PTR(r12)
+ addi r5,r12,_UC_SIGMASK
+ li r3,SIG_BLOCK
+ bl JUMPTARGET(sigprocmask)
+
+ lwz r0,_FRAME_LR_SAVE+16(r1)
+ addi r1,r1,16
+ mtlr r0
+ blr
+PSEUDO_END(__getcontext)
+
+versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4)
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+
+ENTRY(__novec_getcontext)
/*
* Since we are not attempting to save the altivec registers,
* there is no need to get the register storage space
@@ -119,7 +345,7 @@ ENTRY(__getcontext)
stfd fp30,_UC_FREGS+(30*8)(r3)
stfd fp31,_UC_FREGS+(31*8)(r3)
stfd fp0,_UC_FREGS+(32*8)(r3)
-
+
addi r5,r3,_UC_SIGMASK - _UC_REG_SPACE
li r4,0
li r3,SIG_BLOCK
@@ -129,9 +355,11 @@ ENTRY(__getcontext)
addi r1,r1,16
mtlr r0
blr
-PSEUDO_END(__getcontext)
+PSEUDO_END(__novec_getcontext)
+
+compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
-versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_3)
+#endif
#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
index 9cb0b874f5..9f34357deb 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
@@ -1,5 +1,5 @@
/* Set up a context to call a function.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 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
@@ -26,7 +26,8 @@
ENTRY(__makecontext)
/* Set up the first 7 args to the function in its registers */
- addi r11,r3,_UC_REG_SPACE
+ addi r11,r3,_UC_REG_SPACE+12
+ clrrwi r11,r11,4
stw r11,_UC_REGS_PTR(r3)
stw r6,_UC_GREGS+(PT_R3*4)(r11)
stw r7,_UC_GREGS+(PT_R4*4)(r11)
@@ -106,7 +107,94 @@ L(exitcode):
END(__makecontext)
-versioned_symbol (libc, __makecontext, makecontext, GLIBC_2_3_3)
+versioned_symbol (libc, __makecontext, makecontext, GLIBC_2_3_4)
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+
+ENTRY(__novec_makecontext)
+ /* Set up the first 7 args to the function in its registers */
+ addi r11,r3,_UC_REG_SPACE
+ stw r11,_UC_REGS_PTR(r3)
+ stw r6,_UC_GREGS+(PT_R3*4)(r11)
+ stw r7,_UC_GREGS+(PT_R4*4)(r11)
+ stw r8,_UC_GREGS+(PT_R5*4)(r11)
+ stw r9,_UC_GREGS+(PT_R6*4)(r11)
+ stw r10,_UC_GREGS+(PT_R7*4)(r11)
+ lwz r8,8(r1)
+ lwz r9,12(r1)
+ stw r8,_UC_GREGS+(PT_R8*4)(r11)
+ stw r9,_UC_GREGS+(PT_R9*4)(r11)
+
+ /* Set the NIP to the start of the function */
+ stw r4,_UC_GREGS+(PT_NIP*4)(r11)
+
+ /* Set the function's r31 to ucp->uc_link for the exitcode below. */
+ lwz r7,_UC_LINK(r3)
+ stw r7,_UC_GREGS+(PT_R31*4)(r11)
+
+ /* Set the function's LR to point to the exitcode below. */
+#ifdef PIC
+ mflr r0
+ bl 1f
+1: mflr r6
+ addi r6,r6,L(novec_exitcode)-1b
+ mtlr r0
+#else
+ lis r6,L(novec_exitcode)@ha
+ addi r6,r6,L(novec_exitcode)@l
+#endif
+ stw r6,_UC_GREGS+(PT_LNK*4)(r11)
+
+ /*
+ * Set up the stack frame for the function.
+ * If we have more than 5 args to the function (8 args to makecontext),
+ * there will be some arguments on the stack which have to end up
+ * in registers. If there are more than 8 args to the function,
+ * we have to copy (argc - 8) args from our stack to the functions'
+ * stack (and allow space for them in the frame).
+ */
+ lwz r4,_UC_STACK_SP(r3)
+ lwz r8,_UC_STACK_SIZE(r3)
+ add r4,r4,r8
+ rlwinm r4,r4,0,0,27 /* round down to 16-byte boundary */
+ addi r7,r4,-16 /* stack frame for fn's caller */
+ cmpwi r5,8
+ blt 2f /* less than 8 args is easy */
+ lwz r10,16(r1)
+ stw r10,_UC_GREGS+(PT_R10*4)(r11)
+ beq 2f /* if exactly 8 args */
+ subi r9,r5,3
+ subi r5,r5,8
+ rlwinm r9,r9,2,0,27
+ subf r7,r9,r4
+ mtctr r5 /* copy the 9th and following args */
+ addi r6,r1,16
+ addi r8,r7,4
+3: lwzu r10,4(r6)
+ stwu r10,4(r8)
+ bdnz 3b
+2: stw r7,_UC_GREGS+(PT_R1*4)(r11)
+ li r6,0
+ stw r6,0(r7)
+
+ blr
+
+/*
+ * If the function returns, it comes here. We put ucp->uc_link in
+ * r31, which is a callee-saved register. We have to continue with
+ * the context that r31 points to, or exit if it is 0.
+ */
+L(novec_exitcode):
+ mr. r3,r31
+ beq 4f
+ bl JUMPTARGET(__novec_setcontext)
+4: bl HIDDEN_JUMPTARGET(exit)
+ b 4b
+
+END(__makecontext)
+
+compat_symbol (libc, __novec_makecontext, makecontext, GLIBC_2_3_3)
+#endif
#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
index deb946137d..cb2779731e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
@@ -1,5 +1,5 @@
/* Jump to a new context.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <rtld-global-offsets.h>
#include <shlib-compat.h>
#define __ASSEMBLY__
@@ -53,7 +54,122 @@ ENTRY(__setcontext)
bl JUMPTARGET(sigprocmask)
cmpwi r3,0
bne L(error_exit)
+
+#ifdef PIC
+ mflr r8
+ bl _GLOBAL_OFFSET_TABLE_@local-4
+ mflr r7
+#ifdef SHARED
+ lwz r7,_rtld_global@got(r7)
+ mtlr r8
+ lwz r7,RTLD_GLOBAL_DL_HWCAP_OFFSET(r7)
+#else
+ lwz r7,_dl_hwcap@got(r7)
+ mtlr r8
+ lwz r7,0(r7)
+#endif
+#else
+ lis r7,_dl_hwcap@ha
+ lwz r7,_dl_hwcap@l(r7)
+#endif
+ andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ la r10,(_UC_VREGS)(r31)
+ beq L(has_no_vec)
+
+ lwz r0,(32*16)(r10)
+ li r9,(32*16)
+ cmpwi r0,0
+ mtspr VRSAVE,r0
+ beq L(has_no_vec)
+
+ lvx v19,r9,r10
+ la r9,(16)(r10)
+
+ lvx v0,0,r10
+ lvx v1,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ mtvscr v19
+ lvx v2,0,r10
+ lvx v3,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v4,0,r10
+ lvx v5,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v6,0,r10
+ lvx v7,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v8,0,r10
+ lvx v9,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v10,0,r10
+ lvx v11,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v12,0,r10
+ lvx v13,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v14,0,r10
+ lvx v15,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v16,0,r10
+ lvx v17,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v18,0,r10
+ lvx v11,0,r9
+ addi r19,r10,32
+ addi r9,r9,32
+
+ lvx v20,0,r10
+ lvx v21,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v22,0,r10
+ lvx v23,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v24,0,r10
+ lvx v25,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+ lvx v26,0,r10
+ lvx v27,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v28,0,r10
+ lvx v29,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v30,0,r10
+ lvx v31,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v10,0,r10
+ lvx v11,0,r9
+
+L(has_no_vec):
/* Restore the floating-point registers */
lfd fp31,_UC_FREGS+(32*8)(r31)
lfd fp0,_UC_FREGS+(0*8)(r31)
@@ -147,9 +263,138 @@ L(do_sigret):
PSEUDO_END (__setcontext)
-versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_3)
+versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+
+ENTRY(__novec_setcontext)
+ mflr r0
+ stwu r1,-16(r1)
+ stw r0,20(r1)
+ stw r31,12(r1)
+ lwz r31,_UC_REGS_PTR(r3)
+
+ /*
+ * If this 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 r0,_UC_GREGS+(PT_MSR*4)(r31)
+ cmpwi r0,0
+ bne L(novec_do_sigret)
+
+ /* Restore the signal mask */
+ li r5,0
+ addi r4,r3,_UC_SIGMASK
+ li r3,SIG_SETMASK
+ bl JUMPTARGET(sigprocmask)
+ cmpwi r3,0
+ bne L(novec_error_exit)
+
+ /* Restore the floating-point registers */
+ lfd fp31,_UC_FREGS+(32*8)(r31)
+ lfd fp0,_UC_FREGS+(0*8)(r31)
+ mtfsf 0xff,fp31
+ lfd fp1,_UC_FREGS+(1*8)(r31)
+ lfd fp2,_UC_FREGS+(2*8)(r31)
+ lfd fp3,_UC_FREGS+(3*8)(r31)
+ lfd fp4,_UC_FREGS+(4*8)(r31)
+ lfd fp5,_UC_FREGS+(5*8)(r31)
+ lfd fp6,_UC_FREGS+(6*8)(r31)
+ lfd fp7,_UC_FREGS+(7*8)(r31)
+ lfd fp8,_UC_FREGS+(8*8)(r31)
+ lfd fp9,_UC_FREGS+(9*8)(r31)
+ lfd fp10,_UC_FREGS+(10*8)(r31)
+ lfd fp11,_UC_FREGS+(11*8)(r31)
+ lfd fp12,_UC_FREGS+(12*8)(r31)
+ lfd fp13,_UC_FREGS+(13*8)(r31)
+ lfd fp14,_UC_FREGS+(14*8)(r31)
+ lfd fp15,_UC_FREGS+(15*8)(r31)
+ lfd fp16,_UC_FREGS+(16*8)(r31)
+ lfd fp17,_UC_FREGS+(17*8)(r31)
+ lfd fp18,_UC_FREGS+(18*8)(r31)
+ lfd fp19,_UC_FREGS+(19*8)(r31)
+ lfd fp20,_UC_FREGS+(20*8)(r31)
+ lfd fp21,_UC_FREGS+(21*8)(r31)
+ lfd fp22,_UC_FREGS+(22*8)(r31)
+ lfd fp23,_UC_FREGS+(23*8)(r31)
+ lfd fp24,_UC_FREGS+(24*8)(r31)
+ lfd fp25,_UC_FREGS+(25*8)(r31)
+ lfd fp26,_UC_FREGS+(26*8)(r31)
+ lfd fp27,_UC_FREGS+(27*8)(r31)
+ lfd fp28,_UC_FREGS+(28*8)(r31)
+ lfd fp29,_UC_FREGS+(29*8)(r31)
+ lfd fp30,_UC_FREGS+(30*8)(r31)
+ lfd fp31,_UC_FREGS+(31*8)(r31)
+
+ /* Restore LR and CCR, and set CTR to the NIP value */
+ lwz r3,_UC_GREGS+(PT_LNK*4)(r31)
+ lwz r4,_UC_GREGS+(PT_NIP*4)(r31)
+ lwz r5,_UC_GREGS+(PT_CCR*4)(r31)
+ mtlr r3
+ mtctr r4
+ mtcr r5
+
+ /* Restore the general registers */
+ lwz r1,_UC_GREGS+(PT_R1*4)(r31)
+ lwz r3,_UC_GREGS+(PT_R3*4)(r31)
+ lwz r4,_UC_GREGS+(PT_R4*4)(r31)
+ lwz r5,_UC_GREGS+(PT_R5*4)(r31)
+ lwz r6,_UC_GREGS+(PT_R6*4)(r31)
+ lwz r7,_UC_GREGS+(PT_R7*4)(r31)
+ lwz r8,_UC_GREGS+(PT_R8*4)(r31)
+ lwz r9,_UC_GREGS+(PT_R9*4)(r31)
+ lwz r10,_UC_GREGS+(PT_R10*4)(r31)
+ lwz r11,_UC_GREGS+(PT_R11*4)(r31)
+ lwz r12,_UC_GREGS+(PT_R12*4)(r31)
+ lwz r13,_UC_GREGS+(PT_R13*4)(r31)
+ lwz r14,_UC_GREGS+(PT_R14*4)(r31)
+ lwz r15,_UC_GREGS+(PT_R15*4)(r31)
+ lwz r16,_UC_GREGS+(PT_R16*4)(r31)
+ lwz r17,_UC_GREGS+(PT_R17*4)(r31)
+ lwz r18,_UC_GREGS+(PT_R18*4)(r31)
+ lwz r19,_UC_GREGS+(PT_R19*4)(r31)
+ lwz r20,_UC_GREGS+(PT_R20*4)(r31)
+ lwz r21,_UC_GREGS+(PT_R21*4)(r31)
+ lwz r22,_UC_GREGS+(PT_R22*4)(r31)
+ lwz r23,_UC_GREGS+(PT_R23*4)(r31)
+ lwz r24,_UC_GREGS+(PT_R24*4)(r31)
+ lwz r25,_UC_GREGS+(PT_R25*4)(r31)
+ lwz r26,_UC_GREGS+(PT_R26*4)(r31)
+ lwz r27,_UC_GREGS+(PT_R27*4)(r31)
+ lwz r28,_UC_GREGS+(PT_R28*4)(r31)
+ lwz r29,_UC_GREGS+(PT_R29*4)(r31)
+ lwz r30,_UC_GREGS+(PT_R30*4)(r31)
+ lwz r31,_UC_GREGS+(PT_R31*4)(r31)
+
+ bctr
+
+L(novec_error_exit):
+ lwz r31,12(r1)
+ lwz r0,20(r1)
+ addi r1,r1,16
+ mtlr r0
+ blr
+
+L(novec_do_sigret):
+ addi r1,r3,-0xd0
+ li r0,SYS_ify(rt_sigreturn)
+ sc
+ /* NOTREACHED */
+
+PSEUDO_END (__setcontext)
+
+compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
+
+#endif
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_3)
+#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
#define _ERRNO_H 1
#include <bits/errno.h>
@@ -159,6 +404,6 @@ ENTRY (__setcontext_stub)
b JUMPTARGET(__syscall_error)
END (__setcontext_stub)
-compat_symbol (libc, __setcontext_stub, setcontext, GLIBC_2_0)
+compat_symbol (libc, __setcontext_stub, setcontext, GLIBC_2_1)
#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
index fac6802959..11f488a63b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
@@ -1,5 +1,5 @@
/* Save current context and jump to a new context.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <rtld-global-offsets.h>
#include <shlib-compat.h>
#define __ASSEMBLY__
@@ -26,6 +27,454 @@
ENTRY(__swapcontext)
/* Save the current context */
+ stw r3,_FRAME_PARM_SAVE1(r1)
+ addi r3,r3,_UC_REG_SPACE+12
+ clrrwi r3,r3,4
+ stw r0,_UC_GREGS+(PT_R0*4)(r3)
+ stw r1,_UC_GREGS+(PT_R1*4)(r3)
+ mflr r0
+ stwu r1,-16(r1)
+ stw r0,20(r1)
+ stw r31,12(r1)
+ stw r31,_UC_GREGS+(PT_R31*4)(r3)
+ mr r31,r4 /* new context pointer */
+ stw r0,_UC_GREGS+(PT_LNK*4)(r3)
+ stw r0,_UC_GREGS+(PT_NIP*4)(r3)
+ stw r2,_UC_GREGS+(PT_R2*4)(r3)
+ stw r4,_UC_GREGS+(PT_R4*4)(r3)
+ stw r5,_UC_GREGS+(PT_R5*4)(r3)
+ stw r6,_UC_GREGS+(PT_R6*4)(r3)
+ stw r7,_UC_GREGS+(PT_R7*4)(r3)
+ stw r8,_UC_GREGS+(PT_R8*4)(r3)
+ stw r9,_UC_GREGS+(PT_R9*4)(r3)
+ stw r10,_UC_GREGS+(PT_R10*4)(r3)
+ stw r11,_UC_GREGS+(PT_R11*4)(r3)
+ stw r12,_UC_GREGS+(PT_R12*4)(r3)
+ stw r13,_UC_GREGS+(PT_R13*4)(r3)
+ stw r14,_UC_GREGS+(PT_R14*4)(r3)
+ stw r15,_UC_GREGS+(PT_R15*4)(r3)
+ stw r16,_UC_GREGS+(PT_R16*4)(r3)
+ stw r17,_UC_GREGS+(PT_R17*4)(r3)
+ stw r18,_UC_GREGS+(PT_R18*4)(r3)
+ stw r19,_UC_GREGS+(PT_R19*4)(r3)
+ stw r20,_UC_GREGS+(PT_R20*4)(r3)
+ stw r21,_UC_GREGS+(PT_R21*4)(r3)
+ stw r22,_UC_GREGS+(PT_R22*4)(r3)
+ stw r23,_UC_GREGS+(PT_R23*4)(r3)
+ stw r24,_UC_GREGS+(PT_R24*4)(r3)
+ stw r25,_UC_GREGS+(PT_R25*4)(r3)
+ stw r26,_UC_GREGS+(PT_R26*4)(r3)
+ stw r27,_UC_GREGS+(PT_R27*4)(r3)
+ stw r28,_UC_GREGS+(PT_R28*4)(r3)
+ stw r29,_UC_GREGS+(PT_R29*4)(r3)
+ stw r30,_UC_GREGS+(PT_R30*4)(r3)
+ mfctr r0
+ stw r0,_UC_GREGS+(PT_CTR*4)(r3)
+ mfxer r0
+ stw r0,_UC_GREGS+(PT_XER*4)(r3)
+ mfcr r0
+ stw r0,_UC_GREGS+(PT_CCR*4)(r3)
+
+ /* Set the return value of swapcontext to "success". R3 is the only
+ register whose value is not preserved in the saved context. */
+ li r0,0
+ stw r0,_UC_GREGS+(PT_R3*4)(r3)
+
+ /* Zero fill fields that can't be set in user state. */
+ stw r0,_UC_GREGS+(PT_MSR*4)(r3)
+ stw r0,_UC_GREGS+(PT_MQ*4)(r3)
+
+ /* Save the floating-point registers */
+ stfd fp0,_UC_FREGS+(0*8)(r3)
+ stfd fp1,_UC_FREGS+(1*8)(r3)
+ stfd fp2,_UC_FREGS+(2*8)(r3)
+ stfd fp3,_UC_FREGS+(3*8)(r3)
+ stfd fp4,_UC_FREGS+(4*8)(r3)
+ stfd fp5,_UC_FREGS+(5*8)(r3)
+ stfd fp6,_UC_FREGS+(6*8)(r3)
+ stfd fp7,_UC_FREGS+(7*8)(r3)
+ stfd fp8,_UC_FREGS+(8*8)(r3)
+ stfd fp9,_UC_FREGS+(9*8)(r3)
+ stfd fp10,_UC_FREGS+(10*8)(r3)
+ stfd fp11,_UC_FREGS+(11*8)(r3)
+ stfd fp12,_UC_FREGS+(12*8)(r3)
+ stfd fp13,_UC_FREGS+(13*8)(r3)
+ stfd fp14,_UC_FREGS+(14*8)(r3)
+ stfd fp15,_UC_FREGS+(15*8)(r3)
+ stfd fp16,_UC_FREGS+(16*8)(r3)
+ stfd fp17,_UC_FREGS+(17*8)(r3)
+ stfd fp18,_UC_FREGS+(18*8)(r3)
+ stfd fp19,_UC_FREGS+(19*8)(r3)
+ stfd fp20,_UC_FREGS+(20*8)(r3)
+ stfd fp21,_UC_FREGS+(21*8)(r3)
+ stfd fp22,_UC_FREGS+(22*8)(r3)
+ stfd fp23,_UC_FREGS+(23*8)(r3)
+ stfd fp24,_UC_FREGS+(24*8)(r3)
+ stfd fp25,_UC_FREGS+(25*8)(r3)
+ stfd fp26,_UC_FREGS+(26*8)(r3)
+ stfd fp27,_UC_FREGS+(27*8)(r3)
+ stfd fp28,_UC_FREGS+(28*8)(r3)
+ stfd fp29,_UC_FREGS+(29*8)(r3)
+ mffs fp0
+ stfd fp30,_UC_FREGS+(30*8)(r3)
+ stfd fp31,_UC_FREGS+(31*8)(r3)
+ stfd fp0,_UC_FREGS+(32*8)(r3)
+#ifdef PIC
+ mflr r8
+ bl _GLOBAL_OFFSET_TABLE_@local-4
+ mflr r7
+#ifdef SHARED
+ lwz r7,_rtld_global@got(r7)
+ mtlr r8
+ lwz r7,RTLD_GLOBAL_DL_HWCAP_OFFSET(r7)
+#else
+ lwz r7,_dl_hwcap@got(r7)
+ mtlr r8
+ lwz r7,0(r7)
+#endif
+#else
+ lis r7,_dl_hwcap@ha
+ lwz r7,_dl_hwcap@l(r7)
+#endif
+ andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ beq L(no_vec)
+
+ la r10,(_UC_VREGS)(r3)
+ la r9,(_UC_VREGS+16)(r3)
+
+ stvx v0,0,r10
+ stvx v1,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v2,0,r10
+ stvx v3,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v4,0,r10
+ stvx v5,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v6,0,r10
+ stvx v7,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v8,0,r10
+ stvx v9,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v10,0,r10
+ stvx v11,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v12,0,r10
+ stvx v13,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v14,0,r10
+ stvx v15,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v16,0,r10
+ stvx v17,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v18,0,r10
+ stvx v11,0,r9
+ addi r19,r10,32
+ addi r9,r9,32
+
+ stvx v20,0,r10
+ stvx v21,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v22,0,r10
+ stvx v23,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v24,0,r10
+ stvx v25,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v26,0,r10
+ stvx v27,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v28,0,r10
+ stvx v29,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v30,0,r10
+ stvx v31,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ stvx v10,0,r10
+ stvx v11,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ mfvscr v0
+ mfspr r0,VRSAVE
+ stvx v0,0,r10
+ sync
+ stw r0,0(r10)
+
+L(no_vec):
+/* Restore ucontext (parm1) from stack. */
+ lwz r12,_FRAME_PARM_SAVE1+16(r1)
+ li r4,0
+ stw r3,_UC_REGS_PTR(r12)
+ addi r5,r12,_UC_SIGMASK
+ li r3,SIG_SETMASK
+ bl JUMPTARGET(sigprocmask)
+ cmpwi r3,0
+ bne 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.
+ */
+ mr r4,r31
+ lwz r31,_UC_REGS_PTR(r31)
+ lwz r0,_UC_GREGS+(PT_MSR*4)(r31)
+ cmpwi r0,0
+ bne L(do_sigret)
+
+#ifdef PIC
+ mflr r8
+ bl _GLOBAL_OFFSET_TABLE_@local-4
+ mflr r7
+#ifdef SHARED
+ lwz r7,_rtld_global@got(r7)
+ mtlr r8
+ lwz r7,RTLD_GLOBAL_DL_HWCAP_OFFSET(r7)
+#else
+ lwz r7,_dl_hwcap@got(r7)
+ mtlr r8
+ lwz r7,0(r7)
+#endif
+#else
+ lis r7,_dl_hwcap@ha
+ lwz r7,_dl_hwcap@l(r7)
+#endif
+ andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ la r10,(_UC_VREGS)(r31)
+ beq L(has_no_vec)
+
+ lwz r0,(32*16)(r10)
+ li r9,(32*16)
+ cmpwi r0,0
+ mtspr VRSAVE,r0
+ beq L(has_no_vec)
+
+ lvx v19,r9,r10
+ la r9,(16)(r10)
+
+ lvx v0,0,r10
+ lvx v1,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ mtvscr v19
+ lvx v2,0,r10
+ lvx v3,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v4,0,r10
+ lvx v5,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v6,0,r10
+ lvx v7,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v8,0,r10
+ lvx v9,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v10,0,r10
+ lvx v11,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v12,0,r10
+ lvx v13,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v14,0,r10
+ lvx v15,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v16,0,r10
+ lvx v17,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v18,0,r10
+ lvx v11,0,r9
+ addi r19,r10,32
+ addi r9,r9,32
+
+ lvx v20,0,r10
+ lvx v21,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v22,0,r10
+ lvx v23,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v24,0,r10
+ lvx v25,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v26,0,r10
+ lvx v27,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v28,0,r10
+ lvx v29,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v30,0,r10
+ lvx v31,0,r9
+ addi r10,r10,32
+ addi r9,r9,32
+
+ lvx v10,0,r10
+ lvx v11,0,r9
+
+L(has_no_vec):
+ /* Restore the floating-point registers */
+ lfd fp31,_UC_FREGS+(32*8)(r31)
+ lfd fp0,_UC_FREGS+(0*8)(r31)
+ mtfsf 0xff,fp31
+ lfd fp1,_UC_FREGS+(1*8)(r31)
+ lfd fp2,_UC_FREGS+(2*8)(r31)
+ lfd fp3,_UC_FREGS+(3*8)(r31)
+ lfd fp4,_UC_FREGS+(4*8)(r31)
+ lfd fp5,_UC_FREGS+(5*8)(r31)
+ lfd fp6,_UC_FREGS+(6*8)(r31)
+ lfd fp7,_UC_FREGS+(7*8)(r31)
+ lfd fp8,_UC_FREGS+(8*8)(r31)
+ lfd fp9,_UC_FREGS+(9*8)(r31)
+ lfd fp10,_UC_FREGS+(10*8)(r31)
+ lfd fp11,_UC_FREGS+(11*8)(r31)
+ lfd fp12,_UC_FREGS+(12*8)(r31)
+ lfd fp13,_UC_FREGS+(13*8)(r31)
+ lfd fp14,_UC_FREGS+(14*8)(r31)
+ lfd fp15,_UC_FREGS+(15*8)(r31)
+ lfd fp16,_UC_FREGS+(16*8)(r31)
+ lfd fp17,_UC_FREGS+(17*8)(r31)
+ lfd fp18,_UC_FREGS+(18*8)(r31)
+ lfd fp19,_UC_FREGS+(19*8)(r31)
+ lfd fp20,_UC_FREGS+(20*8)(r31)
+ lfd fp21,_UC_FREGS+(21*8)(r31)
+ lfd fp22,_UC_FREGS+(22*8)(r31)
+ lfd fp23,_UC_FREGS+(23*8)(r31)
+ lfd fp24,_UC_FREGS+(24*8)(r31)
+ lfd fp25,_UC_FREGS+(25*8)(r31)
+ lfd fp26,_UC_FREGS+(26*8)(r31)
+ lfd fp27,_UC_FREGS+(27*8)(r31)
+ lfd fp28,_UC_FREGS+(28*8)(r31)
+ lfd fp29,_UC_FREGS+(29*8)(r31)
+ lfd fp30,_UC_FREGS+(30*8)(r31)
+ lfd fp31,_UC_FREGS+(31*8)(r31)
+
+ /* Restore LR and CCR, and set CTR to the NIP value */
+ lwz r3,_UC_GREGS+(PT_LNK*4)(r31)
+ lwz r4,_UC_GREGS+(PT_NIP*4)(r31)
+ lwz r5,_UC_GREGS+(PT_CCR*4)(r31)
+ mtlr r3
+ mtctr r4
+ mtcr r5
+
+ /* Restore the general registers */
+ lwz r1,_UC_GREGS+(PT_R1*4)(r31)
+ lwz r3,_UC_GREGS+(PT_R3*4)(r31)
+ lwz r4,_UC_GREGS+(PT_R4*4)(r31)
+ lwz r5,_UC_GREGS+(PT_R5*4)(r31)
+ lwz r6,_UC_GREGS+(PT_R6*4)(r31)
+ lwz r7,_UC_GREGS+(PT_R7*4)(r31)
+ lwz r8,_UC_GREGS+(PT_R8*4)(r31)
+ lwz r9,_UC_GREGS+(PT_R9*4)(r31)
+ lwz r10,_UC_GREGS+(PT_R10*4)(r31)
+ lwz r11,_UC_GREGS+(PT_R11*4)(r31)
+ lwz r12,_UC_GREGS+(PT_R12*4)(r31)
+ lwz r13,_UC_GREGS+(PT_R13*4)(r31)
+ lwz r14,_UC_GREGS+(PT_R14*4)(r31)
+ lwz r15,_UC_GREGS+(PT_R15*4)(r31)
+ lwz r16,_UC_GREGS+(PT_R16*4)(r31)
+ lwz r17,_UC_GREGS+(PT_R17*4)(r31)
+ lwz r18,_UC_GREGS+(PT_R18*4)(r31)
+ lwz r19,_UC_GREGS+(PT_R19*4)(r31)
+ lwz r20,_UC_GREGS+(PT_R20*4)(r31)
+ lwz r21,_UC_GREGS+(PT_R21*4)(r31)
+ lwz r22,_UC_GREGS+(PT_R22*4)(r31)
+ lwz r23,_UC_GREGS+(PT_R23*4)(r31)
+ lwz r24,_UC_GREGS+(PT_R24*4)(r31)
+ lwz r25,_UC_GREGS+(PT_R25*4)(r31)
+ lwz r26,_UC_GREGS+(PT_R26*4)(r31)
+ lwz r27,_UC_GREGS+(PT_R27*4)(r31)
+ lwz r28,_UC_GREGS+(PT_R28*4)(r31)
+ lwz r29,_UC_GREGS+(PT_R29*4)(r31)
+ lwz r30,_UC_GREGS+(PT_R30*4)(r31)
+ lwz r31,_UC_GREGS+(PT_R31*4)(r31)
+
+ bctr
+
+L(error_exit):
+ lwz r31,12(r1)
+ lwz r0,20(r1)
+ addi r1,r1,16
+ mtlr r0
+ blr
+
+L(do_sigret):
+ addi r1,r4,-0xd0
+ li r0,SYS_ify(rt_sigreturn)
+ sc
+ /* NOTREACHED */
+
+PSEUDO_END(__swapcontext)
+
+versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)
+
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+
+ENTRY(__novec_swapcontext)
+ /* Save the current context */
addi r3,r3,_UC_REG_SPACE
stw r3,_UC_REGS_PTR - _UC_REG_SPACE(r3)
stw r0,_UC_GREGS+(PT_R0*4)(r3)
@@ -220,22 +669,24 @@ ENTRY(__swapcontext)
bctr
-L(error_exit):
+L(novec_error_exit):
lwz r31,12(r1)
lwz r0,20(r1)
addi r1,r1,16
mtlr r0
blr
-L(do_sigret):
+L(novec_do_sigret):
addi r1,r4,-0xd0
li r0,SYS_ify(rt_sigreturn)
sc
/* NOTREACHED */
-PSEUDO_END(__swapcontext)
+PSEUDO_END(__novec_swapcontext)
+
+compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
-versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_3)
+#endif
#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
index 1ae082a3ef..e47b24a09e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
@@ -21,6 +21,13 @@
#define SIG_BLOCK 0
#define SIG_SETMASK 2
+#define _FRAME_BACKCHAIN 0
+#define _FRAME_LR_SAVE 4
+#define _FRAME_PARM_SAVE1 8
+#define _FRAME_PARM_SAVE2 12
+#define _FRAME_PARM_SAVE3 16
+#define _FRAME_PARM_SAVE4 20
+
#define _UC_LINK 4
#define _UC_STACK_SP 8
#define _UC_STACK_SIZE 16
@@ -32,3 +39,5 @@
#define _UC_GREGS 0
#define _UC_FREGS 192
#define _UC_VREGS 464
+#define _UC_VSCR 976
+#define _UC_VRSAVE 980