summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/mips64/sysstub.ph
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/mips64/sysstub.ph')
-rw-r--r--usr/klibc/arch/mips64/sysstub.ph27
1 files changed, 27 insertions, 0 deletions
diff --git a/usr/klibc/arch/mips64/sysstub.ph b/usr/klibc/arch/mips64/sysstub.ph
new file mode 100644
index 0000000..57af657
--- /dev/null
+++ b/usr/klibc/arch/mips64/sysstub.ph
@@ -0,0 +1,27 @@
+# -*- perl -*-
+#
+# arch/mips64/sysstub.ph
+#
+# Script to generate system call stubs
+#
+
+# On MIPS, most system calls follow the standard convention, with the
+# system call number in r0 (v0), return an error value in r19 (a3) as
+# well as the return value in r0 (v0).
+
+sub make_sysstub($$$$$@) {
+ my($outputdir, $fname, $type, $sname, $stype, @args) = @_;
+
+ $stype = $stype || 'common';
+ open(OUT, '>', "${outputdir}/${fname}.S");
+ print OUT "#include <machine/asm.h>\n";
+ print OUT "#include <asm/unistd.h>\n";
+ print OUT "\n";
+ print OUT "LEAF(${fname})\n";
+ print OUT "\t li\tv0, __NR_${sname}\n";
+ print OUT "\tj\t__syscall_${stype}\n";
+ print OUT "\tEND(${fname})\n";
+ close(OUT);
+}
+
+1;