From 204e615b49ebf593373481e7d1203f9c64c9ef16 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sun, 7 Mar 2021 15:55:23 -0500 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. --- thirdparty/libcontext/libcontext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thirdparty/libcontext/libcontext.cpp b/thirdparty/libcontext/libcontext.cpp index ee49da915a..cce7bd59da 100644 --- a/thirdparty/libcontext/libcontext.cpp +++ b/thirdparty/libcontext/libcontext.cpp @@ -153,7 +153,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" @@ -199,7 +199,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"