diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/unix/sysv/linux/powerpc/powerpc64 | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2 glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip |
2.5-18.1
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/powerpc64')
19 files changed, 371 insertions, 131 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist deleted file mode 100644 index 6085928f34..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist +++ /dev/null @@ -1,4 +0,0 @@ -clone.S -fe_nomask.c -kernel_stat.h -ucontext_i.h diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S index 3f74f55271..f2ac00d4c7 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S @@ -1,5 +1,5 @@ /* brk system call for Linux. PowerPC64 version. - Copyright (C) 1995,96,97,99, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,99, 2000,02, 2006 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,8 +14,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> #define _ERRNO_H 1 @@ -33,6 +33,7 @@ ENTRY (BP_SYM (__brk)) DISCARD_BOUNDS (r3) /* the bounds are meaningless, so toss 'em. */ stdu r1,-64(r1) + cfi_adjust_cfa_offset (64) std r3,48(r1) DO_CALL(SYS_ify(brk)) ld r6,48(r1) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S index 287597c480..f1a55e64db 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S @@ -1,5 +1,5 @@ /* Wrapper around clone system call. PowerPC64 version. - Copyright (C) 1997,98,99,2000,02, 2004 Free Software Foundation, Inc. + Copyright (C) 1997,98,99,2000,02,04, 2006 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,8 +14,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> #define _ERRNO_H 1 @@ -48,11 +48,16 @@ ENTRY (BP_SYM (__clone)) /* Set up stack frame for parent. */ stdu r1,-80(r1) + cfi_adjust_cfa_offset (80) std r29,56(r1) std r30,64(r1) std r31,72(r1) + cfi_offset(r29,-56) + cfi_offset(r30,-64) + cfi_offset(r31,-72) #ifdef RESET_PID std r28,48(r1) + cfi_offset(r28,-48) #endif /* Set up stack frame for child. */ @@ -76,6 +81,10 @@ ENTRY (BP_SYM (__clone)) mr r6,r8 mr r7,r9 + /* End FDE now, because in the child the unwind info will be + wrong. */ + cfi_endproc + /* Do the call. */ DO_CALL(SYS_ify(clone)) @@ -127,6 +136,8 @@ L(parent): L(badargs): li r3,EINVAL b JUMPTARGET(__syscall_error) + + cfi_startproc END (BP_SYM (__clone)) weak_alias (BP_SYM (__clone), BP_SYM (clone)) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c index 7571f28780..62f735514a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c @@ -1,5 +1,5 @@ /* Procedure definition for FE_NOMASK_ENV for Linux/ppc64. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2006 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 @@ -22,7 +22,7 @@ #include <sysdep.h> #include <sys/syscall.h> #include <sys/prctl.h> -#include "kernel-features.h" +#include <kernel-features.h> const fenv_t * __fe_nomask_env (void) @@ -36,7 +36,7 @@ __fe_nomask_env (void) && INTERNAL_SYSCALL_ERRNO (result, err) == EINVAL) __set_errno (ENOSYS); # endif -#else +#else __set_errno (ENOSYS); #endif return FE_ENABLED_ENV; diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies new file mode 100644 index 0000000000..6243d2ef27 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies @@ -0,0 +1,2 @@ +# Override ldbl-opt with powerpc64 specific routines. +powerpc/powerpc64/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S index 61e0f8ed11..8d7c959ff9 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S @@ -1,5 +1,5 @@ /* Save current context. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006 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,13 +14,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> #include <rtld-global-offsets.h> #include <shlib-compat.h> -#include "kernel-features.h" +#include <kernel-features.h> #define __ASSEMBLY__ #include <asm/ptrace.h> @@ -37,9 +37,11 @@ ENTRY(__novec_getcontext) mflr r0 std r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3) std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) std r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3) std r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) std r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3) std r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3) std r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3) @@ -140,7 +142,9 @@ ENTRY(__novec_getcontext) /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */ mflr r0 std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset(128) li r3,ENOSYS bl JUMPTARGET(__syscall_error) nop @@ -175,9 +179,11 @@ ENTRY(__getcontext) mflr r0 std r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3) std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) std r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3) std r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) std r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3) std r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3) std r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3) @@ -387,7 +393,9 @@ L(has_no_vec): /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */ mflr r0 std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) li r3,ENOSYS bl JUMPTARGET(__syscall_error) nop diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h new file mode 100644 index 0000000000..ac4a0d5aa9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h @@ -0,0 +1,77 @@ +/* Run-time dynamic linker data structures for loaded ELF shared objects. + Copyright (C) 2005, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LDSODEFS_H + +/* Get the real definitions. */ +#include_next <ldsodefs.h> + +/* Now define our stuff. */ + +static __always_inline bool +_dl_ppc64_is_opd_sym (const struct link_map *l, const ElfW(Sym) *sym) +{ + return (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC + && l->l_addr + sym->st_value >= (ElfW(Addr)) l->l_ld + && l->l_addr + sym->st_value < l->l_map_end + && sym->st_size != 0); +} + +static __always_inline bool +_dl_ppc64_addr_sym_match (const struct link_map *l, const ElfW(Sym) *sym, + const ElfW(Sym) *matchsym, ElfW(Addr) addr) +{ + ElfW(Addr) value = l->l_addr + sym->st_value; + if (_dl_ppc64_is_opd_sym (l, sym)) + { + if (addr < value || addr >= value + 24) + { + value = *(ElfW(Addr) *) value; + if (addr < value || addr >= value + sym->st_size) + return false; + } + } + else if (sym->st_shndx == SHN_UNDEF || sym->st_size == 0) + { + if (addr != value) + return false; + } + else if (addr < value || addr >= value + sym->st_size) + return false; + + if (matchsym == NULL) + return true; + + ElfW(Addr) matchvalue = l->l_addr + matchsym->st_value; + if (_dl_ppc64_is_opd_sym (l, matchsym) + && (addr < matchvalue || addr > matchvalue + 24)) + matchvalue = *(ElfW(Addr) *) matchvalue; + + return matchvalue < value; +} + +/* If this is a function symbol defined past the end of our dynamic + section, then it must be a function descriptor. Allow these symbols + to match their associated function code range as well as the + descriptor addresses. */ +#undef DL_ADDR_SYM_MATCH +#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \ + _dl_ppc64_addr_sym_match (L, SYM, MATCHSYM, ADDR) + +#endif /* ldsodefs.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S index 8034559200..4a82802d96 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S @@ -1,5 +1,5 @@ /* Create new context. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006 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,11 +14,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> -#include "kernel-features.h" +#include <kernel-features.h> #define __ASSEMBLY__ #include <asm/ptrace.h> @@ -41,7 +41,9 @@ ENTRY(__makecontext) /* Get the address of the target functions first parameter. */ addi r6,r1,FRAME_PARM4_SAVE std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) /* Get the ucontexts stack pointer and size. Compute the top of stack and round down to a quadword boundary. Then stack a dummy frame @@ -168,7 +170,9 @@ L(gotexitcodeaddr): /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */ mflr r0 std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) li r3,ENOSYS bl JUMPTARGET(__syscall_error) nop @@ -180,4 +184,4 @@ L(gotexitcodeaddr): #endif END(__makecontext) -weak_alias(__makecontext, makecontext) +weak_alias (__makecontext, makecontext) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c index d5b77e0b57..315d1195e8 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003 - Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,7 +26,7 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include "kernel-features.h" +#include <kernel-features.h> #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 @@ -57,7 +57,7 @@ __libc_pread (fd, buf, count, offset) return result; } - + int oldtype = LIBC_CANCEL_ASYNC (); result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c index 9bbe389420..f775e1f1eb 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003 - Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,7 +25,7 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include "kernel-features.h" +#include <kernel-features.h> #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c index 96b72e18a5..0f509154e2 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003 - Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,7 +26,7 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include "kernel-features.h" +#include <kernel-features.h> #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c index 9e68acdf08..22224324a1 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003 - Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,7 +25,7 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include "kernel-features.h" +#include <kernel-features.h> #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S index 6514f442a6..48e9af363d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S @@ -1,5 +1,5 @@ /* Switch to context. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006 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,13 +14,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> #include <rtld-global-offsets.h> #include <shlib-compat.h> -#include "kernel-features.h" +#include <kernel-features.h> #define __ASSEMBLY__ #include <asm/ptrace.h> @@ -33,8 +33,11 @@ ENTRY(__novec_setcontext) #ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL mflr r0 std r31,-8(1) + cfi_offset(r31,-8) std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) mr r31,r3 /* @@ -47,7 +50,7 @@ ENTRY(__novec_setcontext) * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(nv_do_sigret) @@ -104,7 +107,7 @@ ENTRY(__novec_setcontext) ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 + mtcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) @@ -167,7 +170,9 @@ L(nv_do_sigret): /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */ mflr r0 std r0,FRAME_LR_SAVE(r1) + cfi_offset(lr,FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset(128) li r3,ENOSYS bl JUMPTARGET(__syscall_error) nop @@ -199,8 +204,11 @@ ENTRY(__setcontext) #ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL mflr r0 std r31,-8(1) + cfi_offset(r31,-8) std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) mr r31,r3 /* @@ -213,7 +221,7 @@ ENTRY(__setcontext) * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(do_sigret) @@ -380,11 +388,11 @@ L(has_no_vec): ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) ld r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31) + mtcr r0 ld r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31) ld r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31) ld r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31) @@ -443,7 +451,9 @@ L(do_sigret): /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */ mflr r0 std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) li r3,ENOSYS bl JUMPTARGET(__syscall_error) nop diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S index ec3ab5d9e6..15d8e84c1f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995,96,97,99, 2003, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + write to the Free Software Foundation, Inc., 51 Franklin Street, + Fifth Floor, Boston MA 02110-1301, USA. */ #include <sysdep-cancel.h> #include <socketcall.h> @@ -41,18 +41,17 @@ #define stackblock 80 /* offset to socket parm area. */ -#ifndef socket -/* If this is just socket.S leave it alone! */ -#else #ifndef __socket -#define __socket P(__,socket) -#endif +# ifndef NO_WEAK_ALIAS +# define __socket P(__,socket) +# else +# define __socket socket +# endif #endif .text ENTRY(__socket) CALL_MCOUNT NARGS - cfi_startproc stdu r1,-144(r1) cfi_adjust_cfa_offset(144) #if NARGS >= 1 @@ -117,7 +116,8 @@ ENTRY(__socket) addi r1,r1,144 PSEUDO_RET #endif - cfi_endproc PSEUDO_END (__socket) +#ifndef NO_WEAK_ALIAS weak_alias (__socket, socket) +#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S index f99df951a2..936d641b6b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S @@ -1,5 +1,5 @@ /* Save current context and install the given one. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006 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,13 +14,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> #include <rtld-global-offsets.h> #include <shlib-compat.h> -#include "kernel-features.h" +#include <kernel-features.h> #define __ASSEMBLY__ #include <asm/ptrace.h> @@ -35,11 +35,14 @@ ENTRY(__novec_swapcontext) std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3) mflr r0 std r31,-8(1) + cfi_offset(r31,-8) std r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3) std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) std r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3) std r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) std r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3) std r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3) std r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3) @@ -150,7 +153,7 @@ ENTRY(__novec_swapcontext) * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(nv_do_sigret) @@ -199,7 +202,7 @@ ENTRY(__novec_swapcontext) ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 + mtcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) @@ -262,6 +265,7 @@ L(nv_do_sigret): /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */ mflr r0 std r0,FRAME_LR_SAVE(r1) + cfi_offset(lr,FRAME_LR_SAVE) stdu r1,-128(r1) li r3,ENOSYS bl JUMPTARGET(__syscall_error) @@ -296,11 +300,14 @@ ENTRY(__swapcontext) std r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3) mflr r0 std r31,-8(1) + cfi_offset(r31,-8) std r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3) std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) std r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3) std r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3) stdu r1,-128(r1) + cfi_adjust_cfa_offset(128) std r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3) std r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3) std r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3) @@ -521,7 +528,7 @@ L(has_no_vec): * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(do_sigret) @@ -681,11 +688,11 @@ L(has_no_vec2): ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) ld r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31) + mtcr r0 ld r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31) ld r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31) ld r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31) @@ -744,7 +751,9 @@ L(do_sigret): /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub. */ mflr r0 std r0,FRAME_LR_SAVE(r1) + cfi_offset (lr, FRAME_LR_SAVE) stdu r1,-128(r1) + cfi_adjust_cfa_offset (128) li r3,ENOSYS bl JUMPTARGET(__syscall_error) nop diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 38a376fa90..aab4b721c0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. +/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006 + 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 @@ -23,6 +23,7 @@ #define _LINUX_POWERPC_SYSDEP_H 1 #include <sysdeps/unix/powerpc/sysdep.h> +#include <tls.h> /* Define __set_errno() for INLINE_SYSCALL macro below. */ #ifndef __ASSEMBLER__ @@ -61,12 +62,118 @@ #ifdef __ASSEMBLER__ /* This seems to always be the case on PPC. */ -#define ALIGNARG(log2) log2 +# define ALIGNARG(log2) log2 /* For ELF we need the `.type' directive to make shared libs work right. */ -#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; -#define ASM_SIZE_DIRECTIVE(name) .size name,.-name +# define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; +# define ASM_SIZE_DIRECTIVE(name) .size name,.-name -#endif /* __ASSEMBLER__ */ +#endif /* __ASSEMBLER__ */ + +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. + It falls back to the syscall in the case that the vDSO doesn't + exist or fails for ENOSYS */ +#ifdef SHARED +# define INLINE_VSYSCALL(name, nr, args...) \ + ({ \ + __label__ out; \ + __label__ iserr; \ + INTERNAL_SYSCALL_DECL (sc_err); \ + long int sc_ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + goto out; \ + if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ + goto iserr; \ + } \ + \ + sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \ + if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + { \ + iserr: \ + __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ + sc_ret = -1L; \ + } \ + out: \ + sc_ret; \ + }) +#else +# define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) +#endif + +#ifdef SHARED +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + ({ \ + __label__ out; \ + long int v_ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ + || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ + goto out; \ + } \ + v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \ + out: \ + v_ret; \ + }) +#else +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL (name, err, nr, ##args) +#endif + +/* This version is for internal uses when there is no desire + to set errno */ +#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \ + ({ \ + long int sc_ret = ENOSYS; \ + \ + if (__vdso_##name != NULL) \ + sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + else \ + err = 1 << 28; \ + sc_ret; \ + }) + +/* List of system calls which are supported as vsyscalls. */ +#define HAVE_CLOCK_GETRES_VSYSCALL 1 +#define HAVE_CLOCK_GETTIME_VSYSCALL 1 + +/* Define a macro which expands inline into the wrapper code for a system + call. This use is for internal calls that do not need to handle errors + normally. It will never touch errno. This returns just what the kernel + gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) + the negation of the return value in the kernel gets reverted. */ + +#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \ + ({ \ + register void *r0 __asm__ ("r0"); \ + register long int r3 __asm__ ("r3"); \ + register long int r4 __asm__ ("r4"); \ + register long int r5 __asm__ ("r5"); \ + register long int r6 __asm__ ("r6"); \ + register long int r7 __asm__ ("r7"); \ + register long int r8 __asm__ ("r8"); \ + LOADARGS_##nr (funcptr, args); \ + __asm__ __volatile__ \ + ("mtctr %0\n\t" \ + "bctrl\n\t" \ + "mfcr %0\n\t" \ + "0:" \ + : "=&r" (r0), \ + "=&r" (r3), "=&r" (r4), "=&r" (r5), \ + "=&r" (r6), "=&r" (r7), "=&r" (r8) \ + : ASM_INPUT_##nr \ + : "r9", "r10", "r11", "r12", \ + "cr0", "ctr", "lr", "memory"); \ + err = (long int) r0; \ + (int) r3; \ + }) #undef INLINE_SYSCALL @@ -100,7 +207,7 @@ register long int r6 __asm__ ("r6"); \ register long int r7 __asm__ ("r7"); \ register long int r8 __asm__ ("r8"); \ - LOADARGS_##nr(name, args); \ + LOADARGS_##nr (name, ##args); \ __asm__ __volatile__ \ ("sc\n\t" \ "mfcr %0\n\t" \ @@ -115,14 +222,14 @@ (int) r3; \ }) #define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) + INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) long int err #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \ - (__builtin_expect (err & (1 << 28), 0)) + ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) (val) @@ -180,4 +287,29 @@ #define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) #define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) + +/* Pointer mangling support. */ +#if defined NOT_IN_libc && defined IS_IN_rtld +/* We cannot use the thread descriptor because in ld.so we use setjmp + earlier than the descriptor is initialized. */ +#else +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(reg, tmpreg) \ + ld tmpreg,POINTER_GUARD(r13); \ + xor reg,tmpreg,reg +# define PTR_MANGLE2(reg, tmpreg) \ + xor reg,tmpreg,reg +# define PTR_MANGLE3(destreg, reg, tmpreg) \ + ld tmpreg,POINTER_GUARD(r13); \ + xor destreg,tmpreg,reg +# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) +# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) +# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) +# else +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + #endif /* linux/powerpc/powerpc64/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h deleted file mode 100644 index 45f1bfdae9..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Offsets and other constants needed in the *context() function - implementation. - Copyright (C) 2002 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define SIG_BLOCK 0 -#define SIG_SETMASK 2 - -/* Offsets of the fields in the powerpc64 ABI stack frame. */ - -#define FRAME_BACKCHAIN 0 -#define FRAME_CR_SAVE 8 -#define FRAME_LR_SAVE 16 -#define FRAME_COMPILER_DW 24 -#define FRAME_LINKER_DW 32 -#define FRAME_TOC_SAVE 40 -#define FRAME_PARM_SAVE 48 -#define FRAME_PARM1_SAVE 48 -#define FRAME_PARM2_SAVE 56 -#define FRAME_PARM3_SAVE 64 -#define FRAME_PARM4_SAVE 72 -#define FRAME_PARM5_SAVE 80 -#define FRAME_PARM6_SAVE 88 -#define FRAME_PARM7_SAVE 96 -#define FRAME_PARM8_SAVE 104 -#define FRAME_PARM9_SAVE 112 - - -/* Offsets of the fields in the ucontext_t structure. */ - -#define UCONTEXT_LINK 8 -#define UCONTEXT_STACK 16 -#define UCONTEXT_STACK_SP 16 -#define UCONTEXT_STACK_FLAGS 24 -#define UCONTEXT_STACK_SIZE 32 -#define UCONTEXT_SIGMASK 40 -#define UCONTEXT_MCONTEXT 168 -#define SIGCONTEXT_SIGNAL 200 -#define SIGCONTEXT_HANDLER 208 -#define SIGCONTEXT_OLDMASK 216 -#define SIGCONTEXT_PT_REGS 224 -#define SIGCONTEXT_GP_REGS 232 -#define SIGCONTEXT_FP_REGS 616 -#define SIGCONTEXT_V_REGS_PTR 880 -#define SIGCONTEXT_V_RESERVE 888 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym new file mode 100644 index 0000000000..a35418d9d4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym @@ -0,0 +1,50 @@ +#include <stddef.h> +#include <signal.h> +#include <sys/ucontext.h> + +-- + +SIG_BLOCK +SIG_SETMASK + + +-- Offsets of the fields in the powerpc64 ABI stack frame. +-- XXX Do these correspond to some struct? + +FRAME_BACKCHAIN 0 +FRAME_CR_SAVE 8 +FRAME_LR_SAVE 16 +FRAME_COMPILER_DW 24 +FRAME_LINKER_DW 32 +FRAME_TOC_SAVE 40 +FRAME_PARM_SAVE 48 +FRAME_PARM1_SAVE 48 +FRAME_PARM2_SAVE 56 +FRAME_PARM3_SAVE 64 +FRAME_PARM4_SAVE 72 +FRAME_PARM5_SAVE 80 +FRAME_PARM6_SAVE 88 +FRAME_PARM7_SAVE 96 +FRAME_PARM8_SAVE 104 +FRAME_PARM9_SAVE 112 + + +-- Offsets of the fields in the ucontext_t structure. +#define ucontext(member) offsetof (ucontext_t, member) +#define mcontext(member) ucontext (uc_mcontext.member) + +UCONTEXT_LINK ucontext (uc_link) +UCONTEXT_STACK ucontext (uc_stack) +UCONTEXT_STACK_SP ucontext (uc_stack.ss_sp) +UCONTEXT_STACK_FLAGS ucontext (uc_stack.ss_flags) +UCONTEXT_STACK_SIZE ucontext (uc_stack.ss_size) +UCONTEXT_SIGMASK ucontext (uc_sigmask) +UCONTEXT_MCONTEXT ucontext (uc_mcontext) +SIGCONTEXT_SIGNAL mcontext (signal) +SIGCONTEXT_HANDLER mcontext (handler) +SIGCONTEXT_OLDMASK mcontext (oldmask) +SIGCONTEXT_PT_REGS mcontext (regs) +SIGCONTEXT_GP_REGS mcontext (gp_regs) +SIGCONTEXT_FP_REGS mcontext (fp_regs) +SIGCONTEXT_V_REGS_PTR mcontext (v_regs) +SIGCONTEXT_V_RESERVE mcontext (vmx_reserve) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c index 9a91ba5b2f..e10b40f96c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c @@ -1 +1 @@ -#include <sysdeps/unix/sysv/linux/hppa/umount.c> +#include <sysdeps/unix/sysv/linux/x86_64/umount.c> |