RFC: Limit addresses to 43 bits on 64-bit.

Derek Lesho dlesho at codeweavers.com
Wed Oct 2 10:38:38 CDT 2019


Mortal Kombat 11 allocates memory, with zero_bits set to 0, and applies
a 43-bit mask on the pointer.  This would have worked in Windows 7, as
MSDN says that 43-bits was the maximum pointer size, but the game
exhibits this same behavior in wine even when the windows version is
set to 8+.  This is probably not an issue on Windows, as the allocator
may return a much lower address.
---
 dlls/ntdll/virtual.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 181dffe42e..437aef099e 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -132,7 +132,7 @@ static void *address_space_start = (void *)0x110000;    /* keep DOS area clear *
 static const UINT page_shift = 12;
 static const UINT_PTR page_mask = 0xfff;
 static void *address_space_limit = (void *)0x7fffffff0000;
-static void *user_space_limit    = (void *)0x7fffffff0000;
+static void *user_space_limit    = (void *)0x7ffffff0000;
 static void *working_set_limit   = (void *)0x7fffffff0000;
 static void *address_space_start = (void *)0x10000;
 #else
@@ -2625,6 +2625,7 @@ void virtual_set_large_address_space(void)
 {
     IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
 
+    if (is_win64) return;
     if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)) return;
     /* no large address space on win9x */
     if (NtCurrentTeb()->Peb->OSPlatformId != VER_PLATFORM_WIN32_NT) return;
-- 
2.23.0




More information about the wine-devel mailing list