ref: ec5f2d23637dadf6d2893bf6f2f829b070ec3b34
dir: /lib/sys/syscall+openbsd-x64.s/
.globl sys$syscall sys$syscall: /* hack: We load 6 args regardless of how many we actually have. This may load junk values, but if the syscall doesn't use them, it's going to be harmless. */ movq %rdi,%rax /* 8(%rsp): hidden type arg */ movq 16(%rsp),%rdi movq 24(%rsp),%rsi movq 32(%rsp),%rdx movq 40(%rsp),%r10 movq 48(%rsp),%r8 movq 56(%rsp),%r9 syscall jae .success negq %rax .success: ret /* __tfork_thread(tfp : tforkparams#, sz : size, fn : void#, arg : void#-> tid) */ .globl sys$__tfork_thread sys$__tfork_thread: /* syscall */ movq %rdx, %r8 movq %rcx, %r9 movq $8, %rax syscall jb .failparent /* are we in the parent? */ cmpq $0,%rax jnz .doneparent /* call the function and __threxit */ movq %r9, %rdi callq *%r8 movq $302,%rax xorq %rdi,%rdi syscall .failparent: negq %rax .doneparent: ret