[1/2] ntdll: Set platform register x18 to TEB on ARM64 (resend)

André Hentschel nerv at dawncrow.de
Mon Jun 15 16:22:53 CDT 2015


Yeah, -ffixed-x18 wasn't the holy grail, sure, but still setting x18 is good to have as early as possible.
Changing x18 isn't critical for us, as it's otherwise only used as scratch register.

I'll soon look into changing the toolchain default in various Distros...

https://bugs.winehq.org/show_bug.cgi?id=38719
---
 dlls/ntdll/signal_arm64.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index f5c62d1..db89079 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -788,6 +788,17 @@ void signal_free_thread( TEB *teb )
 
 
 /**********************************************************************
+ *      set_x18
+ *
+ * Win64/ARM applications expect the TEB pointer to be in the x18 platform register.
+ */
+extern void set_x18( TEB *teb );
+__ASM_GLOBAL_FUNC( set_x18,
+                   "mov x18, x0\n\t" /* TEB -> platform register */
+                   "ret" )
+
+
+/**********************************************************************
  *		signal_init_thread
  */
 void signal_init_thread( TEB *teb )
@@ -799,6 +810,7 @@ void signal_init_thread( TEB *teb )
         pthread_key_create( &teb_key, NULL );
         init_done = TRUE;
     }
+    set_x18( teb );
     pthread_setspecific( teb_key, teb );
 }
 
-- 
1.9.1





More information about the wine-patches mailing list