Rebase against 0c27d244f76ad90301c5db09d738b3a0389bcdac.

This commit is contained in:
Zebediah Figura 2020-04-30 17:39:18 -05:00
parent 7b0b95ee53
commit 169c49055d
11 changed files with 136 additions and 137 deletions

View File

@ -1,8 +1,8 @@
From 86714f32b54c3135e5626f66f65ae5daf946f744 Mon Sep 17 00:00:00 2001
From f7855379ad40d50af6d63a8e7349504ece2f3464 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 12 Jun 2018 10:01:08 -0500
Subject: [PATCH 23/83] ntdll, wineandroid.drv, winemac.drv, winex11.drv: Store
the thread's queue fd in ntdll.
Subject: [PATCH] ntdll, wineandroid.drv, winemac.drv, winex11.drv: Store the
thread's queue fd in ntdll.
I originally had esync grab it from the server in order to avoid touching the USER drivers, but this doesn't really work since we might perform a MsgWait before ever doing any operations which might initialize the USER driver's thread data. Doing it this way also has the advantage that we won't use extra file descriptors.
@ -18,7 +18,7 @@ In any case I haven't bothered to guard this code with do_esync(); it'd require
7 files changed, 20 insertions(+)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 0655ab779..210556fc2 100644
index c53818b5485..5d8dbac2df4 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -74,6 +74,12 @@ int do_esync(void)
@ -35,10 +35,10 @@ index 0655ab779..210556fc2 100644
{
ESYNC_SEMAPHORE = 1,
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 74cebfc42..343ab66a5 100644
index 3e7327211b3..784635a53c8 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1498,6 +1498,8 @@
@@ -1555,6 +1555,8 @@
# All functions must be prefixed with '__wine_' (for internal functions)
# or 'wine_' (for user-visible functions) to avoid namespace conflicts.
@ -48,10 +48,10 @@ index 74cebfc42..343ab66a5 100644
@ cdecl -norelay wine_server_call(ptr)
@ cdecl wine_server_close_fds_by_type(long)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index dad0996c4..e2ef7d9b8 100644
index 98caabbf8e8..8e07b148c88 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -280,6 +280,7 @@ struct debug_info
@@ -270,6 +270,7 @@ struct debug_info
struct ntdll_thread_data
{
struct debug_info *debug_info; /* info for debugstr functions */
@ -60,18 +60,18 @@ index dad0996c4..e2ef7d9b8 100644
int request_fd; /* fd for sending server requests */
int reply_fd; /* fd for receiving server replies */
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index a1ff7c1dd..87134db09 100644
index cbbdafb2e97..688f16eb528 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -326,6 +326,7 @@ void thread_init(void)
@@ -345,6 +345,7 @@ TEB *thread_init(void)
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
+ thread_data->esync_queue_fd = -1;
signal_init_thread( teb );
virtual_init_threading();
@@ -694,6 +695,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
debug_init();
init_paths();
@@ -718,6 +719,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
thread_data->start_stack = (char *)teb->Tib.StackBase;
@ -80,7 +80,7 @@ index a1ff7c1dd..87134db09 100644
pthread_attr_init( &pthread_attr );
pthread_attr_setstack( &pthread_attr, teb->DeallocationStack,
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index eb05aaf28..2fc258dfd 100644
index c1e7b000a8f..d96f001432d 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -364,6 +364,8 @@ jboolean motion_event( JNIEnv *env, jobject obj, jint win, jint action, jint x,
@ -101,10 +101,10 @@ index eb05aaf28..2fc258dfd 100644
{
ERR( "Can't allocate handle for event fd\n" );
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c
index 544d448f9..5dfa54966 100644
index 694a46b11e6..64b8d69b16d 100644
--- a/dlls/winemac.drv/macdrv_main.c
+++ b/dlls/winemac.drv/macdrv_main.c
@@ -321,6 +321,7 @@ void CDECL macdrv_ThreadDetach(void)
@@ -323,6 +323,7 @@ void CDECL macdrv_ThreadDetach(void)
}
}
@ -112,7 +112,7 @@ index 544d448f9..5dfa54966 100644
/***********************************************************************
* set_queue_display_fd
@@ -332,6 +333,8 @@ static void set_queue_display_fd(int fd)
@@ -334,6 +335,8 @@ static void set_queue_display_fd(int fd)
HANDLE handle;
int ret;
@ -122,10 +122,10 @@ index 544d448f9..5dfa54966 100644
{
MESSAGE("macdrv: Can't allocate handle for event queue fd\n");
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 40cd8ca29..18c98e3ec 100644
index 4eaedd1c556..323b71534ac 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -624,6 +624,7 @@ void CDECL X11DRV_ThreadDetach(void)
@@ -643,6 +643,7 @@ void CDECL X11DRV_ThreadDetach(void)
}
}
@ -133,7 +133,7 @@ index 40cd8ca29..18c98e3ec 100644
/* store the display fd into the message queue */
static void set_queue_display_fd( Display *display )
@@ -631,6 +632,8 @@ static void set_queue_display_fd( Display *display )
@@ -650,6 +651,8 @@ static void set_queue_display_fd( Display *display )
HANDLE handle;
int ret;
@ -143,5 +143,5 @@ index 40cd8ca29..18c98e3ec 100644
{
MESSAGE( "x11drv: Can't allocate handle for display fd\n" );
--
2.20.1
2.26.2

View File

@ -1,4 +1,4 @@
From 454430de5505b16af9d90ee99d5fa8a034853d2b Mon Sep 17 00:00:00 2001
From ef25a40d4d6e2676ff66347297f96ca0c7a59460 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 15 Jun 2018 14:12:22 -0500
Subject: [PATCH] server, ntdll: Implement alertable waits.
@ -16,7 +16,7 @@ We do this quite simply by waiting on an extra eventfd descriptor, which the ser
8 files changed, 121 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 119a36f3611..5db7adcace7 100644
index d177bb47989..6f41c5e030b 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -684,19 +684,43 @@ static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end )
@ -196,10 +196,10 @@ index 119a36f3611..5db7adcace7 100644
NTSTATUS esync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable,
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 009cfe73330..d7f88f7f8f0 100644
index 8e07b148c88..8ba11bcf94c 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -261,6 +261,7 @@ struct ntdll_thread_data
@@ -271,6 +271,7 @@ struct ntdll_thread_data
{
struct debug_info *debug_info; /* info for debugstr functions */
int esync_queue_fd;/* fd to wait on for driver events */
@ -208,18 +208,18 @@ index 009cfe73330..d7f88f7f8f0 100644
int request_fd; /* fd for sending server requests */
int reply_fd; /* fd for receiving server replies */
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 97e6d816bdd..129f42b3e01 100644
index 688f16eb528..391c3b62ee3 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -357,6 +357,7 @@ TEB *thread_init(void)
@@ -346,6 +346,7 @@ TEB *thread_init(void)
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
thread_data->esync_queue_fd = -1;
+ thread_data->esync_apc_fd = -1;
signal_init_thread( teb );
virtual_init_threading();
@@ -757,6 +758,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
debug_init();
init_paths();
@@ -720,6 +721,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
thread_data->wait_fd[1] = -1;
thread_data->start_stack = (char *)teb->Tib.StackBase;
thread_data->esync_queue_fd = -1;
@ -284,10 +284,10 @@ index aeb58c5469c..cea025d9308 100644
void esync_clear( int fd );
diff --git a/server/protocol.def b/server/protocol.def
index eca0325e5c5..975802737fa 100644
index 8991462eb45..3955a8bd1c7 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -4083,6 +4083,11 @@ struct handle_info
@@ -4069,6 +4069,11 @@ struct handle_info
unsigned int shm_idx; /* this object's index into the shm section */
@END
@ -300,10 +300,10 @@ index eca0325e5c5..975802737fa 100644
{
ESYNC_SEMAPHORE = 1,
diff --git a/server/thread.c b/server/thread.c
index 7c8b6da8a55..7da1a620ddd 100644
index 9341261b580..5677aa518da 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -188,6 +188,7 @@ static inline void init_thread_structure( struct thread *thread )
@@ -224,6 +224,7 @@ static inline void init_thread_structure( struct thread *thread )
thread->teb = 0;
thread->entry_point = 0;
thread->esync_fd = -1;
@ -311,7 +311,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
thread->debug_ctx = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -297,7 +298,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
@@ -362,7 +363,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
}
if (do_esync())
@ -322,7 +322,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
@@ -1077,8 +1081,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
@@ -1153,8 +1157,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
grab_object( apc );
list_add_tail( queue, &apc->entry );
if (!list_prev( queue, &apc->entry )) /* first one */
@ -336,7 +336,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
return 1;
}
@@ -1124,6 +1133,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
@@ -1200,6 +1209,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
apc = LIST_ENTRY( ptr, struct thread_apc, entry );
list_remove( ptr );
}
@ -348,7 +348,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
}
diff --git a/server/thread.h b/server/thread.h
index 8a737010a5b..53409c11956 100644
index 1b2973cba63..9ed70aee857 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -55,6 +55,7 @@ struct thread
@ -360,5 +360,5 @@ index 8a737010a5b..53409c11956 100644
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
--
2.26.0
2.26.2

View File

@ -1,4 +1,4 @@
From 7e49bdcb1622494a4ca5e5b36f05482189cf151f Mon Sep 17 00:00:00 2001
From 8c3c4edd9393b71f66501a9972ee6e6b4f60aeb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 3 Apr 2017 01:06:26 +0200
Subject: [PATCH] ntdll: Add dummy apiset to PEB.
@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Add dummy apiset to PEB.
create mode 100644 include/apiset.h
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 0f90291e2..c36337a64 100644
index ca8b5e2bf8a..565dea14b39 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -72,6 +72,7 @@ static PEB_LDR_DATA ldr;
@@ -75,6 +75,7 @@ static PEB_LDR_DATA ldr;
static RTL_BITMAP tls_bitmap;
static RTL_BITMAP tls_expansion_bitmap;
static RTL_BITMAP fls_bitmap;
@ -23,19 +23,19 @@ index 0f90291e2..c36337a64 100644
static int nb_threads = 1;
static RTL_CRITICAL_SECTION peb_lock;
@@ -275,6 +276,7 @@ void thread_init(void)
peb = addr;
@@ -300,6 +301,7 @@ TEB *thread_init(void)
teb = virtual_alloc_first_teb();
peb = teb->Peb;
peb->FastPebLock = &peb_lock;
+ peb->ApiSetMap = &apiset_map;
peb->TlsBitmap = &tls_bitmap;
peb->TlsExpansionBitmap = &tls_expansion_bitmap;
peb->FlsBitmap = &fls_bitmap;
diff --git a/include/Makefile.in b/include/Makefile.in
index 2817c10d1..8a4759d17 100644
index 74db5ee1516..f250ea74d4b 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -14,6 +14,7 @@ SOURCES = \
@@ -15,6 +15,7 @@ SOURCES = \
amsi.idl \
amstream.idl \
amvideo.idl \
@ -45,7 +45,7 @@ index 2817c10d1..8a4759d17 100644
appmodel.h \
diff --git a/include/apiset.h b/include/apiset.h
new file mode 100644
index 000000000..6801cd5f5
index 00000000000..6801cd5f509
--- /dev/null
+++ b/include/apiset.h
@@ -0,0 +1,37 @@
@ -87,7 +87,7 @@ index 000000000..6801cd5f5
+
+#endif
diff --git a/include/winternl.h b/include/winternl.h
index 46dac7e48..352d9f64d 100644
index 87d0bde2955..eab44d1a57a 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -23,6 +23,7 @@
@ -98,7 +98,7 @@ index 46dac7e48..352d9f64d 100644
#ifdef __cplusplus
extern "C" {
@@ -286,7 +287,7 @@ typedef struct _PEB
@@ -288,7 +289,7 @@ typedef struct _PEB
ULONG EnvironmentUpdateCount; /* 028/050 */
PVOID KernelCallbackTable; /* 02c/058 */
ULONG Reserved[2]; /* 030/060 */
@ -108,5 +108,5 @@ index 46dac7e48..352d9f64d 100644
PRTL_BITMAP TlsBitmap; /* 040/078 */
ULONG TlsBitmapBits[2]; /* 044/080 */
--
2.20.1
2.26.2

View File

@ -1,4 +1,4 @@
From 0aee0556e8c5eaff0ac15cd2f2a8ba7c234dfe57 Mon Sep 17 00:00:00 2001
From 2c3361713f010ec03423c6eae45bacda5e7e93ac 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
@ -11,19 +11,18 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46568
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 486693f312..81d844ab17 100644
index 0c7d6990b8c..f2e961d31c3 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1278,14 +1278,20 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
@@ -1256,13 +1256,19 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
}
else
{
- size_t view_size = size + mask + 1;
- size_t view_size = size + granularity_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);
@ -36,24 +35,24 @@ index 486693f312..81d844ab17 100644
if (wine_mmap_enum_reserved_areas( alloc_reserved_area_callback, &alloc, top_down ))
{
ptr = alloc.result;
@@ -1295,7 +1301,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
@@ -1272,7 +1278,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 = map_free_area( address_space_start, alloc.limit, size, mask, top_down, VIRTUAL_GetUnixProt(vprot) )))
return STATUS_NO_MEMORY;
@@ -1303,6 +1309,8 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
if (!(ptr = map_free_area( address_space_start, alloc.limit, size,
top_down, VIRTUAL_GetUnixProt(vprot) )))
@@ -1281,6 +1287,8 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
goto done;
}
+ view_size = size + mask + 1;
+ view_size = size + granularity_mask + 1;
+
for (;;)
{
if ((ptr = wine_anon_mmap( NULL, view_size, VIRTUAL_GetUnixProt(vprot), 0 )) == (void *)-1)
--
2.24.1
2.26.2

View File

@ -1,4 +1,4 @@
From c8c6a1025ead2e1befbdccf9a53f8fd4141f8d53 Mon Sep 17 00:00:00 2001
From 3b0d0de794f903da33ce7fb4de545d0305163a31 Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Tue, 14 Jan 2020 21:42:21 +0300
Subject: [PATCH] ntdll: Use free area list for virtual memory allocation.
@ -8,10 +8,10 @@ Subject: [PATCH] ntdll: Use free area list for virtual memory allocation.
1 file changed, 55 insertions(+), 56 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index a262401f58..2951b5b15b 100644
index a4bc4c6ef05..18524fc12de 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -596,60 +596,6 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
@@ -577,59 +577,6 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
return NULL;
}
@ -22,16 +22,15 @@ index a262401f58..2951b5b15b 100644
- * Find a free area between views inside the specified range and map it.
- * The csVirtual section must be held by caller.
- */
-static void *map_free_area( void *base, void *end, size_t size, size_t mask, int top_down,
- int unix_prot )
-static void *map_free_area( void *base, void *end, size_t size, int top_down, int unix_prot )
-{
- struct wine_rb_entry *first = find_view_inside_range( &base, &end, top_down );
- ptrdiff_t step = top_down ? -(mask + 1) : (mask + 1);
- ptrdiff_t step = top_down ? -(granularity_mask + 1) : (granularity_mask + 1);
- void *start;
-
- if (top_down)
- {
- start = ROUND_ADDR( (char *)end - size, mask );
- start = ROUND_ADDR( (char *)end - size, granularity_mask );
- if (start >= end || start < base) return NULL;
-
- while (first)
@ -39,7 +38,7 @@ index a262401f58..2951b5b15b 100644
- struct file_view *view = WINE_RB_ENTRY_VALUE( first, struct file_view, entry );
- if ((start = try_map_free_area( (char *)view->base + view->size, (char *)start + size, step,
- start, size, unix_prot ))) break;
- start = ROUND_ADDR( (char *)view->base - size, mask );
- start = ROUND_ADDR( (char *)view->base - size, granularity_mask );
- /* stop if remaining space is not large enough */
- if (!start || start >= end || start < base) return NULL;
- first = wine_rb_prev( first );
@ -47,7 +46,7 @@ index a262401f58..2951b5b15b 100644
- }
- else
- {
- start = ROUND_ADDR( (char *)base + mask, mask );
- start = ROUND_ADDR( (char *)base + granularity_mask, granularity_mask );
- if (!start || start >= end || (char *)end - (char *)start < size) return NULL;
-
- while (first)
@ -55,7 +54,7 @@ index a262401f58..2951b5b15b 100644
- struct file_view *view = WINE_RB_ENTRY_VALUE( first, struct file_view, entry );
- if ((start = try_map_free_area( start, view->base, step,
- start, size, unix_prot ))) break;
- start = ROUND_ADDR( (char *)view->base + view->size + mask, mask );
- start = ROUND_ADDR( (char *)view->base + view->size + granularity_mask, granularity_mask );
- /* stop if remaining space is not large enough */
- if (!start || start >= end || (char *)end - (char *)start < size) return NULL;
- first = wine_rb_next( first );
@ -72,7 +71,7 @@ index a262401f58..2951b5b15b 100644
/***********************************************************************
* find_reserved_free_area
*
@@ -864,6 +810,7 @@ static struct file_view *alloc_view(void)
@@ -844,6 +791,7 @@ static struct file_view *alloc_view(void)
*/
static void delete_view( struct file_view *view ) /* [in] View */
{
@ -80,7 +79,7 @@ index a262401f58..2951b5b15b 100644
if (!(view->protect & VPROT_SYSTEM)) unmap_area( view->base, view->size );
set_page_vprot( view->base, view->size, 0 );
wine_rb_remove( &views_tree, &view->entry );
@@ -921,6 +868,7 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
@@ -901,6 +849,7 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
TRACE( "forcing exec permission on %p-%p\n", base, (char *)base + size - 1 );
mprotect( base, size, unix_prot | PROT_EXEC );
}
@ -88,7 +87,7 @@ index a262401f58..2951b5b15b 100644
return STATUS_SUCCESS;
}
@@ -1158,6 +1106,7 @@ struct alloc_area
@@ -1137,6 +1086,7 @@ struct alloc_area
int top_down;
void *limit;
void *result;
@ -96,7 +95,7 @@ index a262401f58..2951b5b15b 100644
};
/***********************************************************************
@@ -1199,6 +1148,41 @@ static int alloc_reserved_area_callback( void *start, size_t size, void *arg )
@@ -1178,6 +1128,41 @@ static int alloc_reserved_area_callback( void *start, size_t size, void *arg )
return 0;
}
@ -105,7 +104,7 @@ index a262401f58..2951b5b15b 100644
+ struct alloc_area *alloc = arg;
+ void *end = (char *)base + area_size;
+ size_t size = alloc->size;
+ ptrdiff_t step = alloc->top_down ? -(alloc->mask + 1) : (alloc->mask + 1);
+ ptrdiff_t step = alloc->top_down ? -(granularity_mask + 1) : (granularity_mask + 1);
+ void *start;
+
+ if (base < address_space_start) base = address_space_start;
@ -114,7 +113,7 @@ index a262401f58..2951b5b15b 100644
+
+ if (alloc->top_down)
+ {
+ start = ROUND_ADDR( (char *)end - size, alloc->mask );
+ start = ROUND_ADDR( (char *)end - size, granularity_mask );
+ if (start >= end || start < base)
+ return 0;
+
@ -124,7 +123,7 @@ index a262401f58..2951b5b15b 100644
+ }
+ else
+ {
+ start = ROUND_ADDR( (char *)base + alloc->mask, alloc->mask );
+ start = ROUND_ADDR( (char *)base + granularity_mask, granularity_mask );
+ if (!start || start >= end || (char *)end - (char *)start < size)
+ return 0;
+
@ -138,19 +137,20 @@ index a262401f58..2951b5b15b 100644
/***********************************************************************
* map_fixed_area
*
@@ -1286,6 +1270,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
alloc.mask = mask;
@@ -1263,6 +1248,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
alloc.size = size;
alloc.top_down = top_down;
alloc.limit = (void*)(get_zero_bits_64_mask( zero_bits_64 ) & (UINT_PTR)user_space_limit);
+ alloc.unix_prot = VIRTUAL_GetUnixProt(vprot);
if (is_win64 && !top_down)
{
@@ -1304,9 +1289,11 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
@@ -1281,10 +1267,11 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
if (is_win64 || zero_bits_64)
{
- if (!(ptr = map_free_area( address_space_start, alloc.limit, size, mask, top_down, VIRTUAL_GetUnixProt(vprot) )))
- if (!(ptr = map_free_area( address_space_start, alloc.limit, size,
- top_down, VIRTUAL_GetUnixProt(vprot) )))
+ if (!wine_mmap_enum_free_areas( alloc_free_area_callback, &alloc, top_down ))
return STATUS_NO_MEMORY;
- TRACE( "got mem with map_free_area %p-%p\n", ptr, (char *)ptr + size );
@ -160,7 +160,7 @@ index a262401f58..2951b5b15b 100644
goto done;
}
@@ -1981,6 +1968,12 @@ static int alloc_virtual_heap( void *base, size_t size, void *arg )
@@ -1955,6 +1942,12 @@ static int alloc_virtual_heap( void *base, size_t size, void *arg )
return (alloc->base != (void *)-1);
}
@ -173,7 +173,7 @@ index a262401f58..2951b5b15b 100644
/***********************************************************************
* virtual_init
*/
@@ -2039,6 +2032,9 @@ void virtual_init(void)
@@ -2020,6 +2013,9 @@ void virtual_init(void)
size = (char *)address_space_start - (char *)0x10000;
if (size && wine_mmap_is_in_reserved_area( (void*)0x10000, size ) == 1)
wine_anon_mmap( (void *)0x10000, size, PROT_READ | PROT_WRITE, MAP_FIXED );
@ -183,7 +183,7 @@ index a262401f58..2951b5b15b 100644
}
@@ -2734,6 +2730,9 @@ void virtual_set_large_address_space(void)
@@ -2791,6 +2787,9 @@ void virtual_set_large_address_space(void)
/* no large address space on win9x */
if (NtCurrentTeb()->Peb->OSPlatformId != VER_PLATFORM_WIN32_NT) return;
@ -194,5 +194,5 @@ index a262401f58..2951b5b15b 100644
}
--
2.24.1
2.26.2

