summaryrefslogtreecommitdiff
path: root/src/thread/aarch64/clone.s
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2015-03-10 21:18:41 +0000
committerRich Felker <dalias@aerifal.cx>2015-03-11 20:12:35 -0400
commit01ef3dd9c5fa7a56aa370f244dd08e05c73010f5 (patch)
tree8fe90d994a43124ff309d3af4c185e28b2b1d6ff /src/thread/aarch64/clone.s
parentf4e4632abfa8297db1485e132bb15b9ef6c32a1b (diff)
downloadmusl-01ef3dd9c5fa7a56aa370f244dd08e05c73010f5.tar.gz
add aarch64 port
This adds complete aarch64 target support including bigendian subarch. Some of the long double math functions are known to be broken otherwise interfaces should be fully functional, but at this point consider this port experimental. Initial work on this port was done by Sireesh Tripurari and Kevin Bortis.
Diffstat (limited to 'src/thread/aarch64/clone.s')
-rw-r--r--src/thread/aarch64/clone.s29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/thread/aarch64/clone.s b/src/thread/aarch64/clone.s
new file mode 100644
index 00000000..50af913c
--- /dev/null
+++ b/src/thread/aarch64/clone.s
@@ -0,0 +1,29 @@
+// __clone(func, stack, flags, arg, ptid, tls, ctid)
+// x0, x1, w2, x3, x4, x5, x6
+
+// syscall(SYS_clone, flags, stack, ptid, tls, ctid)
+// x8, x0, x1, x2, x3, x4
+
+.global __clone
+.type __clone,%function
+__clone:
+ // align stack and save func,arg
+ and x1,x1,#-16
+ stp x0,x3,[x1,#-16]!
+
+ // syscall
+ uxtw x0,w2
+ mov x2,x4
+ mov x3,x5
+ mov x4,x6
+ mov x8,#220 // SYS_clone
+ svc #0
+
+ cbz x0,1f
+ // parent
+ ret
+ // child
+1: ldp x1,x0,[sp],#16
+ blr x1
+ mov x8,#93 // SYS_exit
+ svc #0