• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.global vfork
2.type vfork,@function
3vfork:
4	/* riscv does not have SYS_vfork, so we must use clone instead */
5	/* note: riscv's clone = clone(flags, sp, ptidptr, tls, ctidptr) */
6	li a7, 220
7	li a0, 0x100 | 0x4000 | 17 /* flags = CLONE_VM | CLONE_VFORK | SIGCHLD */
8	mv a1, sp
9	/* the other arguments are ignoreable */
10	ecall
11	.hidden __syscall_ret
12	j __syscall_ret
13