View File

@ -1,4 +1,4 @@
From e015956f133594c51f5f1e7baccf3fe56ef7d83f Mon Sep 17 00:00:00 2001
From edf5fb86ff4d075fb48fd562fc0be2140c8e66bb Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Wed, 15 Jan 2020 17:05:09 +0300
Subject: [PATCH] ntdll: Permanently exclude natively mapped areas from free
@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Permanently exclude natively mapped areas from free
1 file changed, 22 insertions(+)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 2951b5b15b..3617dcf348 100644
index 18524fc12de..63a10435890 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -110,6 +110,9 @@ static const BYTE VIRTUAL_Win32Flags[16] =
@@ -111,6 +111,9 @@ static const BYTE VIRTUAL_Win32Flags[16] =
static struct wine_rb_tree views_tree;
@ -22,7 +22,7 @@ index 2951b5b15b..3617dcf348 100644
static RTL_CRITICAL_SECTION csVirtual;
static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
{
@@ -585,6 +588,13 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
@@ -566,6 +569,13 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step,
if (ptr != (void *)-1)
munmap( ptr, size );
@ -36,8 +36,8 @@ index 2951b5b15b..3617dcf348 100644
if ((step > 0 && (char *)end - (char *)start < step) ||
(step < 0 && (char *)start - (char *)base < -step) ||
step == 0)
@@ -1156,6 +1166,8 @@ static int alloc_free_area_callback( void *base, size_t area_size, void *arg )
ptrdiff_t step = alloc->top_down ? -(alloc->mask + 1) : (alloc->mask + 1);
@@ -1136,6 +1146,8 @@ static int alloc_free_area_callback( void *base, size_t area_size, void *arg )
ptrdiff_t step = alloc->top_down ? -(granularity_mask + 1) : (granularity_mask + 1);
void *start;
+ TRACE("base %p, area_size %p, size %p.\n", base, (void *)area_size, (void *)size);
@ -45,7 +45,7 @@ index 2951b5b15b..3617dcf348 100644
if (base < address_space_start) base = address_space_start;
if (is_beyond_limit( base, size, alloc->limit )) end = alloc->limit;
if (base >= end) return 0;
@@ -1287,11 +1299,21 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
@@ -1265,11 +1277,21 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
goto done;
}
@ -68,5 +68,5 @@ index 2951b5b15b..3617dcf348 100644
TRACE( "got mem in free area %p-%p\n", ptr, (char *)ptr + size );
goto done;
--
2.24.1
2.26.2

