Rebase against a500bb72f05058c985511ff35f191565f45cd6c0.

This commit is contained in:
Alistair Leslie-Hughes 2023-04-26 11:01:51 +10:00
parent 7f36a96808
commit 0c2c469c7b
3 changed files with 20 additions and 21 deletions

View File

@ -1,23 +1,22 @@
From c97697f6bbc3c9671210e480f2fcfe761b54893d Mon Sep 17 00:00:00 2001
From 6a2f524736ad25b89af90a74eedfa2f2b0f178e6 Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Fri, 11 Nov 2022 18:30:20 -0600
Subject: [PATCH] ntdll: Fully support unaligned views in free ranges
management.
---
dlls/ntdll/unix/virtual.c | 41 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 20 deletions(-)
dlls/ntdll/unix/virtual.c | 40 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 4cb0f349ffc..2dca5dfa45f 100644
index 847cfd750f3..cfa69d8d7f5 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -749,18 +749,19 @@ static void free_ranges_insert_view( struct file_view *view )
@@ -742,17 +742,19 @@ static void free_ranges_insert_view( struct file_view *view )
assert( range != free_ranges_end );
assert( range->end > view_base || next != free_ranges_end );
- /* this happens because virtual_alloc_thread_stack shrinks a view, then creates another one on top,
- * or because AT_ROUND_TO_PAGE was used with NtMapViewOfSection to force 4kB aligned mapping. */
- /* this happens because AT_ROUND_TO_PAGE was used with NtMapViewOfSection to force 4kB aligned mapping. */
- if ((range->end > view_base && range->base >= view_end) ||
- (range->end == view_base && next->base >= view_end))
- {
@ -43,7 +42,7 @@ index 4cb0f349ffc..2dca5dfa45f 100644
/* this should never happen */
if (range->base > view_base || range->end < view_end)
@@ -810,9 +811,7 @@ static void free_ranges_remove_view( struct file_view *view )
@@ -802,9 +804,7 @@ static void free_ranges_remove_view( struct file_view *view )
struct range_entry *range = free_ranges_lower_bound( view_base );
struct range_entry *next = range + 1;
@ -54,7 +53,7 @@ index 4cb0f349ffc..2dca5dfa45f 100644
struct file_view *prev_view = RB_ENTRY_VALUE( rb_prev( &view->entry ), struct file_view, entry );
struct file_view *next_view = RB_ENTRY_VALUE( rb_next( &view->entry ), struct file_view, entry );
void *prev_view_base = prev_view ? ROUND_ADDR( prev_view->base, granularity_mask ) : NULL;
@@ -820,13 +819,15 @@ static void free_ranges_remove_view( struct file_view *view )
@@ -812,13 +812,15 @@ static void free_ranges_remove_view( struct file_view *view )
void *next_view_base = next_view ? ROUND_ADDR( next_view->base, granularity_mask ) : NULL;
void *next_view_end = next_view ? ROUND_ADDR( (char *)next_view->base + next_view->size + granularity_mask, granularity_mask ) : NULL;
@ -77,5 +76,5 @@ index 4cb0f349ffc..2dca5dfa45f 100644
/* free_ranges initial value is such that the view is either inside range or before another one. */
assert( range != free_ranges_end );
--
2.38.1
2.40.1

View File

@ -1,4 +1,4 @@
From 0a8dca419f3f5eacab2e9e11903cfc4c0a58dc93 Mon Sep 17 00:00:00 2001
From 326a1a51a7fa3869a13522cf52a7b4c575aebc81 Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Thu, 10 Nov 2022 18:48:14 -0600
Subject: [PATCH] ntdll: Pass allocation type to map_view().
@ -9,10 +9,10 @@ Based on a patch by Nikolay Sivov.
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 85c4ab878b3..eb1d186e11c 100644
index 55d453c2504..69c8977250a 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -2007,8 +2007,9 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot )
@@ -1990,8 +1990,9 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot )
* virtual_mutex must be held by caller.
*/
static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
@ -23,7 +23,7 @@ index 85c4ab878b3..eb1d186e11c 100644
void *ptr;
NTSTATUS status;
@@ -2223,7 +2224,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot
@@ -2208,7 +2209,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot
if (mmap_is_in_reserved_area( low_64k, dosmem_size - 0x10000 ) != 1)
{
addr = anon_mmap_tryfixed( low_64k, dosmem_size - 0x10000, unix_prot, 0 );
@ -32,15 +32,15 @@ index 85c4ab878b3..eb1d186e11c 100644
}
/* now try to allocate the low 64K too */
@@ -3236,7 +3237,7 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, ULONG_PTR zero_bits, SI
@@ -3220,7 +3221,7 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, ULONG_PTR zero_bits, SI
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
- if ((status = map_view( &view, NULL, size + extra_size, FALSE,
+ if ((status = map_view( &view, NULL, size + extra_size, 0,
VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, get_zero_bits_mask( zero_bits ), 0 ))
!= STATUS_SUCCESS)
- if ((status = map_view( &view, NULL, size, FALSE, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED,
+ if ((status = map_view( &view, NULL, size, 0, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED,
get_zero_bits_mask( zero_bits ), 0 )) != STATUS_SUCCESS)
goto done;
--
2.38.1
2.40.1

View File

@ -1 +1 @@
9e99c6f66d236101a084b6a3a24c98b5c8677fe5
a500bb72f05058c985511ff35f191565f45cd6c0