X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Farch%2Fx86_64.asm.h;h=6c3ac0f2400597577ecd7a80ea961ed21eed8455;hb=02907f27e675b13565f61708d981c9e3511c2764;hp=2c9d87fcd55e6dce875673388b4726fa41e4b771;hpb=a743018b19b089137e406de0a682856dc1be61ff;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h b/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h index 2c9d87fc..6c3ac0f2 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h +++ b/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h @@ -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