View File

@ -1,4 +1,4 @@
From f39b7dba77e8991bc586b8102ee232842daa5c91 Mon Sep 17 00:00:00 2001
From bf09af2ce4e625b3dcc7e8072e822100d80fb3e2 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 May 2017 11:17:26 +0200
Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name.
@ -11,10 +11,10 @@ Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name.
4 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 242dbd27b2f..fe8b896682d 100644
index eb7f3bc3718..0412824c811 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2852,7 +2852,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI
@@ -2798,7 +2798,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI
}
/* read the contents of an NT symlink object */
@ -24,22 +24,22 @@ index 242dbd27b2f..fe8b896682d 100644
OBJECT_ATTRIBUTES attr;
UNICODE_STRING targetW;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index a5fe98c8d85..93fd8a9354b 100644
index 76e8ec284e8..1defe6c807a 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -174,6 +174,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
@@ -194,6 +194,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
/* virtual memory */
extern NTSTATUS virtual_alloc_aligned( PVOID *ret, unsigned short zero_bits_64, SIZE_T *size_ptr,
ULONG type, ULONG protect, ULONG alignment ) DECLSPEC_HIDDEN;
extern NTSTATUS virtual_alloc( PVOID *ret, unsigned short zero_bits_64, SIZE_T *size_ptr,
ULONG type, ULONG protect ) DECLSPEC_HIDDEN;
+extern NTSTATUS read_nt_symlink( HANDLE root, UNICODE_STRING *name, WCHAR *target, size_t length ) DECLSPEC_HIDDEN;
extern NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index f49127c3e85..46c070561b0 100644
index 01ae8b06dac..ad5759884da 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -177,6 +177,8 @@ static BYTE **pages_vprot;
@@ -188,6 +188,8 @@ static BYTE **pages_vprot;
static BYTE *pages_vprot;
#endif
@ -48,7 +48,7 @@ index f49127c3e85..46c070561b0 100644
static struct file_view *view_block_start, *view_block_end, *next_free_view;
static const size_t view_block_size = 0x100000;
static void *preload_reserve_start;
@@ -3197,12 +3199,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
@@ -3308,12 +3310,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
MEMORY_SECTION_NAME *info,
SIZE_T len, SIZE_T *res_len )
{
@ -65,7 +65,7 @@ index f49127c3e85..46c070561b0 100644
if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
@@ -3261,14 +3266,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
@@ -3372,14 +3377,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
}
found:
@ -151,5 +151,5 @@ index f6a7b69eca0..a8263a2f44b 100644
SetLastError(0xdeadbeef);
--
2.26.0
2.26.2

