chiark / gitweb /
08b97e807e7f9eef2e529543ef627671f13c0965
[elogind.git] / klibc / klibc / arch / alpha / sysstub.ph
1 # -*- perl -*-
2 #
3 # arch/alpha/sysstub.ph
4 #
5 # Script to generate system call stubs
6 #
7
8 # On Alpha, most system calls follow the standard convention, with the
9 # system call number in r0 (v0), return an error value in r19 (a3) as
10 # well as the return value in r0 (v0).
11 #
12 # A few system calls are dual-return with the second return value in
13 # r20 (a4).
14
15 sub make_sysstub($$$$$@) {
16     my($outputdir, $fname, $type, $sname, $stype, @args) = @_;
17
18     $stype = $stype || 'common';
19     $stype = 'common' if ( $stype eq 'dual0' );
20
21     open(OUT, '>', "${outputdir}/${fname}.S");
22     print OUT "#include <asm/unistd.h>\n";
23     print OUT "#include <machine/asm.h>\n";
24     print OUT "\n";
25     print OUT "\t.text\n";
26     print OUT "\t.type ${fname},\@function\n";
27     print OUT "\t.ent\t${fname}, 0\n"; # What is this?
28     print OUT "\t.globl ${fname}\n";
29     print OUT "${fname}:\n";
30     print OUT "\tlda\tv0, __NR_${sname}(zero)\n";
31     print OUT "\tbr __syscall_${stype}\n";
32     print OUT "\t.size\t${fname},.-${fname}\n";
33     print OUT "\t.end\t${fname}\n";
34     close(OUT);
35 }
36
37 1;