ntdll-ForceBottomUpAlloc: Add patch.

This commit is contained in:
Paul Gofman
2019-11-26 15:05:31 +03:00
parent ced0f96514
commit f4987b47e3
3 changed files with 94 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
From 54b9382fdda1798216b23db8273c79aaf649f8ff Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Mon, 25 Nov 2019 12:19:20 +0300
Subject: [PATCH] ntdll: Force bottom up allocation order for 64 bit arch
unless top down is requested.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48175
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46568
---
dlls/ntdll/virtual.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 9666e2051e..23acca6378 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1231,14 +1231,20 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
}
else
{
- size_t view_size = size + mask + 1;
struct alloc_area alloc;
+ size_t view_size;
alloc.size = size;
alloc.mask = mask;
alloc.top_down = top_down;
alloc.limit = (void*)(get_zero_bits_64_mask( zero_bits_64 ) & (UINT_PTR)user_space_limit);
+ if (is_win64 && !top_down)
+ {
+ /* Ditch 0x7ffffe000000 - 0x7fffffff0000 reserved area. */
+ alloc.limit = min(alloc.limit, (void *)0x7ffffe000000);
+ }
+
if (wine_mmap_enum_reserved_areas( alloc_reserved_area_callback, &alloc, top_down ))
{
ptr = alloc.result;
@@ -1248,7 +1254,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
goto done;
}
- if (zero_bits_64)
+ if (is_win64 || zero_bits_64)
{
if (!(ptr = find_free_area(address_space_start, alloc.limit, size,
mask, top_down, TRUE, VIRTUAL_GetUnixProt(vprot))))
@@ -1257,6 +1263,8 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
goto done;
}
+ view_size = size + mask + 1;
+
for (;;)
{
if ((ptr = wine_anon_mmap(NULL, view_size, VIRTUAL_GetUnixProt(vprot), 0 )) == (void *)-1)
--
2.23.0

View File

@@ -0,0 +1,4 @@
Fixes: [48175] AION (64 bit) - crashes in crysystem.dll.CryFree() due to high memory pointers allocated
Fixes: [46568] 64-bit msxml6.dll from Microsoft Core XML Services 6.0 redist package fails to load (Wine doesn't respect 44-bit user-mode VA limitation from Windows < 8.1)
Depends: ntdll-BitmaskAllocAreaSearch