View File

@ -1,4 +1,4 @@
From 7564fa0a561d40d940c36485e51dae017d883444 Mon Sep 17 00:00:00 2001
From c6b63b60eabacaff48103e6bde62866190c559f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 5 May 2017 05:40:50 +0200
Subject: [PATCH] ntdll: Create thread to update user_shared_data time values
@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Create thread to update user_shared_data time values
4 files changed, 113 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index b90e1516614..9d363817382 100644
index 1cf82f421a5..ff99791cefe 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3824,6 +3824,36 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
@@ -4047,6 +4047,36 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
}
@ -52,7 +52,7 @@ index b90e1516614..9d363817382 100644
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*
@@ -4445,6 +4475,7 @@ void __wine_process_init(void)
@@ -4694,6 +4724,7 @@ void __wine_process_init(void)
NtTerminateProcess( GetCurrentProcess(), status );
}
@ -61,10 +61,10 @@ index b90e1516614..9d363817382 100644
virtual_set_large_address_space();
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index e8559c040a3..a8253669925 100644
index 7aa678c79d6..1c1d6c67f28 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -200,6 +200,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
@@ -224,6 +224,9 @@ extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
@ -75,7 +75,7 @@ index e8559c040a3..a8253669925 100644
/* completion */
extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue,
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 994bcdb651d..ca01e0df8c2 100644
index 85a03013240..89174717374 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -47,6 +47,7 @@
@ -97,7 +97,7 @@ index 994bcdb651d..ca01e0df8c2 100644
static const WCHAR default_windirW[] = {'C',':','\\','w','i','n','d','o','w','s',0};
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
@@ -290,7 +293,7 @@ TEB *thread_init(void)
@@ -291,7 +294,7 @@ TEB *thread_init(void)
MESSAGE( "wine: failed to map the shared user data: %08x\n", status );
exit(1);
}
@ -105,8 +105,8 @@ index 994bcdb651d..ca01e0df8c2 100644
+ user_shared_data_external = addr;
memcpy( user_shared_data->NtSystemRoot, default_windirW, sizeof(default_windirW) );
/* allocate and initialize the PEB */
@@ -364,18 +367,69 @@ TEB *thread_init(void)
/* allocate and initialize the PEB and initial TEB */
@@ -356,18 +359,69 @@ TEB *thread_init(void)
*/
BYTE* CDECL __wine_user_shared_data(void)
{
@ -183,10 +183,10 @@ index 994bcdb651d..ca01e0df8c2 100644
{
BOOL ret = FALSE;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index cb869feff02..418a1022d19 100644
index 7700385eb7b..865344d91d2 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2102,6 +2102,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2318,6 +2318,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
{
NTSTATUS ret = STATUS_ACCESS_VIOLATION;
void *page = ROUND_ADDR( addr, page_mask );
@ -194,7 +194,7 @@ index cb869feff02..418a1022d19 100644
sigset_t sigset;
BYTE vprot;
@@ -2127,7 +2128,23 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
@@ -2343,7 +2344,23 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
ret = STATUS_SUCCESS;
}
}
@ -219,5 +219,5 @@ index cb869feff02..418a1022d19 100644
}
--
2.17.1
2.26.2

