diff options
author | H. Peter Anvin <hpa@zytor.com> | 2004-06-07 03:05:52 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2004-06-07 03:05:52 +0000 |
commit | 9ab92250fc99fa9a2d7522c710818160ec1d7fdf (patch) | |
tree | 26787665e32c4018e2b2f1961e80d2d710f53ac1 | |
parent | f651d9292521bd8a8de7ff0fa26d03ffb00d001f (diff) | |
download | klibc-9ab92250fc99fa9a2d7522c710818160ec1d7fdf.tar.gz |
ppc/ppc64 support from Paul Mackerrasklibc-0.119
-rw-r--r-- | klibc/arch/ppc/Makefile.inc | 1 | ||||
-rw-r--r-- | klibc/arch/ppc/syscall.S | 16 | ||||
-rw-r--r-- | klibc/arch/ppc/sysstub.ph | 25 | ||||
-rw-r--r-- | klibc/arch/ppc64/Makefile.inc | 3 | ||||
-rw-r--r-- | klibc/arch/ppc64/syscall.c | 14 | ||||
-rw-r--r-- | klibc/arch/ppc64/sysstub.ph | 32 |
6 files changed, 90 insertions, 1 deletions
diff --git a/klibc/arch/ppc/Makefile.inc b/klibc/arch/ppc/Makefile.inc index 3bd2c0643c89a..c6bb975f0f760 100644 --- a/klibc/arch/ppc/Makefile.inc +++ b/klibc/arch/ppc/Makefile.inc @@ -9,6 +9,7 @@ ARCHOBJS = \ arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ libgcc/__divdi3.o \ libgcc/__moddi3.o \ libgcc/__udivdi3.o \ diff --git a/klibc/arch/ppc/syscall.S b/klibc/arch/ppc/syscall.S new file mode 100644 index 0000000000000..0a7c37c9035ac --- /dev/null +++ b/klibc/arch/ppc/syscall.S @@ -0,0 +1,16 @@ +/* + * arch/ppc/syscall.S + * + * Common error-handling path for system calls. + */ + + .text + .align 2 + .globl __syscall_error + .type __syscall_error,@function +__syscall_error: + lis 9,errno@ha + stw 3,errno@l(9) + li 3,-1 + blr + .size __syscall_error,.-__syscall_error diff --git a/klibc/arch/ppc/sysstub.ph b/klibc/arch/ppc/sysstub.ph new file mode 100644 index 0000000000000..542ab5575c963 --- /dev/null +++ b/klibc/arch/ppc/sysstub.ph @@ -0,0 +1,25 @@ +# -*- perl -*- +# +# arch/ppc/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include <asm/unistd.h>\n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tli 0,__NR_${sname}\n"; + print OUT "\tsc\n"; + print OUT "\tbnslr\n"; + print OUT "\tb __syscall_error\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/arch/ppc64/Makefile.inc b/klibc/arch/ppc64/Makefile.inc index 3ab3a8c8e64fb..c2d1d2fbfcc01 100644 --- a/klibc/arch/ppc64/Makefile.inc +++ b/klibc/arch/ppc64/Makefile.inc @@ -8,7 +8,8 @@ # ARCHOBJS = \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/arch/ppc64/syscall.c b/klibc/arch/ppc64/syscall.c new file mode 100644 index 0000000000000..a5895fe88e834 --- /dev/null +++ b/klibc/arch/ppc64/syscall.c @@ -0,0 +1,14 @@ +/* + * arch/ppc64/syscall.c + * + * Common error-handling path for system calls. + * The return value from __syscall_error becomes the + * return value from the system call. + */ +#include <errno.h> + +long int __syscall_error(long int err) +{ + errno = err; + return -1; +} diff --git a/klibc/arch/ppc64/sysstub.ph b/klibc/arch/ppc64/sysstub.ph new file mode 100644 index 0000000000000..6292f057d249b --- /dev/null +++ b/klibc/arch/ppc64/sysstub.ph @@ -0,0 +1,32 @@ +# -*- perl -*- +# +# arch/ppc64/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include <asm/unistd.h>\n"; + print OUT "\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "\t.section \".opd\",\"aw\"\n"; + print OUT "\t.align 3\n"; + print OUT "${fname}:\n"; + print OUT "\t.quad .${fname},.TOC.\@tocbase,0\n"; + print OUT "\t.size ${fname},24\n"; + print OUT "\t.text\n"; + print OUT "\t.type .${fname},\@function\n"; + print OUT "\t.globl .${fname}\n"; + print OUT ".${fname}:\n"; + print OUT "\tli 0,__NR_${sname}\n"; + print OUT "\tsc\n"; + print OUT "\tbnslr\n"; + print OUT "\tb __syscall_error\n"; + print OUT "\t.size .${fname},.-.${fname}\n"; + close(OUT); +} + +1; |