[extern SoMain]
_start:
call SoMain
-
- add esp, 4
- call eax
-
- push eax
- call _exit
+ add esp, 4 ; // Base address
+ jmp eax
; DEST
; SRC
push ebp
mov ebp, esp
push ebx
+ push edx
mov ebx, [ebp+12] ; Get new stack pointer
sub ebx, 12
%endif
.doCall:
+ mov edx, ebx ; Save new stack
mov eax, SYS_CLONE
mov ecx, ebx ; Stack
mov ebx, [ebp+8] ; Flags
SYSCALL_OP
mov [_errno], ebx
+
+ test eax, eax
+ jnz .ret
+ test edx, edx
+ jz .ret
+ mov esp, edx
+.ret:
+ pop edx
pop ebx
pop ebp
ret