summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/sparc64/fork.S
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2017-05-24 20:49:02 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2017-06-23 23:46:04 +0200
commit041cdc2769407c4d3869b218ad7ee7638e1c306e (patch)
tree1ea25250d74dcb230cf5feee99226fc080dbd678 /libc/sysdeps/linux/sparc64/fork.S
parent58a5ba12bffad5916d9897c2870fc483f1db8282 (diff)
sparc64: add basic support
No NPTL, no LDSO support. Bootup with Busybox Ash in Qemu working. Testuite shows only two failures, but mksh continue/break support doesn't work.
Diffstat (limited to 'libc/sysdeps/linux/sparc64/fork.S')
-rw-r--r--libc/sysdeps/linux/sparc64/fork.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/sparc64/fork.S b/libc/sysdeps/linux/sparc64/fork.S
new file mode 100644
index 000000000..55c5e8d5c
--- /dev/null
+++ b/libc/sysdeps/linux/sparc64/fork.S
@@ -0,0 +1,32 @@
+/*
+ * The fork and vfork system calls are special on sparc64:
+ * they return the "other process" pid in %o0 and the
+ * "is child" flag in %o1
+ */
+
+#include <features.h>
+#include <sys/syscall.h>
+
+.text
+.global fork
+.type fork, @function
+.align 4
+
+fork:
+ mov __NR_fork, %g1
+ ta 0x6d
+ sub %o1, 1, %o1
+ bcc,pt %xcc, 1f
+ and %o0, %o1, %o0
+ sethi %hi(errno), %g4
+ or %g4, %lo(errno), %g4
+ st %o0, [%g4]
+ retl
+ mov -1, %o0
+1:
+ retl
+ nop
+
+.size fork, . - fork
+
+libc_hidden_def(fork)