View File

@ -1,4 +1,4 @@
From 06a8dec23dc20dae5ffe9288b7b85301b8118c0f Mon Sep 17 00:00:00 2001
From 48d00ccab7205412a743438ae16fb209de9ff523 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 28 Mar 2020 13:17:25 -0500
Subject: [PATCH] ntdll: Avoid fstatat().
@ -10,10 +10,10 @@ Subject: [PATCH] ntdll: Avoid fstatat().
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 993a661015..a37b287a5a 100644
index d18df38f626..eb33c7f541a 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -219,14 +219,13 @@ static const BOOL is_case_sensitive = FALSE;
@@ -217,14 +217,13 @@ static const BOOL is_case_sensitive = FALSE;
static struct file_identity windir;
@ -30,10 +30,10 @@ index 993a661015..a37b287a5a 100644
/* check if a given Unicode char is OK in a DOS short name */
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index bd27d5a434..5173c203a2 100644
index 9997a5e1cda..5d02f2fb181 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -139,8 +139,24 @@ static inline ULONG get_file_attributes( const struct stat *st )
@@ -138,8 +138,24 @@ static inline ULONG get_file_attributes( const struct stat *st )
static BOOL fd_is_mount_point( int fd, const struct stat *st )
{
struct stat parent;
@ -61,17 +61,17 @@ index bd27d5a434..5173c203a2 100644
/* get the stat info and file attributes for a file (by file descriptor) */
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 20feabf56b..2d98e5eab6 100644
index 76e8ec284e8..b32de1d60e5 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -169,6 +169,7 @@ extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES]
@@ -190,6 +190,7 @@ extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES]
extern NTSTATUS file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name_ret ) DECLSPEC_HIDDEN;
extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name_ret,
UINT disposition ) DECLSPEC_HIDDEN;
+extern RTL_CRITICAL_SECTION dir_section DECLSPEC_HIDDEN;
/* virtual memory */
extern NTSTATUS virtual_alloc_aligned( PVOID *ret, unsigned short zero_bits_64, SIZE_T *size_ptr,
extern NTSTATUS virtual_alloc( PVOID *ret, unsigned short zero_bits_64, SIZE_T *size_ptr,
--
2.25.2
2.26.2

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "cf8a6eb2769d2c4ba5bb837d29db89f6b88706ae"
echo "0c27d244f76ad90301c5db09d738b3a0389bcdac"
}
# Show version information

View File

@ -1,4 +1,4 @@
From 6b8b1869346c8f020fdd940fb18414774e76bc1c Mon Sep 17 00:00:00 2001
From 702145ee9253eb9c92225118830e3d9d999a803a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 18 Mar 2015 23:03:01 +0100
Subject: [PATCH] ntdll: Implement virtual_map_shared_memory.
@ -10,7 +10,7 @@ Preparation for shared memory wineserver communication.
2 files changed, 52 insertions(+)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 3e877593b64..613948c8202 100644
index 76e8ec284e8..7e7ce5413dd 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -204,6 +204,7 @@ extern NTSTATUS virtual_alloc_teb( TEB **teb ) DECLSPEC_HIDDEN;
@ -22,10 +22,10 @@ index 3e877593b64..613948c8202 100644
extern int virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN;
extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 7be00a1ac2e..db88b5b30be 100644
index 7700385eb7b..cf08937cb14 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -3504,6 +3504,57 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
@@ -3551,6 +3551,57 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
}
@ -35,7 +35,7 @@ index 7be00a1ac2e..db88b5b30be 100644
+NTSTATUS virtual_map_shared_memory( int fd, PVOID *addr_ptr, ULONG zero_bits,
+ SIZE_T *size_ptr, ULONG protect )
+{
+ SIZE_T size, mask = get_mask( zero_bits );
+ SIZE_T size;
+ struct file_view *view;
+ unsigned int vprot;
+ sigset_t sigset;
@ -50,7 +50,7 @@ index 7be00a1ac2e..db88b5b30be 100644
+
+ get_vprot_flags( protect, &vprot, FALSE );
+ vprot |= VPROT_COMMITTED;
+ res = map_view( &view, *addr_ptr, size, mask, FALSE, vprot, 0 );
+ res = map_view( &view, *addr_ptr, size, FALSE, vprot, 0 );
+ if (!res)
+ {
+ /* Map the shared memory */