store pthread stack guard sizes for pthread_getattr_np
[musl] / src / thread / aarch64 / clone.s
1 // __clone(func, stack, flags, arg, ptid, tls, ctid)
2 //         x0,   x1,    w2,    x3,  x4,   x5,  x6
3
4 // syscall(SYS_clone, flags, stack, ptid, tls, ctid)
5 //         x8,        x0,    x1,    x2,   x3,  x4
6
7 .global __clone
8 .type   __clone,%function
9 __clone:
10         // align stack and save func,arg
11         and x1,x1,#-16
12         stp x0,x3,[x1,#-16]!
13
14         // syscall
15         uxtw x0,w2
16         mov x2,x4
17         mov x3,x5
18         mov x4,x6
19         mov x8,#220 // SYS_clone
20         svc #0
21
22         cbz x0,1f
23         // parent
24         ret
25         // child
26 1:      ldp x1,x0,[sp],#16
27         blr x1
28         mov x8,#93 // SYS_exit
29         svc #0