X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Farch%2Fx86.asm.h;h=7780ee8c062938878112ef6f5532b65f620b5f4f;hb=05abefc2a27a08f381bca41524a5d299c4839ff2;hp=282ff40ea4802ff94adae18577ed5fb61853cb09;hpb=3d6a345b39afa454f0f33fc8d48b96229971e6ed;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/ld-acess.so_src/arch/x86.asm.h b/Usermode/Libraries/ld-acess.so_src/arch/x86.asm.h index 282ff40e..7780ee8c 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/x86.asm.h +++ b/Usermode/Libraries/ld-acess.so_src/arch/x86.asm.h @@ -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