X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Farch%2Fx86_64.asm.h;h=62fc400a7de6f0bd8730f0eac74ddb97883cd3e8;hb=c53533a539638c1c0ad4f4c99c091ae7972cfd8b;hp=ea605ef69bdd766eedeea09dbf7ab10f3ee3726f;hpb=40b3565d79c0fd55f83e6470a458945efa21f6da;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 ea605ef6..62fc400a 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 @@ -152,6 +152,9 @@ clone: push rbp mov rbp, rsp push rbx + push r11 + + mov r12, rsi ; Save in a reg for after the clone ; Check if the new stack is being used test rsi, rsi @@ -166,10 +169,19 @@ clone: mov eax, SYS_CLONE SYSCALL_OP mov [rel _errno], ebx + + ; Change stack pointer + test eax, eax + jnz .ret + test r12, r12 + jz .ret + mov rsp, rsi +.ret: pop rbx pop rbp ret + [global _exit:func] _exit: xor eax, eax