sys/stat.h: fix typo in statx member name stx_dio_offset_align
[musl.git] / src / thread / riscv32 / clone.s
blob3102239d0d4ab95ad95b867613e08be015172cf4
1 # __clone(func, stack, flags, arg, ptid, tls, ctid)
2 # a0, a1, a2, a3, a4, a5, a6
4 # syscall(SYS_clone, flags, stack, ptid, tls, ctid)
5 # a7 a0, a1, a2, a3, a4
7 .global __clone
8 .type __clone, %function
9 __clone:
10 # Save func and arg to stack
11 addi a1, a1, -16
12 sw a0, 0(a1)
13 sw a3, 4(a1)
15 # Call SYS_clone
16 mv a0, a2
17 mv a2, a4
18 mv a3, a5
19 mv a4, a6
20 li a7, 220 # SYS_clone
21 ecall
23 beqz a0, 1f
24 # Parent
25 ret
27 # Child
28 1: lw a1, 0(sp)
29 lw a0, 4(sp)
30 jalr a1
32 # Exit
33 li a7, 93 # SYS_exit
34 ecall