summaryrefslogtreecommitdiff
path: root/klibc/klibc/arch/x86_64/sysstub.ph
blob: 07af1227ca47ad0ed1afcafc19c75d09cadfe965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- perl -*-
#
# arch/x86_64/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 "\tmovl \$__NR_${sname},%eax\n"; # Zero-extends to 64 bits
    print OUT "\tjmp __syscall_common\n";
    print OUT "\t.size ${fname},.-${fname}\n";
    close(OUT);
}

1;