this repo has no description
1
fork

Configure Feed

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

Fix vfork assembly

I had forgotten to add some Darling fixes from the old code (some were clearly labeled with `#ifdef DARLING`, some weren't)

+30 -26
+15 -13
src/kernel/libsyscall/bsdsyscalls/___vfork.S
··· 65 65 cmpxchgl %ecx, __current_pid 66 66 jne 0b 67 67 popl %ecx 68 - #ifdef DARLING 69 - movl $ SYS_vfork, %eax 70 - call __darling_bsd_syscall 71 - cmpl $0, %eax 72 - jnb L1 73 - #else 74 - movl $(SYS_vfork), %eax // code for vfork -> eax 75 - UNIX_SYSCALL_TRAP // do the system call 76 - jnb L1 // jump if CF==0 77 - #endif 68 + movl $(SYS_vfork), %eax // code for vfork -> eax 69 + UNIX_SYSCALL_TRAP // do the system call 70 + jnb L1 // jump if CF==0 78 71 GET_CURRENT_PID 79 72 lock 80 73 incl __current_pid ··· 112 105 lock 113 106 cmpxchgl %ecx, (%rdx) 114 107 jne 0b 115 - #ifdef DARLING 108 + #ifdef DARLING 116 109 movl $ SYS_vfork, %eax 117 110 call __darling_bsd_syscall 118 111 cmpq $0, %rax 119 112 jnb L1 120 - #else 113 + #else 121 114 popq %rdi // return address in %rdi 122 115 movq $ SYSCALL_CONSTRUCT_UNIX(SYS_vfork), %rax // code for vfork -> rax 123 116 UNIX_SYSCALL_TRAP // do the system call 124 117 jnb L1 // jump if CF==0 125 118 pushq %rdi // put return address back on stack for cerror 126 - #endif 119 + #endif 127 120 movq __current_pid@GOTPCREL(%rip), %rcx 128 121 lock 129 122 addl $1, (%rcx) ··· 131 124 BRANCH_EXTERN(_cerror) 132 125 133 126 L1: 127 + #ifdef DARLING 128 + testl %eax, %eax 129 + jnz L2 130 + #else 134 131 testl %edx, %edx // CF=OF=0, ZF set if zero result 135 132 jz L2 // parent, since r1 == 0 in parent, 1 in child 133 + #endif 136 134 xorq %rax, %rax // zero rax 137 135 jmp *%rdi 138 136 ··· 140 138 movq __current_pid@GOTPCREL(%rip), %rdx 141 139 lock 142 140 addl $1, (%rdx) 141 + #ifdef DARLING 142 + ret 143 + #else 143 144 jmp *%rdi 145 + #endif 144 146 145 147 #elif defined(__arm__) 146 148
+15 -13
src/kernel/libsyscall/custom/__vfork.S
··· 65 65 cmpxchgl %ecx, __current_pid 66 66 jne 0b 67 67 popl %ecx 68 - #ifdef DARLING 69 - movl $ SYS_vfork, %eax 70 - call __darling_bsd_syscall 71 - cmpl $0, %eax 72 - jnb L1 73 - #else 74 - movl $(SYS_vfork), %eax // code for vfork -> eax 75 - UNIX_SYSCALL_TRAP // do the system call 76 - jnb L1 // jump if CF==0 77 - #endif 68 + movl $(SYS_vfork), %eax // code for vfork -> eax 69 + UNIX_SYSCALL_TRAP // do the system call 70 + jnb L1 // jump if CF==0 78 71 GET_CURRENT_PID 79 72 lock 80 73 incl __current_pid ··· 112 105 lock 113 106 cmpxchgl %ecx, (%rdx) 114 107 jne 0b 115 - #ifdef DARLING 108 + #ifdef DARLING 116 109 movl $ SYS_vfork, %eax 117 110 call __darling_bsd_syscall 118 111 cmpq $0, %rax 119 112 jnb L1 120 - #else 113 + #else 121 114 popq %rdi // return address in %rdi 122 115 movq $ SYSCALL_CONSTRUCT_UNIX(SYS_vfork), %rax // code for vfork -> rax 123 116 UNIX_SYSCALL_TRAP // do the system call 124 117 jnb L1 // jump if CF==0 125 118 pushq %rdi // put return address back on stack for cerror 126 - #endif 119 + #endif 127 120 movq __current_pid@GOTPCREL(%rip), %rcx 128 121 lock 129 122 addl $1, (%rcx) ··· 131 124 BRANCH_EXTERN(_cerror) 132 125 133 126 L1: 127 + #ifdef DARLING 128 + testl %eax, %eax 129 + jnz L2 130 + #else 134 131 testl %edx, %edx // CF=OF=0, ZF set if zero result 135 132 jz L2 // parent, since r1 == 0 in parent, 1 in child 133 + #endif 136 134 xorq %rax, %rax // zero rax 137 135 jmp *%rdi 138 136 ··· 140 138 movq __current_pid@GOTPCREL(%rip), %rdx 141 139 lock 142 140 addl $1, (%rdx) 141 + #ifdef DARLING 142 + ret 143 + #else 143 144 jmp *%rdi 145 + #endif 144 146 145 147 #elif defined(__arm__) 146 148