Path: blob/master/external/source/osx/x86/include/_shell.s
19758 views
_shell:1;; Test if vfork() will be needed. If execve(0, 0, 0) fails with2;; ENOTSUP, then we are in a threaded process and need to call3;; vfork().4xor eax, eax5push eax ; envp6push eax ; argv7push eax ; path8push eax9mov al, 59 ; SYS_execve10int 0x8011nop12nop13cmp al, 45 ; ENOTSUP14jne .execve_binsh1516.vfork:17mov al, 66 ; SYS_vfork18int 0x80 ; vfork()19cmp edx, byte 020jz .wait2122;; Both child and parent continue to run execve below. The parent23;; fails and falls through to call wait4(), the child succeeds24;; and obviously doesn't call wait4() since it has exec'd a new25;; executable.2627.execve_binsh:28xor eax, eax29push eax ; "\0\0\0\0"30push 0x68732f2f ; "//sh"31push 0x6e69622f ; "/bin"32mov ebx, esp33push eax ; envp34push eax ; argv35push ebx ; path36push eax ; spacer37mov al, 59 ; SYS_execve38int 0x803940.wait:41;; Wait for child process to exit before continuing and crashing42xor eax, eax43push eax44mov ebx, esp4546push eax ; rusage47push eax ; options48push ebx ; stat_loc49push eax ; pid50push eax ; spacer51mov al, 752int 0x80535455