Rebase against 666f614f3f09211614024f87a238aa49c79f574a.

This commit is contained in:
Alistair Leslie-Hughes 2020-08-27 09:15:54 +10:00
parent c4b73e1752
commit 2b119ef030
6 changed files with 60 additions and 60 deletions

View File

@ -1,4 +1,4 @@
From 44e9e950fc95d382d7a1038743e54d897da94107 Mon Sep 17 00:00:00 2001
From b0225150b6721f7c75124c534b8841aa1a8039bd Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Thu, 23 Apr 2020 14:32:23 +0300
Subject: [PATCH] kernelbase: Maintain FLS storage list in PEB.
@ -73,10 +73,10 @@ index 7501165dc87..2bcc3ee60c4 100644
* FlsFree should fail
* FlsGetValue and FlsSetValue should succeed
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index b91d279e327..924f19703bf 100644
index bd9fe7fecef..79e2736bd9e 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -2445,7 +2445,6 @@ START_TEST(thread)
@@ -2483,7 +2483,6 @@ START_TEST(thread)
}
return;
}
@ -84,7 +84,7 @@ index b91d279e327..924f19703bf 100644
test_thread_info();
test_reserved_tls();
test_CreateRemoteThread();
@@ -2473,6 +2472,5 @@ START_TEST(thread)
@@ -2511,6 +2510,5 @@ START_TEST(thread)
test_thread_fpu_cw();
test_thread_actctx();
test_thread_description();
@ -92,7 +92,7 @@ index b91d279e327..924f19703bf 100644
test_threadpool();
}
diff --git a/dlls/kernelbase/thread.c b/dlls/kernelbase/thread.c
index f20d460d07d..3c77b6a42f4 100644
index f44f2ff6538..3423fe8c727 100644
--- a/dlls/kernelbase/thread.c
+++ b/dlls/kernelbase/thread.c
@@ -38,6 +38,10 @@
@ -106,7 +106,7 @@ index f20d460d07d..3c77b6a42f4 100644
/***********************************************************************
* Threads
@@ -915,6 +919,19 @@ static void init_fiber_context( struct fiber_data *fiber )
@@ -928,6 +932,19 @@ static void init_fiber_context( struct fiber_data *fiber )
#endif
}
@ -126,7 +126,7 @@ index f20d460d07d..3c77b6a42f4 100644
/***********************************************************************
* CreateFiber (kernelbase.@)
@@ -1022,7 +1039,16 @@ void WINAPI DECLSPEC_HOTPATCH DeleteFiber( LPVOID fiber_ptr )
@@ -1035,7 +1052,16 @@ void WINAPI DECLSPEC_HOTPATCH DeleteFiber( LPVOID fiber_ptr )
RtlExitUserThread( 1 );
}
RtlFreeUserStack( fiber->stack_allocation );
@ -144,7 +144,7 @@ index f20d460d07d..3c77b6a42f4 100644
HeapFree( GetProcessHeap(), 0, fiber );
}
@@ -1044,6 +1070,19 @@ void WINAPI DECLSPEC_HOTPATCH SwitchToFiber( LPVOID fiber )
@@ -1057,6 +1083,19 @@ void WINAPI DECLSPEC_HOTPATCH SwitchToFiber( LPVOID fiber )
struct fiber_data *new_fiber = fiber;
struct fiber_data *current_fiber = NtCurrentTeb()->Tib.u.FiberData;
@ -164,7 +164,7 @@ index f20d460d07d..3c77b6a42f4 100644
current_fiber->except = NtCurrentTeb()->Tib.ExceptionList;
current_fiber->stack_limit = NtCurrentTeb()->Tib.StackLimit;
current_fiber->fls_slots = NtCurrentTeb()->FlsSlots;
@@ -1069,9 +1108,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH FlsAlloc( PFLS_CALLBACK_FUNCTION callback )
@@ -1082,9 +1121,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH FlsAlloc( PFLS_CALLBACK_FUNCTION callback )
PEB * const peb = NtCurrentTeb()->Peb;
RtlAcquirePebLock();
@ -175,7 +175,7 @@ index f20d460d07d..3c77b6a42f4 100644
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
index = FLS_OUT_OF_INDEXES;
@@ -1081,9 +1118,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH FlsAlloc( PFLS_CALLBACK_FUNCTION callback )
@@ -1094,9 +1131,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH FlsAlloc( PFLS_CALLBACK_FUNCTION callback )
index = RtlFindClearBitsAndSet( peb->FlsBitmap, 1, 1 );
if (index != ~0U)
{
@ -186,7 +186,7 @@ index f20d460d07d..3c77b6a42f4 100644
{
RtlClearBits( peb->FlsBitmap, index, 1 );
index = FLS_OUT_OF_INDEXES;
@@ -1091,8 +1126,8 @@ DWORD WINAPI DECLSPEC_HOTPATCH FlsAlloc( PFLS_CALLBACK_FUNCTION callback )
@@ -1104,8 +1139,8 @@ DWORD WINAPI DECLSPEC_HOTPATCH FlsAlloc( PFLS_CALLBACK_FUNCTION callback )
}
else
{
@ -197,7 +197,7 @@ index f20d460d07d..3c77b6a42f4 100644
}
}
else SetLastError( ERROR_NO_MORE_ITEMS );
@@ -1116,7 +1151,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlsFree( DWORD index )
@@ -1129,7 +1164,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlsFree( DWORD index )
{
/* FIXME: call Fls callback */
/* FIXME: add equivalent of ThreadZeroTlsCell here */
@ -206,7 +206,7 @@ index f20d460d07d..3c77b6a42f4 100644
}
else SetLastError( ERROR_INVALID_PARAMETER );
RtlReleasePebLock();
@@ -1135,7 +1170,7 @@ PVOID WINAPI DECLSPEC_HOTPATCH FlsGetValue( DWORD index )
@@ -1148,7 +1183,7 @@ PVOID WINAPI DECLSPEC_HOTPATCH FlsGetValue( DWORD index )
return NULL;
}
SetLastError( ERROR_SUCCESS );
@ -215,7 +215,7 @@ index f20d460d07d..3c77b6a42f4 100644
}
@@ -1149,14 +1184,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlsSetValue( DWORD index, PVOID data )
@@ -1162,14 +1197,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlsSetValue( DWORD index, PVOID data )
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
@ -233,10 +233,10 @@ index f20d460d07d..3c77b6a42f4 100644
}
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index efacc0c081e..e61c6e5abc7 100644
index d3ade9555b3..84811217474 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -167,6 +167,15 @@ static RTL_BITMAP tls_bitmap;
@@ -168,6 +168,15 @@ static RTL_BITMAP tls_bitmap;
static RTL_BITMAP tls_expansion_bitmap;
static RTL_BITMAP fls_bitmap;
@ -252,7 +252,7 @@ index efacc0c081e..e61c6e5abc7 100644
static WINE_MODREF *cached_modref;
static WINE_MODREF *current_modref;
static WINE_MODREF *last_failed_modref;
@@ -207,6 +216,16 @@ static RTL_UNLOAD_EVENT_TRACE unload_traces[RTL_UNLOAD_EVENT_TRACE_NUMBER];
@@ -208,6 +217,16 @@ static RTL_UNLOAD_EVENT_TRACE unload_traces[RTL_UNLOAD_EVENT_TRACE_NUMBER];
static RTL_UNLOAD_EVENT_TRACE *unload_trace_ptr;
static unsigned int unload_trace_seq;
@ -269,7 +269,7 @@ index efacc0c081e..e61c6e5abc7 100644
static void module_push_unload_trace( const LDR_DATA_TABLE_ENTRY *ldr )
{
RTL_UNLOAD_EVENT_TRACE *ptr = &unload_traces[unload_trace_seq];
@@ -3201,6 +3220,13 @@ void WINAPI LdrShutdownThread(void)
@@ -3203,6 +3222,13 @@ void WINAPI LdrShutdownThread(void)
/* don't do any detach calls if process is exiting */
if (process_detaching) return;
@ -283,15 +283,15 @@ index efacc0c081e..e61c6e5abc7 100644
RtlEnterCriticalSection( &loader_section );
wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
@@ -3414,6 +3440,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
@@ -3416,6 +3442,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
*/
void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknown3, ULONG_PTR unknown4 )
void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR unknown3, ULONG_PTR unknown4 )
{
+ static const unsigned int fls_slot_count = 8 * sizeof(NtCurrentTeb()->Peb->FlsBitmapBits);
static int attach_done;
int i;
NTSTATUS status;
@@ -3449,6 +3476,25 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow
@@ -3466,6 +3493,25 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
InsertHeadList( &tls_links, &NtCurrentTeb()->TlsLinks );
RtlReleasePebLock();
@ -318,5 +318,5 @@ index efacc0c081e..e61c6e5abc7 100644
{
attach_done = 1;
--
2.27.0
2.28.0

View File

@ -1,4 +1,4 @@
From 9bf96d63c4815fd6f4480102be400517e9c8d387 Mon Sep 17 00:00:00 2001
From 1bf1469697e4e7c6b3f3fd9918584016829aed8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 3 Apr 2017 05:30:27 +0200
Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
@ -10,7 +10,7 @@ Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
3 files changed, 140 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 757a230ae15..466e5a444f4 100644
index 3dee67d5a91..3623d9d99a1 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -30,6 +30,7 @@
@ -21,7 +21,7 @@ index 757a230ae15..466e5a444f4 100644
#include "wine/test.h"
#include "delayloadhandler.h"
@@ -3970,6 +3971,79 @@ static void test_LoadPackagedLibrary(void)
@@ -3957,6 +3958,79 @@ static void test_LoadPackagedLibrary(void)
h, GetLastError());
}
@ -101,7 +101,7 @@ index 757a230ae15..466e5a444f4 100644
START_TEST(loader)
{
int argc;
@@ -4042,6 +4116,7 @@ START_TEST(loader)
@@ -4029,6 +4103,7 @@ START_TEST(loader)
test_InMemoryOrderModuleList();
test_LoadPackagedLibrary();
test_wow64_redirection();
@ -110,10 +110,10 @@ index 757a230ae15..466e5a444f4 100644
test_dll_file( "kernel32.dll", TRUE );
test_dll_file( "advapi32.dll", TRUE );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 6290cbcb4e6..9953746bdaa 100644
index 2f110b23452..ee9b3b1c3ca 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -118,6 +118,9 @@ struct file_id
@@ -122,6 +122,9 @@ struct file_id
BYTE ObjectId[16];
};
@ -123,7 +123,7 @@ index 6290cbcb4e6..9953746bdaa 100644
/* internal representation of loaded modules */
typedef struct _wine_modref
{
@@ -457,6 +460,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
@@ -481,6 +484,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
}
}
@ -176,7 +176,7 @@ index 6290cbcb4e6..9953746bdaa 100644
/*************************************************************************
* get_modref
*
@@ -1198,7 +1247,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
@@ -1222,7 +1271,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
&wm->ldr.InLoadOrderLinks);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
&wm->ldr.InMemoryOrderLinks);
@ -189,7 +189,7 @@ index 6290cbcb4e6..9953746bdaa 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -1903,6 +1957,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
@@ -1953,6 +2007,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@ -197,7 +197,7 @@ index 6290cbcb4e6..9953746bdaa 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3239,6 +3294,7 @@ static void free_modref( WINE_MODREF *wm )
@@ -3303,6 +3358,7 @@ static void free_modref( WINE_MODREF *wm )
{
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@ -205,7 +205,7 @@ index 6290cbcb4e6..9953746bdaa 100644
if (wm->ldr.InInitializationOrderLinks.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderLinks);
@@ -3908,6 +3964,7 @@ void __wine_process_init(void)
@@ -4007,6 +4063,7 @@ static void process_init(void)
INITIAL_TEB stack;
TEB *teb = NtCurrentTeb();
PEB *peb = teb->Peb;
@ -213,7 +213,7 @@ index 6290cbcb4e6..9953746bdaa 100644
peb->LdrData = &ldr;
peb->FastPebLock = &peb_lock;
@@ -3946,6 +4003,10 @@ void __wine_process_init(void)
@@ -4046,6 +4103,10 @@ static void process_init(void)
load_global_options();
version_init();
@ -223,22 +223,22 @@ index 6290cbcb4e6..9953746bdaa 100644
+
/* setup the load callback and create ntdll modref */
RtlInitUnicodeString( &nt_name, ntdllW );
NtQueryVirtualMemory( GetCurrentProcess(), __wine_process_init, MemoryBasicInformation,
@@ -4032,6 +4093,9 @@ void __wine_process_init(void)
NtQueryVirtualMemory( GetCurrentProcess(), process_init, MemoryBasicInformation,
@@ -4131,6 +4192,9 @@ static void process_init(void)
teb->Tib.StackBase = stack.StackBase;
teb->Tib.StackLimit = stack.StackLimit;
teb->DeallocationStack = stack.DeallocationStack;
+
+ /* the windows version was not set yet when ntdll and kernel32 were loaded */
+ recompute_hash_map();
+
unix_funcs->server_init_process_done( kernel32_start_process );
}
/***********************************************************************
diff --git a/include/winternl.h b/include/winternl.h
index 8efdaf31193..2ed26e397c4 100644
index dceed34340a..dca18cab8ff 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2672,8 +2672,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY
@@ -2679,8 +2679,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;
@ -249,5 +249,5 @@ index 8efdaf31193..2ed26e397c4 100644
HANDLE ActivationContext;
void* Lock;
--
2.27.0
2.28.0

View File

@ -1,4 +1,4 @@
From f8c60f99727799ff3d5910e99155db0a356e4d77 Mon Sep 17 00:00:00 2001
From c9d1b1c5498a893ed99803dbcead591ff3f9e953 Mon Sep 17 00:00:00 2001
From: Martin Storsjo <martin@martin.st>
Date: Wed, 16 Aug 2017 23:48:40 +0300
Subject: [PATCH] ntdll: Always restore TEB to x18 on aarch 64 on return from
@ -20,12 +20,12 @@ Signed-off-by: Martin Storsjo <martin@martin.st>
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 42cdc628021..7b92330e874 100644
index cec8e114e14..d09948c51aa 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1924,7 +1924,13 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
@@ -2135,7 +2135,13 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
if (image_info->image_flags & IMAGE_FLAGS_WineBuiltin)
if (image_info->u.ImageFlags & IMAGE_FLAGS_WineBuiltin)
{
- if (TRACE_ON(relay)) RELAY_SetupDLL( *module );
+#ifdef __aarch64__
@ -39,10 +39,10 @@ index 42cdc628021..7b92330e874 100644
else
{
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index acccf088811..35dd4161d8b 100644
index e1596312491..63ae0d8ec41 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -705,8 +705,12 @@ static LONGLONG WINAPI relay_call( struct relay_descr *descr, unsigned int idx,
@@ -702,8 +702,12 @@ static LONGLONG WINAPI relay_call( struct relay_descr *descr, unsigned int idx,
{
unsigned int nb_args;
void *func = relay_trace_entry( descr, idx, stack, &nb_args );
@ -56,5 +56,5 @@ index acccf088811..35dd4161d8b 100644
}
--
2.27.0
2.28.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "a53288e8c95d59b03eefe10f4963b555b04426aa"
echo "666f614f3f09211614024f87a238aa49c79f574a"
}
# Show version information

View File

@ -1,4 +1,4 @@
From 7b7d57b72af6bdc18e8aa18be772512501c378bb Mon Sep 17 00:00:00 2001
From d104c248c1ebdb642f7093e039f5a33c6d4beee0 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 8 Aug 2018 20:00:15 -0500
Subject: [PATCH] ntdll: Add a stub implementation of Wow64Transition.
@ -9,27 +9,27 @@ Subject: [PATCH] ntdll: Add a stub implementation of Wow64Transition.
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 54d56f4e148..d45d4ea6751 100644
index d09948c51aa..871e58b0b52 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3887,6 +3887,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
@@ -4145,6 +4145,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
return TRUE;
}
+void *Wow64Transition;
/***********************************************************************
* __wine_process_init
@@ -3901,7 +3902,7 @@ void __wine_process_init(void)
* process_init
@@ -4158,7 +4159,7 @@ static void process_init(void)
's','y','s','t','e','m','3','2','\\',
'k','e','r','n','e','l','3','2','.','d','l','l',0};
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
RTL_USER_PROCESS_PARAMETERS *params;
- WINE_MODREF *wm;
+ WINE_MODREF *wm, *wow64cpu_wm;
NTSTATUS status;
ANSI_STRING func_name;
UNICODE_STRING nt_name;
@@ -3960,6 +3961,13 @@ void __wine_process_init(void)
@@ -4223,6 +4224,13 @@ static void process_init(void)
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
NtTerminateProcess( GetCurrentProcess(), status );
}
@ -44,10 +44,10 @@ index 54d56f4e148..d45d4ea6751 100644
if ((status = LdrGetProcedureAddress( wm->ldr.DllBase, &func_name,
0, (void **)&kernel32_start_process )) != STATUS_SUCCESS)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 9981c57bd7d..0a6959aee90 100644
index 9acacaa149a..12eca16c31a 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1113,6 +1113,7 @@
@@ -1114,6 +1114,7 @@
@ stdcall WinSqmIsOptedIn()
@ stdcall WinSqmSetDWORD(ptr long long)
@ stdcall WinSqmStartSession(ptr long long)

View File

@ -1 +1 @@
a53288e8c95d59b03eefe10f4963b555b04426aa
666f614f3f09211614024f87a238aa49c79f574a