diff options
Diffstat (limited to 'libc/sysdeps/linux/powerpc')
-rw-r--r-- | libc/sysdeps/linux/powerpc/Makefile.arch | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/atomic.h | 23 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/mathdef.h | 7 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/syscalls.h | 30 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/sysdep.h | 301 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/clone.S | 75 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/powerpc32/sysdep.h | 151 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/powerpc64/sysdep.h | 264 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/pread_write.c | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/sysdep.h | 196 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/vfork.S | 1 |
11 files changed, 721 insertions, 336 deletions
diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch b/libc/sysdeps/linux/powerpc/Makefile.arch index 8c7fc2de6..cdb35ba43 100644 --- a/libc/sysdeps/linux/powerpc/Makefile.arch +++ b/libc/sysdeps/linux/powerpc/Makefile.arch @@ -13,7 +13,10 @@ endif SSRC := \ __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \ - clone.S __uClibc_syscall.S syscall.S vfork.S + __uClibc_syscall.S syscall.S +ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y) +SSRC += clone.S vfork.S +endif ifeq ($(CONFIG_E500),y) ARCH_HEADERS := fenv.h diff --git a/libc/sysdeps/linux/powerpc/bits/atomic.h b/libc/sysdeps/linux/powerpc/bits/atomic.h index 1088d2f3c..3dbbb3a09 100644 --- a/libc/sysdeps/linux/powerpc/bits/atomic.h +++ b/libc/sysdeps/linux/powerpc/bits/atomic.h @@ -335,12 +335,28 @@ # define __arch_atomic_decrement_if_positive_64(mem) \ ({ abort (); (*mem)--; }) +#ifdef _ARCH_PWR4 +/* + * Newer powerpc64 processors support the new "light weight" sync (lwsync) + * So if the build is using -mcpu=[power4,power5,power5+,970] we can + * safely use lwsync. + */ +# define atomic_read_barrier() __asm ("lwsync" ::: "memory") +/* + * "light weight" sync can also be used for the release barrier. + */ +# ifndef UP +# define __ARCH_REL_INSTR "lwsync" +# endif +#else + /* * Older powerpc32 processors don't support the new "light weight" * sync (lwsync). So the only safe option is to use normal sync * for all powerpc32 applications. */ # define atomic_read_barrier() __asm__ ("sync" ::: "memory") +#endif #endif @@ -387,6 +403,13 @@ typedef uintmax_t uatomic_max_t; # endif #endif +#ifndef MUTEX_HINT_ACQ +# define MUTEX_HINT_ACQ +#endif +#ifndef MUTEX_HINT_REL +# define MUTEX_HINT_REL +#endif + #define atomic_full_barrier() __asm__ ("sync" ::: "memory") #define atomic_write_barrier() __asm__ ("eieio" ::: "memory") diff --git a/libc/sysdeps/linux/powerpc/bits/mathdef.h b/libc/sysdeps/linux/powerpc/bits/mathdef.h index d6d35dda0..c64b8a395 100644 --- a/libc/sysdeps/linux/powerpc/bits/mathdef.h +++ b/libc/sysdeps/linux/powerpc/bits/mathdef.h @@ -46,12 +46,9 @@ typedef double double_t; /* `double' expressions are evaluated as #endif /* ISO C99 */ #ifndef __NO_LONG_DOUBLE_MATH -#include <bits/wordsize.h> /* Signal that we do not really have a `long double'. The disables the declaration of all the `long double' function variants. */ -# if __WORDSIZE == 32 +# if !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ # define __NO_LONG_DOUBLE_MATH 1 -# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ -# define __NO_LONG_DOUBLE_MATH 1 -# endif /* __WORDSIZE == 32 */ +# endif #endif /* __NO_LONG_DOUBLE_MATH */ diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h index f689c60ae..1c7b929b2 100644 --- a/libc/sysdeps/linux/powerpc/bits/syscalls.h +++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h @@ -116,7 +116,7 @@ register long int r10 __asm__ ("r10"); \ register long int r11 __asm__ ("r11"); \ register long int r12 __asm__ ("r12"); \ - LOADARGS_##nr (funcptr, args); \ + LOAD_ARGS_##nr (funcptr, args); \ __asm__ __volatile__ \ ("mtctr %0\n\t" \ "bctrl\n\t" \ @@ -153,7 +153,7 @@ register long int r10 __asm__ ("r10"); \ register long int r11 __asm__ ("r11"); \ register long int r12 __asm__ ("r12"); \ - LOADARGS_##nr(name, args); \ + LOAD_ARGS_##nr(name, args); \ __asm__ __volatile__ \ ("sc \n\t" \ "mfcr %0" \ @@ -178,41 +178,41 @@ extern void __illegally_sized_syscall_arg4(void); extern void __illegally_sized_syscall_arg5(void); extern void __illegally_sized_syscall_arg6(void); -# define LOADARGS_0(name, dummy) \ +# define LOAD_ARGS_0(name, dummy) \ r0 = name -# define LOADARGS_1(name, __arg1) \ +# define LOAD_ARGS_1(name, __arg1) \ long int arg1 = (long int) (__arg1); \ - LOADARGS_0(name, 0); \ + LOAD_ARGS_0(name, 0); \ if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \ __illegally_sized_syscall_arg1 (); \ r3 = arg1 -# define LOADARGS_2(name, __arg1, __arg2) \ +# define LOAD_ARGS_2(name, __arg1, __arg2) \ long int arg2 = (long int) (__arg2); \ - LOADARGS_1(name, __arg1); \ + LOAD_ARGS_1(name, __arg1); \ if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \ __illegally_sized_syscall_arg2 (); \ r4 = arg2 -# define LOADARGS_3(name, __arg1, __arg2, __arg3) \ +# define LOAD_ARGS_3(name, __arg1, __arg2, __arg3) \ long int arg3 = (long int) (__arg3); \ - LOADARGS_2(name, __arg1, __arg2); \ + LOAD_ARGS_2(name, __arg1, __arg2); \ if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \ __illegally_sized_syscall_arg3 (); \ r5 = arg3 -# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ +# define LOAD_ARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ long int arg4 = (long int) (__arg4); \ - LOADARGS_3(name, __arg1, __arg2, __arg3); \ + LOAD_ARGS_3(name, __arg1, __arg2, __arg3); \ if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \ __illegally_sized_syscall_arg4 (); \ r6 = arg4 -# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ +# define LOAD_ARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ long int arg5 = (long int) (__arg5); \ - LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ + LOAD_ARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \ __illegally_sized_syscall_arg5 (); \ r7 = arg5 -# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ +# define LOAD_ARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ long int arg6 = (long int) (__arg6); \ - LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ + LOAD_ARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \ __illegally_sized_syscall_arg6 (); \ r8 = arg6 diff --git a/libc/sysdeps/linux/powerpc/bits/sysdep.h b/libc/sysdeps/linux/powerpc/bits/sysdep.h deleted file mode 100644 index 478ebdd7a..000000000 --- a/libc/sysdeps/linux/powerpc/bits/sysdep.h +++ /dev/null @@ -1,301 +0,0 @@ -/* Copyright (C) 1992,1997-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 - 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 _LINUX_POWERPC_SYSDEP_H -#define _LINUX_POWERPC_SYSDEP_H 1 - -#include <sysdeps/unix/powerpc/sysdep.h> -#include <tls.h> - -/* Some systen calls got renamed over time, but retained the same semantics. - Handle them here so they can be catched by both C and assembler stubs in - glibc. */ - -#ifdef __NR_pread64 -# ifdef __NR_pread -# error "__NR_pread and __NR_pread64 both defined???" -# endif -# define __NR_pread __NR_pread64 -#endif - -#ifdef __NR_pwrite64 -# ifdef __NR_pwrite -# error "__NR_pwrite and __NR_pwrite64 both defined???" -# endif -# define __NR_pwrite __NR_pwrite64 -#endif - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#ifdef __STDC__ -# define SYS_ify(syscall_name) __NR_##syscall_name -#else -# define SYS_ify(syscall_name) __NR_/**/syscall_name -#endif - -#ifndef __ASSEMBLER__ - -# include <errno.h> - -# 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 - -# 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 VDSO - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. - On powerpc a system call basically clobbers the same registers like a - function call, with the exception of LR (which is needed for the - "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal - an error return status). */ -# 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"); \ - register long int r9 __asm__ ("r9"); \ - register long int r10 __asm__ ("r10"); \ - register long int r11 __asm__ ("r11"); \ - register long int r12 __asm__ ("r12"); \ - LOADARGS_##nr (funcptr, args); \ - __asm__ __volatile__ \ - ("mtctr %0\n\t" \ - "bctrl\n\t" \ - "mfcr %0" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \ - "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \ - : ASM_INPUT_##nr \ - : "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - (int) r3; \ - }) - -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - -/* 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. - On powerpc a system call basically clobbers the same registers like a - function call, with the exception of LR (which is needed for the - "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal - an error return status). */ - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) long int err - -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register long int 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"); \ - register long int r9 __asm__ ("r9"); \ - register long int r10 __asm__ ("r10"); \ - register long int r11 __asm__ ("r11"); \ - register long int r12 __asm__ ("r12"); \ - LOADARGS_##nr(name, args); \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %0" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \ - "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \ - : ASM_INPUT_##nr \ - : "cr0", "ctr", "memory"); \ - err = r0; \ - (int) r3; \ - }) -# undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) - -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (val) - -# define LOADARGS_0(name, dummy) \ - r0 = name -# define LOADARGS_1(name, __arg1) \ - long int arg1 = (long int) (__arg1); \ - LOADARGS_0(name, 0); \ - extern void __illegally_sized_syscall_arg1 (void); \ - if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \ - __illegally_sized_syscall_arg1 (); \ - r3 = arg1 -# define LOADARGS_2(name, __arg1, __arg2) \ - long int arg2 = (long int) (__arg2); \ - LOADARGS_1(name, __arg1); \ - extern void __illegally_sized_syscall_arg2 (void); \ - if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \ - __illegally_sized_syscall_arg2 (); \ - r4 = arg2 -# define LOADARGS_3(name, __arg1, __arg2, __arg3) \ - long int arg3 = (long int) (__arg3); \ - LOADARGS_2(name, __arg1, __arg2); \ - extern void __illegally_sized_syscall_arg3 (void); \ - if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \ - __illegally_sized_syscall_arg3 (); \ - r5 = arg3 -# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ - long int arg4 = (long int) (__arg4); \ - LOADARGS_3(name, __arg1, __arg2, __arg3); \ - extern void __illegally_sized_syscall_arg4 (void); \ - if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \ - __illegally_sized_syscall_arg4 (); \ - r6 = arg4 -# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ - long int arg5 = (long int) (__arg5); \ - LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ - extern void __illegally_sized_syscall_arg5 (void); \ - if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \ - __illegally_sized_syscall_arg5 (); \ - r7 = arg5 -# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ - long int arg6 = (long int) (__arg6); \ - LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ - extern void __illegally_sized_syscall_arg6 (void); \ - if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \ - __illegally_sized_syscall_arg6 (); \ - r8 = arg6 - -# define ASM_INPUT_0 "0" (r0) -# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) -# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) -# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) -# define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) -# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) -# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) - -#endif /* __ASSEMBLER__ */ - - -/* 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) \ - lwz tmpreg,POINTER_GUARD(r2); \ - xor reg,tmpreg,reg -# define PTR_MANGLE2(reg, tmpreg) \ - xor reg,tmpreg,reg -# define PTR_MANGLE3(destreg, reg, tmpreg) \ - lwz tmpreg,POINTER_GUARD(r2); \ - 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/powerpc32/sysdep.h */ diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S index 15d03f679..307053fe5 100644 --- a/libc/sysdeps/linux/powerpc/clone.S +++ b/libc/sysdeps/linux/powerpc/clone.S @@ -18,24 +18,27 @@ 02111-1307 USA. */ #include <features.h> -#include "ppc_asm.h" #define _ERRNO_H 1 #include <bits/errno.h> -#include <sys/syscall.h> +#include <sysdep.h> + +#define CLONE_VM 0x00000100 +#define CLONE_THREAD 0x00010000 /* This is the only really unusual system call in PPC linux, but not because of any weirdness in the system call itself; because of all the freaky stuff we have to do to make the call useful. */ /* int [r3] clone(int (*fn)(void *arg) [r3], void *child_stack [r4], - int flags [r5], void *arg [r6]); */ + int flags [r5], void *arg [r6], void *parent_tid [r7], + void *tls [r8], void *child_tid [r9]); */ #ifdef __NR_clone - .globl clone - .type clone,@function + .globl __clone + .type __clone,@function .align 2 -clone: +__clone: /* Check for child_stack == NULL || fn == NULL. */ cmpwi cr0,r4,0 cmpwi cr1,r3,0 @@ -44,22 +47,44 @@ clone: /* Set up stack frame for parent. */ stwu r1,-32(r1) + cfi_adjust_cfa_offset (32) +#ifdef RESET_PID + stmw r28,16(r1) +#else +# ifdef __ASSUME_FIXED_CLONE_SYSCALL stmw r29,16(r1) - +# else + stmw r30,16(r1) +# endif +#endif + /* Set up stack frame for child. */ clrrwi r4,r4,4 li r0,0 stwu r0,-16(r4) /* Save fn, args, stack across syscall. */ - mr r29,r3 /* Function in r29. */ - mr r30,r4 /* Stack pointer in r30. */ + mr r30,r3 /* Function in r30. */ +#ifndef __ASSUME_FIXED_CLONE_SYSCALL + mr r29,r4 /* Stack pointer in r29. */ +#endif +#ifdef RESET_PID + mr r28,r5 +#endif mr r31,r6 /* Argument in r31. */ /* 'flags' argument is first parameter to clone syscall. (The other argument is the stack pointer, already in r4.) */ mr r3,r5 + /* Move the parent_tid, child_tid and tls arguments. */ + mr r5,r7 + mr r6,r8 + mr r7,r9 + + /* End FDE now, because in the child the unwind info will be wrong. */ + cfi_endproc + /* Do the call. */ li 0, __NR_clone sc @@ -69,13 +94,27 @@ clone: crandc cr1*4+eq,cr1*4+eq,cr0*4+so bne- cr1,.Lparent /* The '-' is to minimise the race. */ +#ifndef __ASSUME_FIXED_CLONE_SYSCALL /* On at least mklinux DR3a5, clone() doesn't actually change the stack pointer. I'm pretty sure this is a bug, because it adds a race condition if a signal is sent to a thread just after it is created (in the previous three instructions). */ - mr r1,r30 + mr r1,r29 +#endif + +#ifdef RESET_PID + andis. r0,r28,CLONE_THREAD>>16 + bne+ r0,.Loldpid + andi. r0,r28,CLONE_VM + li r3,-1 + bne- r0,.Lnomoregetpid +.Lnomoregetpid: + stw r3,TID(r2) + stw r3,PID(r2) +.Loldpid: +#endif /* Call procedure. */ - mtctr r29 + mtctr r30 mr r3,r31 bctrl /* Call _exit with result from procedure. */ @@ -83,16 +122,24 @@ clone: .Lparent: /* Parent. Restore registers & return. */ +#ifdef RESET_PID + lmw r28,16(r1) +#else +# ifndef __ASSUME_FIXED_CLONE_SYSCALL lmw r29,16(r1) +# else + lmw r30,16(r1) +# endif +#endif addi r1,r1,32 bnslr+ - b __syscall_error .Lbadargs: li r3,EINVAL - b __syscall_error - .size clone,.-clone + cfi_startproc + .size __clone,.-__clone +weak_alias(__clone, clone) #endif diff --git a/libc/sysdeps/linux/powerpc/powerpc32/sysdep.h b/libc/sysdeps/linux/powerpc/powerpc32/sysdep.h new file mode 100644 index 000000000..3f6fefdcb --- /dev/null +++ b/libc/sysdeps/linux/powerpc/powerpc32/sysdep.h @@ -0,0 +1,151 @@ +/* Assembly macros for 32-bit PowerPC. + Copyright (C) 1999, 2001, 2002, 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 + 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., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ + +#ifdef __ASSEMBLER__ + +#ifdef __ELF__ + +/* If compiled for profiling, call `_mcount' at the start of each + function. */ +#ifdef PROF +/* The mcount code relies on a the return address being on the stack + to locate our caller and so it can restore it; so store one just + for its benefit. */ +# define CALL_MCOUNT \ + mflr r0; \ + stw r0,4(r1); \ + cfi_offset (lr, 4); \ + bl JUMPTARGET(_mcount); +#else /* PROF */ +# define CALL_MCOUNT /* Do nothing. */ +#endif /* PROF */ + +#define ENTRY(name) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(2); \ + C_LABEL(name) \ + cfi_startproc; \ + CALL_MCOUNT + +#define EALIGN_W_0 /* No words to insert. */ +#define EALIGN_W_1 nop +#define EALIGN_W_2 nop;nop +#define EALIGN_W_3 nop;nop;nop +#define EALIGN_W_4 EALIGN_W_3;nop +#define EALIGN_W_5 EALIGN_W_4;nop +#define EALIGN_W_6 EALIGN_W_5;nop +#define EALIGN_W_7 EALIGN_W_6;nop + +/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes + past a 2^align boundary. */ +#ifdef PROF +# define EALIGN(name, alignt, words) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(2); \ + C_LABEL(name) \ + cfi_startproc; \ + CALL_MCOUNT \ + b 0f; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + 0: +#else /* PROF */ +# define EALIGN(name, alignt, words) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(name) \ + cfi_startproc; +#endif + +#undef END +#define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(name) + +#define DO_CALL(syscall) \ + li 0,syscall; \ + sc + +#undef JUMPTARGET +#ifdef PIC +# define JUMPTARGET(name) name##@plt +#else +# define JUMPTARGET(name) name +#endif + +#if defined SHARED && defined DO_VERSIONING && defined PIC \ + && !defined NO_HIDDEN +# undef HIDDEN_JUMPTARGET +# define HIDDEN_JUMPTARGET(name) __GI_##name##@local +#endif + +#define PSEUDO(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET \ + bnslr+; \ + b __syscall_error@local +#define ret PSEUDO_RET + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + END (name) + +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET_NOERRNO \ + blr +#define ret_NOERRNO PSEUDO_RET_NOERRNO + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(name) \ + END (name) + +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET_ERRVAL \ + blr +#define ret_ERRVAL PSEUDO_RET_ERRVAL + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + END (name) + +/* Local labels stripped out by the linker. */ +#undef L +#define L(x) .L##x + +/* Label in text section. */ +#define C_TEXT(name) name + +#endif /* __ELF__ */ + +#endif /* __ASSEMBLER__ */ diff --git a/libc/sysdeps/linux/powerpc/powerpc64/sysdep.h b/libc/sysdeps/linux/powerpc/powerpc64/sysdep.h new file mode 100644 index 000000000..467288576 --- /dev/null +++ b/libc/sysdeps/linux/powerpc/powerpc64/sysdep.h @@ -0,0 +1,264 @@ +/* Assembly macros for 64-bit PowerPC. + Copyright (C) 2002, 2003, 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 + 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., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ + +#ifdef __ELF__ + +#ifdef __ASSEMBLER__ + +/* Support macros for CALL_MCOUNT. */ + .macro SAVE_ARG NARG + .if \NARG + SAVE_ARG \NARG-1 + std 2+\NARG,-72+8*(\NARG)(1) + .endif + .endm + + .macro REST_ARG NARG + .if \NARG + REST_ARG \NARG-1 + ld 2+\NARG,40+8*(\NARG)(1) + .endif + .endm + +/* If compiled for profiling, call `_mcount' at the start of each function. + see ppc-mcount.S for more details. */ + .macro CALL_MCOUNT NARG +#ifdef PROF + mflr r0 + SAVE_ARG \NARG + std r0,16(r1) + stdu r1,-112(r1) + bl JUMPTARGET (_mcount) + ld r0,128(r1) + REST_ARG \NARG + addi r1,r1,112 + mtlr r0 +#endif + .endm + +#ifdef USE_PPC64_OVERLAPPING_OPD +# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase +#else +# define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase, 0 +#endif + +#define ENTRY_1(name) \ + .section ".text"; \ + .type BODY_LABEL(name),@function; \ + .globl name; \ + .section ".opd","aw"; \ + .align 3; \ +name##: OPD_ENT (name); \ + .previous; + +#ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define DOT_LABEL(X) .##X +# define BODY_LABEL(X) .##X +# define ENTRY_2(name) \ + .globl BODY_LABEL(name); \ + ENTRY_1(name) \ + .size name, 24; +# define END_2(name) \ + .size BODY_LABEL(name),.-BODY_LABEL(name); +#else +# define DOT_LABEL(X) X +# define BODY_LABEL(X) .LY##X +# define ENTRY_2(name) \ + .type name,@function; \ + ENTRY_1(name) +# define END_2(name) \ + .size name,.-BODY_LABEL(name); \ + .size BODY_LABEL(name),.-BODY_LABEL(name); +#endif + +#define ENTRY(name) \ + ENTRY_2(name) \ + .align ALIGNARG(2); \ +BODY_LABEL(name): \ + cfi_startproc; + +#define EALIGN_W_0 /* No words to insert. */ +#define EALIGN_W_1 nop +#define EALIGN_W_2 nop;nop +#define EALIGN_W_3 nop;nop;nop +#define EALIGN_W_4 EALIGN_W_3;nop +#define EALIGN_W_5 EALIGN_W_4;nop +#define EALIGN_W_6 EALIGN_W_5;nop +#define EALIGN_W_7 EALIGN_W_6;nop + +/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes + past a 2^alignt boundary. */ +#define EALIGN(name, alignt, words) \ + ENTRY_2(name) \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ +BODY_LABEL(name): \ + cfi_startproc; + +/* Local labels stripped out by the linker. */ +#undef L +#define L(x) .L##x + +#define tostring(s) #s +#define stringify(s) tostring(s) +#define XGLUE(a,b) a##b +#define GLUE(a,b) XGLUE(a,b) +#define LT_LABEL(name) GLUE(.LT,name) +#define LT_LABELSUFFIX(name,suffix) GLUE(GLUE(.LT,name),suffix) + +/* Support Traceback tables */ +#define TB_ASM 0x000c000000000000 +#define TB_GLOBALLINK 0x0000800000000000 +#define TB_IS_EPROL 0x0000400000000000 +#define TB_HAS_TBOFF 0x0000200000000000 +#define TB_INT_PROC 0x0000100000000000 +#define TB_HAS_CTL 0x0000080000000000 +#define TB_TOCLESS 0x0000040000000000 +#define TB_FP_PRESENT 0x0000020000000000 +#define TB_LOG_ABORT 0x0000010000000000 +#define TB_INT_HANDL 0x0000008000000000 +#define TB_NAME_PRESENT 0x0000004000000000 +#define TB_USES_ALLOCA 0x0000002000000000 +#define TB_SAVES_CR 0x0000000200000000 +#define TB_SAVES_LR 0x0000000100000000 +#define TB_STORES_BC 0x0000000080000000 +#define TB_FIXUP 0x0000000040000000 +#define TB_FP_SAVED(fprs) (((fprs) & 0x3f) << 24) +#define TB_GPR_SAVED(gprs) (((fprs) & 0x3f) << 16) +#define TB_FIXEDPARMS(parms) (((parms) & 0xff) << 8) +#define TB_FLOATPARMS(parms) (((parms) & 0x7f) << 1) +#define TB_PARMSONSTK 0x0000000000000001 + +#define PPC_HIGHER(v) (((v) >> 32) & 0xffff) +#define TB_DEFAULT TB_ASM | TB_HAS_TBOFF | TB_NAME_PRESENT + +#define TRACEBACK(name) \ +LT_LABEL(name): ; \ + .long 0 ; \ + .quad TB_DEFAULT ; \ + .long LT_LABEL(name)-BODY_LABEL(name) ; \ + .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \ +LT_LABELSUFFIX(name,_name_start): ;\ + .ascii stringify(name) ; \ +LT_LABELSUFFIX(name,_name_end): ; \ + .align 2 ; + +#define TRACEBACK_MASK(name,mask) \ +LT_LABEL(name): ; \ + .long 0 ; \ + .quad TB_DEFAULT | mask ; \ + .long LT_LABEL(name)-BODY_LABEL(name) ; \ + .short LT_LABELSUFFIX(name,_name_end)-LT_LABELSUFFIX(name,_name_start) ; \ +LT_LABELSUFFIX(name,_name_start): ;\ + .ascii stringify(name) ; \ +LT_LABELSUFFIX(name,_name_end): ; \ + .align 2 ; + +/* END generates Traceback tables */ +#undef END +#define END(name) \ + cfi_endproc; \ + TRACEBACK(name) \ + END_2(name) + +/* This form supports more informative traceback tables */ +#define END_GEN_TB(name,mask) \ + cfi_endproc; \ + TRACEBACK_MASK(name,mask) \ + END_2(name) + +#define DO_CALL(syscall) \ + li 0,syscall; \ + sc + +/* ppc64 is always PIC */ +#undef JUMPTARGET +#define JUMPTARGET(name) DOT_LABEL(name) + +#define PSEUDO(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET \ + bnslr+; \ + b JUMPTARGET(__syscall_error) + +#define ret PSEUDO_RET + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + END (name) + +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET_NOERRNO \ + blr + +#define ret_NOERRNO PSEUDO_RET_NOERRNO + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(name) \ + END (name) + +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .section ".text"; \ + ENTRY (name) \ + DO_CALL (SYS_ify (syscall_name)); + +#define PSEUDO_RET_ERRVAL \ + blr + +#define ret_ERRVAL PSEUDO_RET_ERRVAL + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + END (name) + +#else /* !__ASSEMBLER__ */ + +#ifdef USE_PPC64_OVERLAPPING_OPD +# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase;" +#else +# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase, 0;" +#endif + +#ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define DOT_PREFIX "." +# define BODY_PREFIX "." +# define ENTRY_2(name) \ + ".globl " BODY_PREFIX #name ";\n" \ + ".size " #name ", 24;" +# define END_2(name) \ + ".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";" +#else +# define DOT_PREFIX "" +# define BODY_PREFIX ".LY" +# define ENTRY_2(name) ".type " #name ",@function;" +# define END_2(name) \ + ".size " #name ",.-" BODY_PREFIX #name ";\n" \ + ".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";" +#endif + +#endif /* __ASSEMBLER__ */ + +#endif /* __ELF__ */ diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c index 83628512a..7f988d301 100644 --- a/libc/sysdeps/linux/powerpc/pread_write.c +++ b/libc/sysdeps/linux/powerpc/pread_write.c @@ -146,6 +146,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf, #endif /* ! defined __NR_pread || ! defined __NR_pwrite */ #ifndef __NR_pread +ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset); ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__fake_pread_write(fd, buf, count, offset, 0)); @@ -153,6 +154,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) weak_alias(__libc_pread,pread) # ifdef __UCLIBC_HAS_LFS__ +ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset); ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, buf, count, offset, 0)); @@ -163,6 +165,7 @@ weak_alias(__libc_pread64,pread64) #ifndef __NR_pwrite +ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset); ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__fake_pread_write(fd, (void*)buf, count, offset, 1)); @@ -170,6 +173,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) weak_alias(__libc_pwrite,pwrite) # ifdef __UCLIBC_HAS_LFS__ +ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset); ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, (void*)buf, count, offset, 1)); diff --git a/libc/sysdeps/linux/powerpc/sysdep.h b/libc/sysdeps/linux/powerpc/sysdep.h new file mode 100644 index 000000000..14b86ac49 --- /dev/null +++ b/libc/sysdeps/linux/powerpc/sysdep.h @@ -0,0 +1,196 @@ +/* Copyright (C) 1999, 2001, 2002, 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. */ + +#include <common/sysdep.h> + +/* + * Powerpc Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP). + * This entry is copied to _dl_hwcap or rtld_global._dl_hwcap during startup. + * The following must match the kernels linux/asm/cputable.h. + */ +#define PPC_FEATURE_32 0x80000000 /* 32-bit mode. */ +#define PPC_FEATURE_64 0x40000000 /* 64-bit mode. */ +#define PPC_FEATURE_601_INSTR 0x20000000 /* 601 chip, Old POWER ISA. */ +#define PPC_FEATURE_HAS_ALTIVEC 0x10000000 /* SIMD/Vector Unit. */ +#define PPC_FEATURE_HAS_FPU 0x08000000 /* Floating Point Unit. */ +#define PPC_FEATURE_HAS_MMU 0x04000000 /* Memory Management Unit. */ +#define PPC_FEATURE_HAS_4xxMAC 0x02000000 /* 4xx Multiply Accumulator. */ +#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 /* Unified I/D cache. */ +#define PPC_FEATURE_HAS_SPE 0x00800000 /* Signal Processing ext. */ +#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 /* SPE Float. */ +#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 /* SPE Double. */ +#define PPC_FEATURE_NO_TB 0x00100000 /* 601/403gx have no timebase */ +#define PPC_FEATURE_POWER4 0x00080000 /* POWER4 ISA 2.00 */ +#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.02 */ +#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.03 */ +#define PPC_FEATURE_CELL_BE 0x00010000 /* CELL Broadband Engine */ +#define PPC_FEATURE_BOOKE 0x00008000 +#define PPC_FEATURE_SMT 0x00004000 /* Simultaneous Multi-Threading */ +#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 +#define PPC_FEATURE_ARCH_2_05 0x00001000 /* ISA 2.05 */ +#define PPC_FEATURE_PA6T 0x00000800 /* PA Semi 6T Core */ +#define PPC_FEATURE_HAS_DFP 0x00000400 /* Decimal FP Unit */ +#define PPC_FEATURE_POWER6_EXT 0x00000200 /* P6 + mffgpr/mftgpr */ +#define PPC_FEATURE_ARCH_2_06 0x00000100 /* ISA 2.06 */ +#define PPC_FEATURE_HAS_VSX 0x00000080 /* P7 Vector Extension. */ +#define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC) + +#ifdef __ASSEMBLER__ + +/* Symbolic names for the registers. The only portable way to write asm + code is to use number but this produces really unreadable code. + Therefore these symbolic names. */ + +/* Integer registers. */ +#define r0 0 +#define r1 1 +#define r2 2 +#define r3 3 +#define r4 4 +#define r5 5 +#define r6 6 +#define r7 7 +#define r8 8 +#define r9 9 +#define r10 10 +#define r11 11 +#define r12 12 +#define r13 13 +#define r14 14 +#define r15 15 +#define r16 16 +#define r17 17 +#define r18 18 +#define r19 19 +#define r20 20 +#define r21 21 +#define r22 22 +#define r23 23 +#define r24 24 +#define r25 25 +#define r26 26 +#define r27 27 +#define r28 28 +#define r29 29 +#define r30 30 +#define r31 31 + +/* Floating-point registers. */ +#define fp0 0 +#define fp1 1 +#define fp2 2 +#define fp3 3 +#define fp4 4 +#define fp5 5 +#define fp6 6 +#define fp7 7 +#define fp8 8 +#define fp9 9 +#define fp10 10 +#define fp11 11 +#define fp12 12 +#define fp13 13 +#define fp14 14 +#define fp15 15 +#define fp16 16 +#define fp17 17 +#define fp18 18 +#define fp19 19 +#define fp20 20 +#define fp21 21 +#define fp22 22 +#define fp23 23 +#define fp24 24 +#define fp25 25 +#define fp26 26 +#define fp27 27 +#define fp28 28 +#define fp29 29 +#define fp30 30 +#define fp31 31 + +/* Condition code registers. */ +#define cr0 0 +#define cr1 1 +#define cr2 2 +#define cr3 3 +#define cr4 4 +#define cr5 5 +#define cr6 6 +#define cr7 7 + +/* Vector registers. */ +#define v0 0 +#define v1 1 +#define v2 2 +#define v3 3 +#define v4 4 +#define v5 5 +#define v6 6 +#define v7 7 +#define v8 8 +#define v9 9 +#define v10 10 +#define v11 11 +#define v12 12 +#define v13 13 +#define v14 14 +#define v15 15 +#define v16 16 +#define v17 17 +#define v18 18 +#define v19 19 +#define v20 20 +#define v21 21 +#define v22 22 +#define v23 23 +#define v24 24 +#define v25 25 +#define v26 26 +#define v27 27 +#define v28 28 +#define v29 29 +#define v30 30 +#define v31 31 + +#define VRSAVE 256 + + +#ifdef __ELF__ + +/* This seems to always be the case on PPC. */ +#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 + +/* In ELF C symbols are asm symbols. */ +#undef NO_UNDERSCORES +#define NO_UNDERSCORES + +#endif /* __ELF__ */ + +# include <sys/syscall.h> +# if defined(__powerpc64__) +# include "powerpc64/sysdep.h" +# else +# include "powerpc32/sysdep.h" +# endif + +#endif /* __ASSEMBLER__ */ + diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 600c980a8..008374260 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * |