about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-02-19 15:01:18 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-02-19 15:01:18 +0100
commite3839f6a09620ad4283425ba7f896b75c09c6746 (patch)
tree057a5b0a1988a58eb882a540bc24465c929e4888 /src
parent9e07083c0fc405621ae53f4786d330a74ae0606f (diff)
downloadbox64-e3839f6a09620ad4283425ba7f896b75c09c6746.tar.gz
box64-e3839f6a09620ad4283425ba7f896b75c09c6746.zip
Make sure stack is correctly alligned on new thred (fixed SOR4 starting issues)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/libtools/threads.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c
index f16a7b08..0c81f3ce 100755
--- a/src/libtools/threads.c
+++ b/src/libtools/threads.c
@@ -237,7 +237,9 @@ static void* pthread_routine(void* p)
 	Push64(emu, 0);	// PUSH 0 (backtrace marker: return address is 0)
 	Push64(emu, 0);	// PUSH BP
 	R_RBP = R_RSP;	// MOV BP, SP
-	R_RSP -= 56;	// Guard zone
+	R_RSP -= 64;	// Guard zone
+	if(R_RSP&0x8)	// align if needed (shouldn't be)
+		R_RSP-=8;
 	PushExit(emu);
 	R_RIP = et->fnc;
 	R_RDI = (uintptr_t)et->arg;