From 82193348065a2ec06a41e26fbd6261ee2abd22be Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 12 Apr 2021 19:11:44 -0400 Subject: [PATCH] Fix wrong offset in msys2 x64 libcontext implementation not saving fiber data pointer This should have/may have been causing random crashes on calls into win32 api. fiber data is located at offset 0x20 of the stack not 0x18. --- common/system/libcontext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/system/libcontext.cpp b/common/system/libcontext.cpp index cb7c9b47db..24767e5a34 100644 --- a/common/system/libcontext.cpp +++ b/common/system/libcontext.cpp @@ -151,7 +151,7 @@ __asm ( " push %rax\n" " mov 0x1478(%r10),%rax\n" " push %rax\n" -" mov 0x18(%r10),%rax\n" +" mov 0x20(%r10),%rax\n" " push %rax\n" " lea -0xa8(%rsp),%rsp\n" " test %r9,%r9\n" @@ -197,7 +197,7 @@ __asm ( " lea (%rsp,%rcx,1),%rsp\n" " mov %gs:0x30,%r10\n" " pop %rax\n" -" mov %rax,0x18(%r10)\n" +" mov %rax,0x20(%r10)\n" " pop %rax\n" " mov %rax,0x1478(%r10)\n" " pop %rax\n"