Usermode - Working on new build/makefile system
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / arch / x86.asm.h
index 282ff40..7780ee8 100644 (file)
@@ -2,13 +2,22 @@
 ; AcssMicro - System Calls
 ; ========================
 
-%include "../../../Kernel/include/syscalls.inc.asm"
+#include "../../../../Kernel/include/syscalls.h"
 
 [bits 32]
 [section .data]
+[global _errno:data 4]
 _errno:        dw      0
 
 [section .text]
+[global _start]
+[extern SoMain]
+_start:
+       call SoMain
+       add esp, 4      ; // Base address
+       call eax
+       call _exit
+
 ; DEST
 ; SRC
 _memcpy:
@@ -149,6 +158,7 @@ clone:
        push ebp
        mov ebp, esp
        push ebx
+       push edx
        
        mov ebx, [ebp+12]       ; Get new stack pointer
        
@@ -180,11 +190,20 @@ clone:
        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

UCC git Repository :: git.ucc.asn.au