diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-11-17 02:49:45 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-11-17 02:49:45 +0000 |
commit | edba7a54eb83c37610b15454a21d54f47ec9dee7 (patch) | |
tree | 6c32b62c4db53ba9eb080ae34ea1fee5aefcba93 /sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S | |
parent | f52bb4d77eee0b7805ad57c069f29b544baa2db7 (diff) | |
download | glibc-edba7a54eb83c37610b15454a21d54f47ec9dee7.tar.gz |
[BZ #6411]
2008-11-13 Ryan S. Arnold <rsa@us.ibm.com>
[BZ #6411]
* sysdeps/powerpc/fpu/Makefile: Added test case tst-setcontext-fpscr.
* sysdeps/powerpc/fpu/feholdexcpt.c (_FPU_MASK_ALL): Define to replace
magic numbers.
* sysdeps/powerpc/fpu/fenv_libc.h (fesetenv_register): Dynamically
choose mtfsf insn based on PPC_FEATURE_HAS_DFP.
(relax_fenv_state): Same as above.
(FPSCR_29): Reserve bit in ISA 2.05.
(FPSCR_NI): Provide define for compat.
* sysdeps/powerpc/fpu/fesetenv.c (_FPU_MASK_ALL): Define to replace
magic numbers.
* sysdeps/powerpc/fpu/feupdateenv.c (_FPU_MASK_ALL): Define to replace
magic numbers.
* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: New file. Test case to
test setcontext and swapcontext with dynamic 64-bit FPSCR detection.
* sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S (__longjmp): Adjust
access to hwcap to account for hwcap size increase to uint64_t.
* sysdeps/powerpc/powerpc32/fpu/setjmp-common.S (__sigsetjmp ):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
(*setcontext): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power6/fpu/setcontext.S:
New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/power6/fpu/swapcontext.S:
New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
(*setcontext): dynamically select mtfsf insn based on
PPC_FEATURE_HAS_DFP. Adjust access to hwcap to account for hwcap size
increase to uint64_t.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
(*swapcontext): dynamically select mtfsf insn based on
PPC_FEATURE_HAS_DFP. Adjust access to hwcap to account for hwcap size
increase to uint64_t.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power6/fpu/setcontext.S:
New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/power6/fpu/swapcontext.S:
New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
(*setcontext): dynamically select mtfsf insn based on
PPC_FEATURE_HAS_DFP.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
(*swapcontext): dynamically select mtfsf insn based on
PPC_FEATURE_HAS_DFP.
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S')
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S index 0c7b945ed2..77c982242a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S @@ -1,5 +1,5 @@ /* Save current context and jump to a new context. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2008 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 @@ -143,33 +143,34 @@ ENTRY(__CONTEXT_FUNC_NAME) stfd fp30,_UC_FREGS+(30*8)(r3) stfd fp31,_UC_FREGS+(31*8)(r3) stfd fp0,_UC_FREGS+(32*8)(r3) - -# ifdef __CONTEXT_ENABLE_VRS -# ifdef PIC + +# ifdef PIC mflr r8 -# ifdef HAVE_ASM_PPC_REL16 +# ifdef HAVE_ASM_PPC_REL16 bcl 20,31,1f 1: mflr r7 addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l -# else +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 -# endif -# ifdef SHARED +# endif +# ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 - lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7) -# else + lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(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) + lwz r7,4(r7) # endif - andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16) +# else + lis r7,(_dl_hwcap+4)@ha + lwz r7,(_dl_hwcap+4)@l(r7) +# endif + +# ifdef __CONTEXT_ENABLE_VRS + andis. r6,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16) la r10,(_UC_VREGS)(r3) la r9,(_UC_VREGS+16)(r3) @@ -305,8 +306,8 @@ ENTRY(__CONTEXT_FUNC_NAME) # ifdef HAVE_ASM_PPC_REL16 bcl 20,31,5f 5: mflr r7 - addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha - addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l + addis r7,r7,_GLOBAL_OFFSET_TABLE_-5b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-5b@l # else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 @@ -314,14 +315,14 @@ ENTRY(__CONTEXT_FUNC_NAME) mtlr r8 # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) - lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7) + lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7) # else lwz r7,_dl_hwcap@got(r7) - lwz r7,0(r7) + lwz r7,4(r7) # endif # else - lis r7,_dl_hwcap@ha - lwz r7,_dl_hwcap@l(r7) + lis r7,(_dl_hwcap+4)@ha + lwz r7,(_dl_hwcap+4)@l(r7) # endif andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16) la r10,(_UC_VREGS)(r31) @@ -425,7 +426,20 @@ ENTRY(__CONTEXT_FUNC_NAME) /* Restore the floating-point registers */ lfd fp31,_UC_FREGS+(32*8)(r31) lfd fp0,_UC_FREGS+(0*8)(r31) - mtfsf 0xff,fp31 +# ifdef _ARCH_PWR6 + /* Use the extended four-operand version of the mtfsf insn. */ + mtfsf 0xff,fp0,1,0 +# else + /* Availability of DFP indicates a 64-bit FPSCR. */ + andi. r6,r7,PPC_FEATURE_HAS_DFP + beq 7f + /* Use the extended four-operand version of the mtfsf insn. */ + mtfsf 0xff,fp31,1,0 + b 8f + /* Continue to operate on the FPSCR as if it were 32-bits. */ +7: mtfsf 0xff,fp31 +8: +#endif /* _ARCH_PWR6 */ lfd fp1,_UC_FREGS+(1*8)(r31) lfd fp2,_UC_FREGS+(2*8)(r31) lfd fp3,_UC_FREGS+(3*8)(r31) |