this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Additional vfork assembly fix

This fix allows the child to actually return correctly.

It was present in an older commit but it got removed in a commit from a few months ago, in what looks like an accidental change (not sure how this code was still working, though).

+26 -18
+13 -9
src/kernel/libsyscall/bsdsyscalls/___vfork.S
··· 106 106 cmpxchgl %ecx, (%rdx) 107 107 jne 0b 108 108 #ifdef DARLING 109 - movl $ SYS_vfork, %eax 110 - call __darling_bsd_syscall 111 - cmpq $0, %rax 112 - jnb L1 109 + movl $ SYS_vfork, %eax 110 + call __darling_bsd_syscall 111 + cmpq $0, %rax 112 + jnb L1 113 113 #else 114 - popq %rdi // return address in %rdi 115 - movq $ SYSCALL_CONSTRUCT_UNIX(SYS_vfork), %rax // code for vfork -> rax 116 - UNIX_SYSCALL_TRAP // do the system call 117 - jnb L1 // jump if CF==0 118 - pushq %rdi // put return address back on stack for cerror 114 + popq %rdi // return address in %rdi 115 + movq $ SYSCALL_CONSTRUCT_UNIX(SYS_vfork), %rax // code for vfork -> rax 116 + UNIX_SYSCALL_TRAP // do the system call 117 + jnb L1 // jump if CF==0 118 + pushq %rdi // put return address back on stack for cerror 119 119 #endif 120 120 movq __current_pid@GOTPCREL(%rip), %rcx 121 121 lock ··· 132 132 jz L2 // parent, since r1 == 0 in parent, 1 in child 133 133 #endif 134 134 xorq %rax, %rax // zero rax 135 + #ifdef DARLING 136 + ret 137 + #else 135 138 jmp *%rdi 139 + #endif 136 140 137 141 L2: 138 142 movq __current_pid@GOTPCREL(%rip), %rdx
+13 -9
src/kernel/libsyscall/custom/__vfork.S
··· 106 106 cmpxchgl %ecx, (%rdx) 107 107 jne 0b 108 108 #ifdef DARLING 109 - movl $ SYS_vfork, %eax 110 - call __darling_bsd_syscall 111 - cmpq $0, %rax 112 - jnb L1 109 + movl $ SYS_vfork, %eax 110 + call __darling_bsd_syscall 111 + cmpq $0, %rax 112 + jnb L1 113 113 #else 114 - popq %rdi // return address in %rdi 115 - movq $ SYSCALL_CONSTRUCT_UNIX(SYS_vfork), %rax // code for vfork -> rax 116 - UNIX_SYSCALL_TRAP // do the system call 117 - jnb L1 // jump if CF==0 118 - pushq %rdi // put return address back on stack for cerror 114 + popq %rdi // return address in %rdi 115 + movq $ SYSCALL_CONSTRUCT_UNIX(SYS_vfork), %rax // code for vfork -> rax 116 + UNIX_SYSCALL_TRAP // do the system call 117 + jnb L1 // jump if CF==0 118 + pushq %rdi // put return address back on stack for cerror 119 119 #endif 120 120 movq __current_pid@GOTPCREL(%rip), %rcx 121 121 lock ··· 132 132 jz L2 // parent, since r1 == 0 in parent, 1 in child 133 133 #endif 134 134 xorq %rax, %rax // zero rax 135 + #ifdef DARLING 136 + ret 137 + #else 135 138 jmp *%rdi 139 + #endif 136 140 137 141 L2: 138 142 movq __current_pid@GOTPCREL(%rip), %rdx