diff options
Diffstat (limited to 'klibc/klibc/arch/ppc64/sysstub.ph')
-rw-r--r-- | klibc/klibc/arch/ppc64/sysstub.ph | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/klibc/klibc/arch/ppc64/sysstub.ph b/klibc/klibc/arch/ppc64/sysstub.ph new file mode 100644 index 0000000000..1469cc6071 --- /dev/null +++ b/klibc/klibc/arch/ppc64/sysstub.ph @@ -0,0 +1,34 @@ +# -*- 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 "\tmfcr 0\n"; + print OUT "\trldicl. 9,0,36,63\n"; + print OUT "\tbeqlr- 0\n"; + print OUT "\tb .__syscall_error\n"; + print OUT "\t.size .${fname},.-.${fname}\n"; + close(OUT); +} + +1; |