Usermode/ld-acess - Fixed warning when debug is enabled
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / arch / x86_64.asm.h
index 2c9d87f..6c3ac0f 100644 (file)
@@ -142,14 +142,19 @@ _SYSCALL_TAIL
 
 ; // Override the clone syscall
 #define clone  _clone_raw
+#define _exit  _exit_raw
 #include "syscalls.s.h"
 #undef clone
+#undef _exit
 
 [global clone:func]
 clone:
        push rbp
        mov rbp, rsp
        push rbx
+       push r12
+       
+       mov r12, rsi    ; Save in a reg for after the clone
        
        ; Check if the new stack is being used
        test rsi, rsi
@@ -162,11 +167,26 @@ clone:
        sub rsi, 3*8
 .doCall:
        mov eax, SYS_CLONE
-       mov rdi, rsi    ; Stack
-       mov rsi, [rbp+2*8]      ; Flags
        SYSCALL_OP
        mov [rel _errno], ebx
+
+       ; Change stack pointer
+       test eax, eax
+       jnz .ret
+       test r12, r12
+       jz .ret
+       mov rsp, rsi
+.ret:
+       pop r12
        pop rbx
        pop rbp
        ret
 
+
+[global _exit:func]
+_exit:
+       xor eax, eax
+       SYSCALL_OP
+       jmp $
+
+; vim: ft=nasm

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