From fd175dc86377920938c9d3e444ed7e60ff605cd5 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 28 Aug 2020 09:44:07 +1000 Subject: [PATCH] Rebase against 7489efa03f09c6c3613668a0169abade6b390d09. --- ...dll-Support-x86_64-syscall-emulation.patch | 22 +++++++++---------- patches/patchinstall.sh | 2 +- ..._wine_syscall_dispatcher-through-the.patch | 16 +++++++------- staging/upstream-commit | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch b/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch index 2192a00b..6bfd62d7 100644 --- a/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch +++ b/patches/ntdll-Syscall_Emulation/0001-ntdll-Support-x86_64-syscall-emulation.patch @@ -1,4 +1,4 @@ -From b1ab7b26620fc62b2a4848a0efbb6c9e116a5adc Mon Sep 17 00:00:00 2001 +From b91699bc26a89683053a6157f343372d98da2a67 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 14 Jul 2020 15:00:34 +0300 Subject: [PATCH] ntdll: Support x86_64 syscall emulation. @@ -10,10 +10,10 @@ Subject: [PATCH] ntdll: Support x86_64 syscall emulation. 3 files changed, 122 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 65fa00ff5c6c..4c2c005bca1e 100644 +index f147d3e845d..74a9119d691 100644 --- a/configure.ac +++ b/configure.ac -@@ -477,6 +477,7 @@ AC_CHECK_HEADERS(\ +@@ -473,6 +473,7 @@ AC_CHECK_HEADERS(\ linux/joystick.h \ linux/major.h \ linux/param.h \ @@ -22,7 +22,7 @@ index 65fa00ff5c6c..4c2c005bca1e 100644 linux/types.h \ linux/ucdrom.h \ diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c -index e8e98142a982..1b2d2891ab89 100644 +index a0d3594e6b8..f693fbe6b9f 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -28,6 +28,7 @@ @@ -47,7 +47,7 @@ index e8e98142a982..1b2d2891ab89 100644 #define NONAMELESSUNION #define NONAMELESSSTRUCT #include "ntstatus.h" -@@ -2089,6 +2097,116 @@ static inline DWORD is_privileged_instr( CONTEXT *context ) +@@ -2157,6 +2165,116 @@ static inline DWORD is_privileged_instr( CONTEXT *context ) return 0; } @@ -164,7 +164,7 @@ index e8e98142a982..1b2d2891ab89 100644 /*********************************************************************** * handle_interrupt -@@ -2538,6 +2656,7 @@ void signal_init_process(void) +@@ -2644,6 +2762,7 @@ void signal_init_process(void) if (sigaction( SIGSEGV, &sig_act, NULL ) == -1) goto error; if (sigaction( SIGILL, &sig_act, NULL ) == -1) goto error; if (sigaction( SIGBUS, &sig_act, NULL ) == -1) goto error; @@ -173,18 +173,18 @@ index e8e98142a982..1b2d2891ab89 100644 error: diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c -index e8bd141e962b..334278a7e50d 100644 +index b90d93ca5db..e750ae0ad3f 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c -@@ -1501,6 +1501,7 @@ void output_syscalls( DLLSPEC *spec ) +@@ -1524,6 +1524,7 @@ void output_syscalls( DLLSPEC *spec ) /* Legends of Runeterra hooks the first system call return instruction, and * depends on us returning to it. Adjust the return address accordingly. */ output( "\tsubq $0xb,0x8(%%rbp)\n" ); + output( "\tsubq $0xf000,%%rax\n" ); + output( "\tmovq %%rsp,0x328(%%rcx)\n" ); /* amd64_thread_data()->syscall_frame */ output( "\tcmpq $%u,%%rax\n", count ); output( "\tjae 4f\n" ); - output( "\tleaq .Lsyscall_args(%%rip),%%rcx\n" ); -@@ -1643,7 +1644,7 @@ void output_syscalls( DLLSPEC *spec ) +@@ -1703,7 +1704,7 @@ void output_syscalls( DLLSPEC *spec ) * validate that instruction, we can just put a jmp there instead. */ output( "\t.byte 0x4c,0x8b,0xd1\n" ); /* movq %rcx,%r10 */ output( "\t.byte 0xb8\n" ); /* movl $i,%eax */ @@ -194,5 +194,5 @@ index e8bd141e962b..334278a7e50d 100644 output( "\t.byte 0x75,0x03\n" ); /* jne 1f */ output( "\t.byte 0x0f,0x05\n" ); /* syscall */ -- -2.26.2 +2.28.0 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index c561d626..756082b6 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "666f614f3f09211614024f87a238aa49c79f574a" + echo "7489efa03f09c6c3613668a0169abade6b390d09" } # Show version information diff --git a/patches/winebuild-pe_syscall_thunks/0002-winebuild-Call-__wine_syscall_dispatcher-through-the.patch b/patches/winebuild-pe_syscall_thunks/0002-winebuild-Call-__wine_syscall_dispatcher-through-the.patch index 79796896..595e4599 100644 --- a/patches/winebuild-pe_syscall_thunks/0002-winebuild-Call-__wine_syscall_dispatcher-through-the.patch +++ b/patches/winebuild-pe_syscall_thunks/0002-winebuild-Call-__wine_syscall_dispatcher-through-the.patch @@ -1,4 +1,4 @@ -From eb7f9381fb1109c3468047f604b0e57a1cbb4edb Mon Sep 17 00:00:00 2001 +From 699069081ca58f401501f9fda60ccc6ef6187470 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 14 Jul 2020 14:43:01 +0300 Subject: [PATCH] winebuild: Call __wine_syscall_dispatcher through the fixed @@ -17,10 +17,10 @@ call syscall thunks from the loaded image. 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 9b1ca761e9b..0f4fd8d95ee 100644 +index 3af5241ee30..7b0ebf4dda7 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -2594,20 +2594,22 @@ TEB *virtual_alloc_first_teb(void) +@@ -2815,20 +2815,22 @@ TEB *virtual_alloc_first_teb(void) PEB *peb; void *ptr; NTSTATUS status; @@ -46,24 +46,24 @@ index 9b1ca761e9b..0f4fd8d95ee 100644 MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE ); teb_block_pos = 30; diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c -index 278de20522e..094b9da0ccf 100644 +index 461f1851d61..b90d93ca5db 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c -@@ -1613,10 +1613,10 @@ void output_syscalls( DLLSPEC *spec ) +@@ -1710,10 +1710,10 @@ void output_syscalls( DLLSPEC *spec ) output( "\t.byte 0xc3\n" ); /* ret */ output( "\tjmp 1f\n" ); output( "\t.byte 0xc3\n" ); /* ret */ - if (target_platform == PLATFORM_WINDOWS) + if (target_platform == PLATFORM_WINDOWS || target_platform == PLATFORM_APPLE) { -- output( "1:\t.byte 0xff,0x14,0x25\n" ); /* 2: callq *(__wine_syscall_dispatcher) */ +- output( "1:\t.byte 0xff,0x14,0x25\n" ); /* 1: callq *(__wine_syscall_dispatcher) */ - output( "\t.long __wine_syscall_dispatcher\n" ); + output( "1:\t.byte 0xff,0x14,0x25\n" ); /* call *(user_shared_data + 0x1000) */ + output( "\t.long 0x7ffe1000\n" ); } else { -@@ -1653,7 +1653,7 @@ void output_syscalls( DLLSPEC *spec ) +@@ -1754,7 +1754,7 @@ void output_syscalls( DLLSPEC *spec ) output( "\t.align %d\n", get_alignment(16) ); output( "\t%s\n", func_declaration("__wine_syscall") ); output( "%s:\n", asm_name("__wine_syscall") ); @@ -73,5 +73,5 @@ index 278de20522e..094b9da0ccf 100644 } output( "\t.data\n" ); -- -2.27.0 +2.28.0 diff --git a/staging/upstream-commit b/staging/upstream-commit index 78bdcc30..b3ef3062 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -666f614f3f09211614024f87a238aa49c79f574a +7489efa03f09c6c3613668a0169abade6b390d09