xref: /third_party/musl/src/process/riscv64/vfork.s (revision 570af302)
1570af302Sopenharmony_ci.global vfork
2570af302Sopenharmony_ci.type vfork,@function
3570af302Sopenharmony_civfork:
4570af302Sopenharmony_ci	/* riscv does not have SYS_vfork, so we must use clone instead */
5570af302Sopenharmony_ci	/* note: riscv's clone = clone(flags, sp, ptidptr, tls, ctidptr) */
6570af302Sopenharmony_ci	li a7, 220
7570af302Sopenharmony_ci	li a0, 0x100 | 0x4000 | 17 /* flags = CLONE_VM | CLONE_VFORK | SIGCHLD */
8570af302Sopenharmony_ci	mv a1, sp
9570af302Sopenharmony_ci	/* the other arguments are ignoreable */
10570af302Sopenharmony_ci	ecall
11570af302Sopenharmony_ci	.hidden __syscall_ret
12570af302Sopenharmony_ci	j __syscall_ret
13