diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-06-15 01:08:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-06-15 01:08:45 +0000 |
commit | a8d9ee1f663268a01583923a792d5ede5cd4a0f8 (patch) | |
tree | 5147aae4184ca0870065fe5bd9f976dc5fbe138d | |
parent | 5f9e364ca5cd244b4ccd63dd2954108bba1f7853 (diff) |
Implement syscall() for powerpc. Fixup syscall code so
it compiles properly with gcc 3.3.
-Erik
-rw-r--r-- | ldso/ldso/powerpc/dl-syscalls.h | 17 | ||||
-rw-r--r-- | ldso/ldso/powerpc/ld_syscalls.h | 17 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/Makefile | 3 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/_mmap.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/syscalls.h | 25 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/syscall.S | 45 |
6 files changed, 79 insertions, 30 deletions
diff --git a/ldso/ldso/powerpc/dl-syscalls.h b/ldso/ldso/powerpc/dl-syscalls.h index 1539d64ab..3e561d661 100644 --- a/ldso/ldso/powerpc/dl-syscalls.h +++ b/ldso/ldso/powerpc/dl-syscalls.h @@ -32,7 +32,8 @@ #undef __syscall_clobbers #define __syscall_clobbers \ - "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + "r9", "r10", "r11", "r12" + //"r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" #undef _syscall0 #define _syscall0(type,name) \ @@ -49,7 +50,7 @@ type name(void) \ "mfcr %1 " \ : "=&r" (__sc_3), "=&r" (__sc_0) \ : "0" (__sc_3), "1" (__sc_0) \ - : __syscall_clobbers); \ + : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -72,7 +73,7 @@ type name(type1 arg1) \ "mfcr %1 " \ : "=&r" (__sc_3), "=&r" (__sc_0) \ : "0" (__sc_3), "1" (__sc_0) \ - : __syscall_clobbers); \ + : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -98,7 +99,7 @@ type name(type1 arg1, type2 arg2) \ : "=&r" (__sc_3), "=&r" (__sc_0) \ : "0" (__sc_3), "1" (__sc_0), \ "r" (__sc_4) \ - : __syscall_clobbers); \ + : "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -127,7 +128,7 @@ type name(type1 arg1, type2 arg2, type3 arg3) \ : "0" (__sc_3), "1" (__sc_0), \ "r" (__sc_4), \ "r" (__sc_5) \ - : __syscall_clobbers); \ + : "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -159,7 +160,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ "r" (__sc_4), \ "r" (__sc_5), \ "r" (__sc_6) \ - : __syscall_clobbers); \ + : "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -194,7 +195,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ "r" (__sc_5), \ "r" (__sc_6), \ "r" (__sc_7) \ - : __syscall_clobbers); \ + : "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -233,7 +234,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 "r" (__sc_6), \ "r" (__sc_7), \ "r" (__sc_8) \ - : __syscall_clobbers); \ + : "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ diff --git a/ldso/ldso/powerpc/ld_syscalls.h b/ldso/ldso/powerpc/ld_syscalls.h index 1539d64ab..3e561d661 100644 --- a/ldso/ldso/powerpc/ld_syscalls.h +++ b/ldso/ldso/powerpc/ld_syscalls.h @@ -32,7 +32,8 @@ #undef __syscall_clobbers #define __syscall_clobbers \ - "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + "r9", "r10", "r11", "r12" + //"r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" #undef _syscall0 #define _syscall0(type,name) \ @@ -49,7 +50,7 @@ type name(void) \ "mfcr %1 " \ : "=&r" (__sc_3), "=&r" (__sc_0) \ : "0" (__sc_3), "1" (__sc_0) \ - : __syscall_clobbers); \ + : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -72,7 +73,7 @@ type name(type1 arg1) \ "mfcr %1 " \ : "=&r" (__sc_3), "=&r" (__sc_0) \ : "0" (__sc_3), "1" (__sc_0) \ - : __syscall_clobbers); \ + : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -98,7 +99,7 @@ type name(type1 arg1, type2 arg2) \ : "=&r" (__sc_3), "=&r" (__sc_0) \ : "0" (__sc_3), "1" (__sc_0), \ "r" (__sc_4) \ - : __syscall_clobbers); \ + : "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -127,7 +128,7 @@ type name(type1 arg1, type2 arg2, type3 arg3) \ : "0" (__sc_3), "1" (__sc_0), \ "r" (__sc_4), \ "r" (__sc_5) \ - : __syscall_clobbers); \ + : "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -159,7 +160,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ "r" (__sc_4), \ "r" (__sc_5), \ "r" (__sc_6) \ - : __syscall_clobbers); \ + : "r7", "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -194,7 +195,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ "r" (__sc_5), \ "r" (__sc_6), \ "r" (__sc_7) \ - : __syscall_clobbers); \ + : "r8", "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ @@ -233,7 +234,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 "r" (__sc_6), \ "r" (__sc_7), \ "r" (__sc_8) \ - : __syscall_clobbers); \ + : "r9", "r10", "r11", "r12" ); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ diff --git a/libc/sysdeps/linux/powerpc/Makefile b/libc/sysdeps/linux/powerpc/Makefile index 8e979a1e8..e19da0fba 100644 --- a/libc/sysdeps/linux/powerpc/Makefile +++ b/libc/sysdeps/linux/powerpc/Makefile @@ -24,7 +24,8 @@ CRT0_SRC = crt0.S CRT0_OBJ = crt0.o crt1.o gcrt1.o CRT0_DEPS=gmon-start.S -SSRC=__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S clone.S __uClibc_syscall.S +SSRC=__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \ + clone.S __uClibc_syscall.S syscall.S ifeq ($(strip $(UCLIBC_PROFILING)),y) SSRC+=mcount.S endif diff --git a/libc/sysdeps/linux/powerpc/_mmap.c b/libc/sysdeps/linux/powerpc/_mmap.c index 350f4c49e..ec4bfd1f9 100644 --- a/libc/sysdeps/linux/powerpc/_mmap.c +++ b/libc/sysdeps/linux/powerpc/_mmap.c @@ -5,7 +5,7 @@ #include <sys/syscall.h> #define __syscall_clobbers \ - "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + "r9", "r10", "r11", "r12" #define __syscall_return(type) \ return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ (type) __sc_ret diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h index ec9e8507f..ac7395097 100644 --- a/libc/sysdeps/linux/powerpc/bits/syscalls.h +++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h @@ -11,30 +11,31 @@ #include <bits/sysnum.h> -#define STRINGIFY(s) STRINGIFY2 (s) -#define STRINGIFY2(s) #s +#define __STRINGIFY(s) __STRINGIFY2 (s) +#define __STRINGIFY2(s) #s +#undef JUMPTARGET #ifdef __PIC__ -#define JUMPTARGET(name) STRINGIFY(name##@plt) +#define __MAKE_SYSCALL __STRINGIFY(__uClibc_syscall@plt) #else -#define JUMPTARGET(name) STRINGIFY(name) +#define __MAKE_SYSCALL __STRINGIFY(__uClibc_syscall) #endif #define unified_syscall_body(name) \ __asm__ ( \ ".section \".text\"\n\t" \ ".align 2\n\t" \ - ".globl " STRINGIFY(name) "\n\t" \ - ".type " STRINGIFY(name) ",@function\n" \ - #name":\n\tli 0," STRINGIFY(__NR_##name) "\n\t" \ - "b " JUMPTARGET(__uClibc_syscall) "\n" \ - ".Lfe1" STRINGIFY(name) ":\n\t" \ - ".size\t" STRINGIFY(name) ",.Lfe1" STRINGIFY(name) "-" STRINGIFY(name) "\n" \ + ".globl " __STRINGIFY(name) "\n\t" \ + ".type " __STRINGIFY(name) ",@function\n\t" \ + #name":\n\tli 0," __STRINGIFY(__NR_##name) "\n\t" \ + "b " __MAKE_SYSCALL "\n\t" \ + ".Lfe1" __STRINGIFY(name) ":\n\t" \ + ".size\t" __STRINGIFY(name) ",.Lfe1" __STRINGIFY(name) "-" __STRINGIFY(name) "\n" \ ) #undef _syscall0 -#define _syscall0(type,name) \ -type name(void); \ +#define _syscall0(type,name) \ +type name(void); \ unified_syscall_body(name) #undef _syscall1 diff --git a/libc/sysdeps/linux/powerpc/syscall.S b/libc/sysdeps/linux/powerpc/syscall.S new file mode 100644 index 000000000..71f711931 --- /dev/null +++ b/libc/sysdeps/linux/powerpc/syscall.S @@ -0,0 +1,45 @@ +/* Copyright (C) 1991, 1992, 1997, 1999 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 <features.h> + + .section ".text" + .globl syscall; + .type syscall,@function; + .align 2; + +.globl syscall; +.type syscall,@function; +.align 2; + +syscall: + mr 0,3 + mr 3,4 + mr 4,5 + mr 5,6 + mr 6,7 + mr 7,8 + sc + bnslr; +#ifdef __PIC__ + b __syscall_error@plt +#else + b __syscall_error +#endif + +.size syscall,.-syscall |