Jacek Caban : winebuild: Restore x86_64 FPU context and nonvolatile registers in syscall dispatcher.

Alexandre Julliard julliard at winehq.org
Wed Feb 17 16:23:33 CST 2021


Module: wine
Branch: master
Commit: be8729c9f57e555148c4dde7cc2001ae316d124b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=be8729c9f57e555148c4dde7cc2001ae316d124b

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Feb 15 21:59:16 2021 +0100

winebuild: Restore x86_64 FPU context and nonvolatile registers in syscall dispatcher.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/signal_x86_64.c |  1 +
 tools/winebuild/import.c        | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 6e34e0d9979..892d208e43a 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -2152,6 +2152,7 @@ __ASM_GLOBAL_FUNC( call_raise_user_exception_dispatcher,
                    "movq 0x8(%rax),%rbx\n\t"      /* frame->rbx */
                    "movq 0x20(%rax),%rsi\n\t"     /* frame->rsi */
                    "movq 0x28(%rax),%rdi\n\t"     /* frame->rdi */
+                   "movq 0x50(%rax),%r12\n\t"     /* frame->r12 */
                    "movq 0x98(%rax),%rbp\n\t"     /* frame->rbp */
                    "movq $0,0x328(%rdx)\n\t"
                    "leaq 0xa8(%rax),%rsp\n\t"
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 6b5f704c8f1..5645d3aa9af 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1519,6 +1519,7 @@ void output_syscalls( DLLSPEC *spec )
             output( "\tmovq %%rdi,-0x70(%%rbp)\n" );
             output_cfi( ".cfi_rel_offset %%rdi,-112" );
             output( "\tmovq %%r12,-0x48(%%rbp)\n" );
+            output_cfi( ".cfi_rel_offset %%r12,-72" );
             output( "\tmovq %%r13,-0x40(%%rbp)\n" );
             output( "\tmovq %%r14,-0x38(%%rbp)\n" );
             output( "\tmovq %%r15,-0x30(%%rbp)\n" );
@@ -1535,7 +1536,8 @@ void output_syscalls( DLLSPEC *spec )
             output( "\tmovw %%fs,-0x1a(%%rbp)\n" );
             output( "\tmovw %%ss,-0x8(%%rbp)\n" );
             output( "\tmovw %%gs,-0x6(%%rbp)\n" );
-            output( "\tfxsave64 (%%rsp)\n" );
+            output( "\tmovq %%rsp,%%r12\n" );
+            output( "\tfxsave64 (%%r12)\n" );
             output( "\tmovq %%gs:0x30,%%rcx\n" );
             output( "\tleaq -0x98(%%rbp),%%rbx\n" );
             output( "\tmovq %%rbx,0x328(%%rcx)\n" );  /* amd64_thread_data()->syscall_frame */
@@ -1558,6 +1560,12 @@ void output_syscalls( DLLSPEC *spec )
             output( "\tcallq *(%%r10,%%rax,8)\n" );
             output( "2:\tmovq %%gs:0x30,%%rcx\n" );
             output( "\tmovq $0,0x328(%%rcx)\n" );
+            output( "\tfxrstor64 (%%r12)\n" );
+            output( "\tmovq -0x30(%%rbp),%%r15\n" );
+            output( "\tmovq -0x38(%%rbp),%%r14\n" );
+            output( "\tmovq -0x40(%%rbp),%%r13\n" );
+            output( "\tmovq -0x48(%%rbp),%%r12\n" );
+            output_cfi( ".cfi_same_value %%r12" );
             output( "\tmovq -0x70(%%rbp),%%rdi\n" );
             output_cfi( ".cfi_same_value %%rdi" );
             output( "\tmovq -0x78(%%rbp),%%rsi\n" );




More information about the wine-cvs mailing list