Removed patchset ntdll-aarch-TEB

As request on bug.
This commit is contained in:
Alistair Leslie-Hughes 2021-08-04 09:53:13 +10:00
parent 3c8c7910e7
commit 00985bf311
4 changed files with 0 additions and 120 deletions

View File

@ -1,42 +0,0 @@
From 40088e644ecba6005de000c49b65cb168cc9ad5d Mon Sep 17 00:00:00 2001
From: Martin Storsjo <martin@martin.st>
Date: Wed, 21 Jun 2017 11:42:40 +0300
Subject: [PATCH] configure: Avoid clobbering x18 on arm64 within wine
On aarch64/arm64 on linux, the compiler is free to use x18 for normal
code generation (while the register is reserved on iOS/darwin, and
on windows).
If targeting arm64, check for the flags that allows this register to
be left untouched (the flag is supported both by gcc and clang).
Similar issues can still pop up as soon as system library functions
that happen to touch x18 are called, unless the system libraries have
been built with the same flag.
Signed-off-by: Martin Storsjo <martin@martin.st>
---
configure.ac | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configure.ac b/configure.ac
index b0981767977..67e82744dae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,8 +219,13 @@ case $host in
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[void func(__builtin_ms_va_list *args);]])],
[wine_cv_builtin_ms_va_list=yes],[wine_cv_builtin_ms_va_list=no])])
test $wine_cv_builtin_ms_va_list != no || AC_MSG_ERROR([You need clang >= 5.0 to build Wine for arm64.])
+
enable_wow64=${enable_wow64:-yes}
enable_wow64win=${enable_wow64win:-yes}
+ # Avoid clobbering the x18 register which is reserved in windows.
+ # This isn't complete/enough unless all of the system libraries have
+ # been built with the same flag though.
+ WINE_TRY_CFLAGS([-ffixed-x18], [CFLAGS="$CFLAGS -ffixed-x18"])
;;
i[[3456789]]86*)
enable_win16=${enable_win16:-yes}
--
2.30.2

View File

@ -1,60 +0,0 @@
From 53921ff97159fcd4a060568df463886192d41420 Mon Sep 17 00:00:00 2001
From: Martin Storsjo <martin@martin.st>
Date: Wed, 16 Aug 2017 23:48:40 +0300
Subject: [PATCH] ntdll: Always restore TEB to x18 on aarch 64 on return from
calls to builtins
This requires always enabling relaying of calls though.
This isn't enough for cases where builtin functions call back into
the user code though, but works well enough for all pratical cases
I've run so far.
This does give a bit of performance overhead, but it makes it
possible to run most real arm64 binaries (all I've tried).
Signed-off-by: Martin Storsjo <martin@martin.st>
---
dlls/ntdll/loader.c | 8 +++++++-
dlls/ntdll/relay.c | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 092c47eac3b..05e36598cdb 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1890,7 +1890,13 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
if (is_builtin)
{
- if (TRACE_ON(relay)) RELAY_SetupDLL( *module );
+#ifdef __aarch64__
+ /* Always enable relay entry points on aarch64, to allow restoring
+ * the TEB to x18. */
+#else
+ if (TRACE_ON(relay))
+#endif
+ RELAY_SetupDLL( *module );
}
else
{
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index be2dc833377..e29496a8c7a 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -691,8 +691,12 @@ static LONGLONG WINAPI relay_call( struct relay_descr *descr, unsigned int idx,
{
unsigned int nb_args;
void *func = relay_trace_entry( descr, idx, stack, &nb_args );
+ void *teb;
LONGLONG ret = call_entry_point( func, nb_args, stack );
relay_trace_exit( descr, idx, stack[-1], ret );
+ teb = NtCurrentTeb();
+ /* Restore the TEB pointer, in case the builtin call clobbered it. */
+ __asm__ __volatile__( "mov x18, %0" : : "r" (teb) );
return ret;
}
--
2.20.1

View File

@ -1 +0,0 @@
Fixes: [38780] AArch64 platforms: register X18 (TEB) must remain reserved for Wine to run 64-bit ARM Windows applications.

View File

@ -169,7 +169,6 @@ patch_enable_all ()
enable_ntdll_Syscall_Emulation="$1"
enable_ntdll_WRITECOPY="$1"
enable_ntdll_Zero_mod_name="$1"
enable_ntdll_aarch_TEB="$1"
enable_ntdll_ext4_case_folder="$1"
enable_ntoskrnl_Stubs="$1"
enable_nvapi_Stub_DLL="$1"
@ -549,9 +548,6 @@ patch_enable ()
ntdll-Zero_mod_name)
enable_ntdll_Zero_mod_name="$2"
;;
ntdll-aarch-TEB)
enable_ntdll_aarch_TEB="$2"
;;
ntdll-ext4-case-folder)
enable_ntdll_ext4_case_folder="$2"
;;
@ -2789,19 +2785,6 @@ if test "$enable_ntdll_Zero_mod_name" -eq 1; then
patch_apply ntdll-Zero_mod_name/0001-ntdll-Initialize-mod_name-to-zero.patch
fi
# Patchset ntdll-aarch-TEB
# |
# | This patchset fixes the following Wine bugs:
# | * [#38780] AArch64 platforms: register X18 (TEB) must remain reserved for Wine to run 64-bit ARM Windows applications.
# |
# | Modified files:
# | * configure.ac, dlls/ntdll/loader.c, dlls/ntdll/relay.c
# |
if test "$enable_ntdll_aarch_TEB" -eq 1; then
patch_apply ntdll-aarch-TEB/0001-configure-Avoid-clobbering-x18-on-arm64-within-wine.patch
patch_apply ntdll-aarch-TEB/0002-ntdll-Always-restore-TEB-to-x18-on-aarch-64-on-retur.patch
fi
# Patchset ntdll-ext4-case-folder
# |
# | This patchset fixes the following Wine bugs: