summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/sparc/sysfork.S
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/sparc/sysfork.S')
-rw-r--r--usr/klibc/arch/sparc/sysfork.S27
1 files changed, 27 insertions, 0 deletions
diff --git a/usr/klibc/arch/sparc/sysfork.S b/usr/klibc/arch/sparc/sysfork.S
new file mode 100644
index 0000000..3787b94
--- /dev/null
+++ b/usr/klibc/arch/sparc/sysfork.S
@@ -0,0 +1,27 @@
+/*
+ * arch/sparc/sysfork.S
+ *
+ * The fork and vfork system calls are special on sparc[64]:
+ * they return the "other process" pid in %o0 and the
+ * "is child" flag in %o1
+ *
+ * Common system-call stub; %g1 already set to syscall number
+ */
+
+#include <machine/asm.h>
+
+ .globl __syscall_forkish
+ .type __syscall_forkish,#function
+ .align 4
+__syscall_forkish:
+ t 0x10
+ sub %o1, 1, %o1
+ bcc,a 1f
+ and %o0, %o1, %o0
+ PIC_PROLOGUE(%g1,%g4)
+ SET(errno,%g1,%g4)
+ st %o0,[%g4]
+ mov -1, %o0
+1:
+ retl
+ nop