[PATCH] ntdll: set user_shared_data to 0x7fffffff0000 and virtual_alloc_first_teb can run succeeded on android aarch64

fanwj at mail.ustc.edu.cn fanwj at mail.ustc.edu.cn
Mon Jan 10 05:53:14 CST 2022


---
 dlls/ntdll/unix/virtual.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 1f817cd977d..543c04e0dae 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -173,7 +173,16 @@ static void *user_space_limit    = (void *)0x7fff0000;
 static void *working_set_limit   = (void *)0x7fff0000;
 #endif
 
+#if defined(__aarch64__) && defined(__ANDROID__)
+/* Note: Android-AARCH64 only support 3-level page table:
+ * user_shared_data = page_size * pow(page_size / ptr_size, page_level) - 0x20000
+ *                  = 0x1000 * pow(0x1000 / 8, 3) - 0x20000
+ *                  = 0x7ffffe0000
+ */
+struct _KUSER_SHARED_DATA *user_shared_data = (void *)0x7ffffe0000;
+#else
 struct _KUSER_SHARED_DATA *user_shared_data = (void *)0x7ffe0000;
+#endif
 
 /* TEB allocation blocks */
 static void *teb_block;
-- 
2.32.0 (Apple Git-132)





More information about the wine-devel mailing list