chiark / gitweb /
[PATCH] klibc: version 0.211
[elogind.git] / klibc / klibc / arch / i386 / sysstub.ph
1 # -*- perl -*-
2 #
3 # arch/i386/sysstub.ph
4 #
5 # Script to generate system call stubs
6 #
7
8 sub make_sysstub($$$$@) {
9     my($fname, $type, $sname, $stype, @args) = @_;
10
11     open(OUT, '>', "syscalls/${fname}.S");
12     print OUT "#include <asm/unistd.h>\n";
13     print OUT "\n";
14     print OUT "\t.type ${fname},\@function\n";
15     print OUT "\t.globl ${fname}\n";
16     print OUT "${fname}:\n";
17
18     if ( $stype eq 'varadic' ) {
19         print OUT "#ifdef _REGPARM\n";
20         print OUT "\tmovl  4(%esp),%eax\n";
21         print OUT "\tmovl  8(%esp),%edx\n";
22         print OUT "\tmovl 12(%esp),%ecx\n";
23         print OUT "#endif\n";
24     }
25
26     print OUT "\tpushl \$__NR_${sname}\n";
27     print OUT "\tjmp __syscall_common\n";
28     print OUT "\t.size ${fname},.-${fname}\n";
29     close(OUT);
30 }
31
32 1;