mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
ntdll-NtAlertThreadByThreadId: Restore the NTDLL_UNIXLIB_VERSION changes.
This commit is contained in:
parent
e83fdffe77
commit
ba02aa0e4d
@ -1,4 +1,4 @@
|
||||
From 62eb66a1663351f80ed81f835d9d21c6f2549443 Mon Sep 17 00:00:00 2001
|
||||
From 9a0cccb7476bf79cb2f5f0bc553c58044526477b Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Mon, 2 Nov 2020 20:24:07 -0600
|
||||
Subject: [PATCH] ntdll: Reimplement Win32 futexes on top of thread-ID alerts.
|
||||
@ -10,14 +10,14 @@ Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
dlls/ntdll/thread.c | 2 +
|
||||
dlls/ntdll/unix/loader.c | 3 -
|
||||
dlls/ntdll/unix/sync.c | 162 ----------------------------------
|
||||
dlls/ntdll/unixlib.h | 4 -
|
||||
6 files changed, 186 insertions(+), 172 deletions(-)
|
||||
dlls/ntdll/unixlib.h | 6 +-
|
||||
6 files changed, 187 insertions(+), 173 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index e0d371e4c54..8fc5e54e4a4 100644
|
||||
index aebea12e6ba..03142ba4bab 100644
|
||||
--- a/dlls/ntdll/ntdll_misc.h
|
||||
+++ b/dlls/ntdll/ntdll_misc.h
|
||||
@@ -90,6 +90,8 @@ extern void init_directories(void) DECLSPEC_HIDDEN;
|
||||
@@ -86,6 +86,8 @@ extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
|
||||
|
||||
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
|
||||
|
||||
@ -27,10 +27,10 @@ index e0d371e4c54..8fc5e54e4a4 100644
|
||||
extern LCID user_lcid, system_lcid;
|
||||
extern DWORD ntdll_umbstowcs( const char* src, DWORD srclen, WCHAR* dst, DWORD dstlen ) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
|
||||
index 8df7015df9f..a1c0b90b366 100644
|
||||
index f1263ae33fd..d652f55b630 100644
|
||||
--- a/dlls/ntdll/sync.c
|
||||
+++ b/dlls/ntdll/sync.c
|
||||
@@ -37,6 +37,13 @@
|
||||
@@ -36,6 +36,13 @@
|
||||
#include "wine/debug.h"
|
||||
#include "ntdll_misc.h"
|
||||
|
||||
@ -44,7 +44,7 @@ index 8df7015df9f..a1c0b90b366 100644
|
||||
|
||||
/******************************************************************
|
||||
* RtlRunOnceInitialize (NTDLL.@)
|
||||
@@ -531,13 +538,143 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
|
||||
@@ -530,13 +537,143 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ index 8df7015df9f..a1c0b90b366 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -545,7 +682,26 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
|
||||
@@ -544,7 +681,26 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
|
||||
*/
|
||||
void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
{
|
||||
@ -217,7 +217,7 @@ index 8df7015df9f..a1c0b90b366 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -553,5 +709,28 @@ void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
@@ -552,5 +708,28 @@ void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
*/
|
||||
void WINAPI RtlWakeAddressSingle( const void *addr )
|
||||
{
|
||||
@ -248,10 +248,10 @@ index 8df7015df9f..a1c0b90b366 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
|
||||
index 425e8770294..bc308e17bee 100644
|
||||
index 25496609f08..4f395336428 100644
|
||||
--- a/dlls/ntdll/thread.c
|
||||
+++ b/dlls/ntdll/thread.c
|
||||
@@ -85,6 +85,8 @@ void WINAPI RtlExitUserThread( ULONG status )
|
||||
@@ -84,6 +84,8 @@ void WINAPI RtlExitUserThread( ULONG status )
|
||||
NtQueryInformationThread( GetCurrentThread(), ThreadAmILastThread, &last, sizeof(last), NULL );
|
||||
if (last) RtlExitUserProcess( status );
|
||||
LdrShutdownThread();
|
||||
@ -261,10 +261,10 @@ index 425e8770294..bc308e17bee 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
|
||||
index 2ee67588df8..465ab427469 100644
|
||||
index df8d99ce489..9e873d655ca 100644
|
||||
--- a/dlls/ntdll/unix/loader.c
|
||||
+++ b/dlls/ntdll/unix/loader.c
|
||||
@@ -1584,9 +1584,6 @@ static struct unix_funcs unix_funcs =
|
||||
@@ -1691,9 +1691,6 @@ static struct unix_funcs unix_funcs =
|
||||
#endif
|
||||
DbgUiIssueRemoteBreakin,
|
||||
RtlGetSystemTimePrecise,
|
||||
@ -275,10 +275,10 @@ index 2ee67588df8..465ab427469 100644
|
||||
fast_RtlpUnWaitCriticalSection,
|
||||
fast_RtlDeleteCriticalSection,
|
||||
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
|
||||
index 86b9b3a4978..0ea8e28613c 100644
|
||||
index f4164b499da..0551682979c 100644
|
||||
--- a/dlls/ntdll/unix/sync.c
|
||||
+++ b/dlls/ntdll/unix/sync.c
|
||||
@@ -78,10 +78,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(sync);
|
||||
@@ -77,10 +77,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(sync);
|
||||
|
||||
HANDLE keyed_event = 0;
|
||||
|
||||
@ -289,7 +289,7 @@ index 86b9b3a4978..0ea8e28613c 100644
|
||||
static const char *debugstr_timeout( const LARGE_INTEGER *timeout )
|
||||
{
|
||||
if (!timeout) return "(infinite)";
|
||||
@@ -191,24 +187,6 @@ static void timespec_from_timeout( struct timespec *timespec, const LARGE_INTEGE
|
||||
@@ -190,24 +186,6 @@ static void timespec_from_timeout( struct timespec *timespec, const LARGE_INTEGE
|
||||
#endif
|
||||
|
||||
|
||||
@ -314,7 +314,7 @@ index 86b9b3a4978..0ea8e28613c 100644
|
||||
/* create a struct security_descriptor and contained information in one contiguous piece of memory */
|
||||
NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
|
||||
data_size_t *ret_len )
|
||||
@@ -2895,71 +2873,6 @@ NTSTATUS CDECL fast_RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable,
|
||||
@@ -2836,71 +2814,6 @@ NTSTATUS CDECL fast_RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable,
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ index 86b9b3a4978..0ea8e28613c 100644
|
||||
#else
|
||||
|
||||
NTSTATUS CDECL fast_RtlTryAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
@@ -3002,79 +2915,4 @@ NTSTATUS CDECL fast_wait_cv( RTL_CONDITION_VARIABLE *variable, const void *value
|
||||
@@ -2943,79 +2856,4 @@ NTSTATUS CDECL fast_wait_cv( RTL_CONDITION_VARIABLE *variable, const void *value
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -467,10 +467,19 @@ index 86b9b3a4978..0ea8e28613c 100644
|
||||
- mutex_unlock( &addr_mutex );
|
||||
-}
|
||||
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
|
||||
index 8dc42320f18..20f9a19ff8d 100644
|
||||
index bd2512030c2..933cd0d33ce 100644
|
||||
--- a/dlls/ntdll/unixlib.h
|
||||
+++ b/dlls/ntdll/unixlib.h
|
||||
@@ -39,10 +39,6 @@ struct unix_funcs
|
||||
@@ -26,7 +26,7 @@
|
||||
struct _DISPATCHER_CONTEXT;
|
||||
|
||||
/* increment this when you change the function table */
|
||||
-#define NTDLL_UNIXLIB_VERSION 113
|
||||
+#define NTDLL_UNIXLIB_VERSION 114
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
@@ -38,10 +38,6 @@ struct unix_funcs
|
||||
/* other Win32 API functions */
|
||||
NTSTATUS (WINAPI *DbgUiIssueRemoteBreakin)( HANDLE process );
|
||||
LONGLONG (WINAPI *RtlGetSystemTimePrecise)(void);
|
||||
@ -482,5 +491,5 @@ index 8dc42320f18..20f9a19ff8d 100644
|
||||
/* fast locks */
|
||||
NTSTATUS (CDECL *fast_RtlpWaitForCriticalSection)( RTL_CRITICAL_SECTION *crit, int timeout );
|
||||
--
|
||||
2.30.0
|
||||
2.20.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 5e83a08f11243c8aeb90ef324ae1564994c4bb73 Mon Sep 17 00:00:00 2001
|
||||
From 66780246e8198c0b83c8955819a8d1a4b497ed8e Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Mon, 31 Aug 2020 23:38:09 -0500
|
||||
Subject: [PATCH] ntdll: Reimplement the critical section fast path on top of
|
||||
@ -10,14 +10,14 @@ Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
dlls/ntdll/unix/loader.c | 3 -
|
||||
dlls/ntdll/unix/sync.c | 109 ---------------------------------
|
||||
dlls/ntdll/unix/unix_private.h | 3 -
|
||||
dlls/ntdll/unixlib.h | 3 -
|
||||
5 files changed, 23 insertions(+), 130 deletions(-)
|
||||
dlls/ntdll/unixlib.h | 5 +-
|
||||
5 files changed, 24 insertions(+), 131 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
|
||||
index 66f807636c7..5bd093e42f5 100644
|
||||
index 09975ac3d45..97a5ce7fffa 100644
|
||||
--- a/dlls/ntdll/sync.c
|
||||
+++ b/dlls/ntdll/sync.c
|
||||
@@ -766,19 +766,26 @@ static inline HANDLE get_semaphore( RTL_CRITICAL_SECTION *crit )
|
||||
@@ -765,19 +765,26 @@ static inline HANDLE get_semaphore( RTL_CRITICAL_SECTION *crit )
|
||||
|
||||
static inline NTSTATUS wait_semaphore( RTL_CRITICAL_SECTION *crit, int timeout )
|
||||
{
|
||||
@ -43,7 +43,7 @@ index 66f807636c7..5bd093e42f5 100644
|
||||
+ {
|
||||
+ static const int zero;
|
||||
+ /* this may wait longer than specified in case of multiple wake-ups */
|
||||
+ if (RtlWaitOnAddress( (int *)&crit->LockSemaphore, &zero, sizeof(int), &time ) == STATUS_TIMEOUT)
|
||||
+ if (RtlWaitOnAddress( lock, &zero, sizeof(int), &time ) == STATUS_TIMEOUT)
|
||||
+ return STATUS_TIMEOUT;
|
||||
+ }
|
||||
+ return STATUS_WAIT_0;
|
||||
@ -52,7 +52,7 @@ index 66f807636c7..5bd093e42f5 100644
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -868,8 +875,6 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit )
|
||||
@@ -867,8 +874,6 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit )
|
||||
RtlFreeHeap( GetProcessHeap(), 0, crit->DebugInfo );
|
||||
crit->DebugInfo = NULL;
|
||||
}
|
||||
@ -61,7 +61,7 @@ index 66f807636c7..5bd093e42f5 100644
|
||||
}
|
||||
else NtClose( crit->LockSemaphore );
|
||||
crit->LockSemaphore = 0;
|
||||
@@ -945,12 +950,18 @@ NTSTATUS WINAPI RtlpUnWaitCriticalSection( RTL_CRITICAL_SECTION *crit )
|
||||
@@ -944,12 +949,18 @@ NTSTATUS WINAPI RtlpUnWaitCriticalSection( RTL_CRITICAL_SECTION *crit )
|
||||
NTSTATUS ret;
|
||||
|
||||
/* debug info is cleared by MakeCriticalSectionGlobal */
|
||||
@ -75,7 +75,7 @@ index 66f807636c7..5bd093e42f5 100644
|
||||
+ else
|
||||
+ {
|
||||
+ int *lock = (int *)&crit->LockSemaphore;
|
||||
+ *lock = 1;
|
||||
+ InterlockedExchange( lock, 1 );
|
||||
+ RtlWakeAddressSingle( lock );
|
||||
+ ret = STATUS_SUCCESS;
|
||||
+ }
|
||||
@ -83,10 +83,10 @@ index 66f807636c7..5bd093e42f5 100644
|
||||
return ret;
|
||||
}
|
||||
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
|
||||
index 465ab427469..2a67f0750a0 100644
|
||||
index 9e873d655ca..d2f8202171c 100644
|
||||
--- a/dlls/ntdll/unix/loader.c
|
||||
+++ b/dlls/ntdll/unix/loader.c
|
||||
@@ -1584,9 +1584,6 @@ static struct unix_funcs unix_funcs =
|
||||
@@ -1691,9 +1691,6 @@ static struct unix_funcs unix_funcs =
|
||||
#endif
|
||||
DbgUiIssueRemoteBreakin,
|
||||
RtlGetSystemTimePrecise,
|
||||
@ -97,10 +97,10 @@ index 465ab427469..2a67f0750a0 100644
|
||||
fast_RtlAcquireSRWLockExclusive,
|
||||
fast_RtlTryAcquireSRWLockShared,
|
||||
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
|
||||
index 0ea8e28613c..8e24d7aecd5 100644
|
||||
index 0551682979c..7b8bbe737f0 100644
|
||||
--- a/dlls/ntdll/unix/sync.c
|
||||
+++ b/dlls/ntdll/unix/sync.c
|
||||
@@ -2468,115 +2468,6 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG
|
||||
@@ -2409,115 +2409,6 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG
|
||||
}
|
||||
|
||||
|
||||
@ -217,10 +217,10 @@ index 0ea8e28613c..8e24d7aecd5 100644
|
||||
|
||||
/* Futex-based SRW lock implementation:
|
||||
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
|
||||
index cfcf99423c3..bf94dddb212 100644
|
||||
index 75a8dc9c85d..3f4b93e42ed 100644
|
||||
--- a/dlls/ntdll/unix/unix_private.h
|
||||
+++ b/dlls/ntdll/unix/unix_private.h
|
||||
@@ -99,9 +99,6 @@ extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULON
|
||||
@@ -94,9 +94,6 @@ extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULON
|
||||
extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
|
||||
extern void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
|
||||
extern void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) DECLSPEC_HIDDEN;
|
||||
@ -231,10 +231,19 @@ index cfcf99423c3..bf94dddb212 100644
|
||||
extern NTSTATUS CDECL fast_RtlAcquireSRWLockExclusive( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL fast_RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
|
||||
index 20f9a19ff8d..a18526de013 100644
|
||||
index 933cd0d33ce..24f5d92b0a8 100644
|
||||
--- a/dlls/ntdll/unixlib.h
|
||||
+++ b/dlls/ntdll/unixlib.h
|
||||
@@ -41,9 +41,6 @@ struct unix_funcs
|
||||
@@ -26,7 +26,7 @@
|
||||
struct _DISPATCHER_CONTEXT;
|
||||
|
||||
/* increment this when you change the function table */
|
||||
-#define NTDLL_UNIXLIB_VERSION 114
|
||||
+#define NTDLL_UNIXLIB_VERSION 115
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
@@ -40,9 +40,6 @@ struct unix_funcs
|
||||
LONGLONG (WINAPI *RtlGetSystemTimePrecise)(void);
|
||||
|
||||
/* fast locks */
|
||||
@ -245,5 +254,5 @@ index 20f9a19ff8d..a18526de013 100644
|
||||
NTSTATUS (CDECL *fast_RtlAcquireSRWLockExclusive)( RTL_SRWLOCK *lock );
|
||||
NTSTATUS (CDECL *fast_RtlTryAcquireSRWLockShared)( RTL_SRWLOCK *lock );
|
||||
--
|
||||
2.30.0
|
||||
2.20.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From cd6c3ffb9903b798c0d1ffc5501c7be5cb0293f9 Mon Sep 17 00:00:00 2001
|
||||
From e2fca35720c0bb5bef7fc4993b163d5c8951530e Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Mon, 31 Aug 2020 23:55:29 -0500
|
||||
Subject: [PATCH] ntdll: Get rid of the direct futex path for condition
|
||||
@ -10,14 +10,14 @@ Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
dlls/ntdll/unix/loader.c | 2 -
|
||||
dlls/ntdll/unix/sync.c | 71 ----------------------------------
|
||||
dlls/ntdll/unix/unix_private.h | 3 --
|
||||
dlls/ntdll/unixlib.h | 3 --
|
||||
5 files changed, 8 insertions(+), 95 deletions(-)
|
||||
dlls/ntdll/unixlib.h | 5 +--
|
||||
5 files changed, 9 insertions(+), 96 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
|
||||
index 5bd093e42f5..42b62a2cd87 100644
|
||||
index 97a5ce7fffa..1e6afc4cfc8 100644
|
||||
--- a/dlls/ntdll/sync.c
|
||||
+++ b/dlls/ntdll/sync.c
|
||||
@@ -450,11 +450,8 @@ void WINAPI RtlInitializeConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
@@ -449,11 +449,8 @@ void WINAPI RtlInitializeConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
*/
|
||||
void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
{
|
||||
@ -31,7 +31,7 @@ index 5bd093e42f5..42b62a2cd87 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -464,11 +461,8 @@ void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
@@ -463,11 +460,8 @@ void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
*/
|
||||
void WINAPI RtlWakeAllConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
{
|
||||
@ -45,7 +45,7 @@ index 5bd093e42f5..42b62a2cd87 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -489,12 +483,11 @@ void WINAPI RtlWakeAllConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
@@ -488,12 +482,11 @@ void WINAPI RtlWakeAllConditionVariable( RTL_CONDITION_VARIABLE *variable )
|
||||
NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, RTL_CRITICAL_SECTION *crit,
|
||||
const LARGE_INTEGER *timeout )
|
||||
{
|
||||
@ -60,7 +60,7 @@ index 5bd093e42f5..42b62a2cd87 100644
|
||||
RtlEnterCriticalSection( crit );
|
||||
return status;
|
||||
}
|
||||
@@ -521,7 +514,7 @@ NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, R
|
||||
@@ -520,7 +513,7 @@ NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, R
|
||||
NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable, RTL_SRWLOCK *lock,
|
||||
const LARGE_INTEGER *timeout, ULONG flags )
|
||||
{
|
||||
@ -69,7 +69,7 @@ index 5bd093e42f5..42b62a2cd87 100644
|
||||
NTSTATUS status;
|
||||
|
||||
if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
|
||||
@@ -529,8 +522,7 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
|
||||
@@ -528,8 +521,7 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
|
||||
else
|
||||
RtlReleaseSRWLockExclusive( lock );
|
||||
|
||||
@ -80,10 +80,10 @@ index 5bd093e42f5..42b62a2cd87 100644
|
||||
if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED)
|
||||
RtlAcquireSRWLockShared( lock );
|
||||
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
|
||||
index 2a67f0750a0..d5e8153b313 100644
|
||||
index d2f8202171c..ab27626fb6f 100644
|
||||
--- a/dlls/ntdll/unix/loader.c
|
||||
+++ b/dlls/ntdll/unix/loader.c
|
||||
@@ -1590,8 +1590,6 @@ static struct unix_funcs unix_funcs =
|
||||
@@ -1697,8 +1697,6 @@ static struct unix_funcs unix_funcs =
|
||||
fast_RtlAcquireSRWLockShared,
|
||||
fast_RtlReleaseSRWLockExclusive,
|
||||
fast_RtlReleaseSRWLockShared,
|
||||
@ -93,10 +93,10 @@ index 2a67f0750a0..d5e8153b313 100644
|
||||
ntdll_ceil,
|
||||
ntdll_cos,
|
||||
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
|
||||
index 8e24d7aecd5..68c2e560938 100644
|
||||
index 7b8bbe737f0..ca18c1a22b1 100644
|
||||
--- a/dlls/ntdll/unix/sync.c
|
||||
+++ b/dlls/ntdll/unix/sync.c
|
||||
@@ -167,23 +167,6 @@ static int *get_futex(void **ptr)
|
||||
@@ -166,23 +166,6 @@ static int *get_futex(void **ptr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ index 8e24d7aecd5..68c2e560938 100644
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2720,50 +2703,6 @@ NTSTATUS CDECL fast_RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
|
||||
@@ -2661,50 +2644,6 @@ NTSTATUS CDECL fast_RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ index 8e24d7aecd5..68c2e560938 100644
|
||||
#else
|
||||
|
||||
NTSTATUS CDECL fast_RtlTryAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
@@ -2796,14 +2735,4 @@ NTSTATUS CDECL fast_RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
|
||||
@@ -2737,14 +2676,4 @@ NTSTATUS CDECL fast_RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -187,10 +187,10 @@ index 8e24d7aecd5..68c2e560938 100644
|
||||
-
|
||||
#endif
|
||||
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
|
||||
index bf94dddb212..f3a85dcd8d4 100644
|
||||
index 3f4b93e42ed..504975538cc 100644
|
||||
--- a/dlls/ntdll/unix/unix_private.h
|
||||
+++ b/dlls/ntdll/unix/unix_private.h
|
||||
@@ -105,10 +105,7 @@ extern NTSTATUS CDECL fast_RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock ) DECLS
|
||||
@@ -100,10 +100,7 @@ extern NTSTATUS CDECL fast_RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock ) DECLS
|
||||
extern NTSTATUS CDECL fast_RtlAcquireSRWLockShared( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL fast_RtlReleaseSRWLockExclusive( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS CDECL fast_RtlReleaseSRWLockShared( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN;
|
||||
@ -202,10 +202,19 @@ index bf94dddb212..f3a85dcd8d4 100644
|
||||
extern USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
|
||||
extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
|
||||
index a18526de013..31f2c3a5cd8 100644
|
||||
index 24f5d92b0a8..246fd44a53e 100644
|
||||
--- a/dlls/ntdll/unixlib.h
|
||||
+++ b/dlls/ntdll/unixlib.h
|
||||
@@ -47,9 +47,6 @@ struct unix_funcs
|
||||
@@ -26,7 +26,7 @@
|
||||
struct _DISPATCHER_CONTEXT;
|
||||
|
||||
/* increment this when you change the function table */
|
||||
-#define NTDLL_UNIXLIB_VERSION 115
|
||||
+#define NTDLL_UNIXLIB_VERSION 116
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
@@ -46,9 +46,6 @@ struct unix_funcs
|
||||
NTSTATUS (CDECL *fast_RtlAcquireSRWLockShared)( RTL_SRWLOCK *lock );
|
||||
NTSTATUS (CDECL *fast_RtlReleaseSRWLockExclusive)( RTL_SRWLOCK *lock );
|
||||
NTSTATUS (CDECL *fast_RtlReleaseSRWLockShared)( RTL_SRWLOCK *lock );
|
||||
@ -216,5 +225,5 @@ index a18526de013..31f2c3a5cd8 100644
|
||||
/* math functions */
|
||||
double (CDECL *atan)( double d );
|
||||
--
|
||||
2.30.0
|
||||
2.20.1
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
From d90049788ebde3f53bb864cdaae25feecc490ad4 Mon Sep 17 00:00:00 2001
|
||||
From 2bc63e7c52262630869ac5a12ecd7225ac533b8d Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Sun, 22 Nov 2020 20:51:10 -0600
|
||||
Subject: [PATCH] ntdll: Reimplement SRW locks on top of Win32 futexes.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/ntdll/sync.c | 312 +++++++++++++++------------------
|
||||
dlls/ntdll/sync.c | 313 +++++++++++++++------------------
|
||||
dlls/ntdll/unix/loader.c | 6 -
|
||||
dlls/ntdll/unix/sync.c | 309 --------------------------------
|
||||
dlls/ntdll/unix/unix_private.h | 6 -
|
||||
dlls/ntdll/unixlib.h | 10 +-
|
||||
5 files changed, 141 insertions(+), 502 deletions(-)
|
||||
5 files changed, 142 insertions(+), 502 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
|
||||
index 225216cbe2a..950a5047752 100644
|
||||
index 1e6afc4cfc8..93a6a5fd7de 100644
|
||||
--- a/dlls/ntdll/sync.c
|
||||
+++ b/dlls/ntdll/sync.c
|
||||
@@ -160,127 +160,23 @@ DWORD WINAPI RtlRunOnceExecuteOnce( RTL_RUN_ONCE *once, PRTL_RUN_ONCE_INIT_FN fu
|
||||
@@ -160,127 +160,24 @@ DWORD WINAPI RtlRunOnceExecuteOnce( RTL_RUN_ONCE *once, PRTL_RUN_ONCE_INIT_FN fu
|
||||
return RtlRunOnceComplete( once, 0, context ? *context : NULL );
|
||||
}
|
||||
|
||||
@ -151,15 +151,16 @@ index 225216cbe2a..950a5047752 100644
|
||||
+ * RtlAcquireSRWLockShared() needs to know the values of "exclusive_waiters"
|
||||
+ * and "owners", but RtlAcquireSRWLockExclusive() only needs to know the
|
||||
+ * value of "owners", so the former can wait on the entire structure, and
|
||||
+ * the latterwaits only on the "owners" member. Note then that "owners" must be
|
||||
+ * not be the first element in the structure. */
|
||||
+ * the latter waits only on the "owners" member. Note then that "owners"
|
||||
+ * must not be the first element in the structure.
|
||||
+ */
|
||||
+ short owners;
|
||||
+};
|
||||
+C_ASSERT( sizeof(struct srw_lock) == 4 );
|
||||
|
||||
/***********************************************************************
|
||||
* RtlInitializeSRWLock (NTDLL.@)
|
||||
@@ -307,11 +203,36 @@ void WINAPI RtlInitializeSRWLock( RTL_SRWLOCK *lock )
|
||||
@@ -307,11 +204,36 @@ void WINAPI RtlInitializeSRWLock( RTL_SRWLOCK *lock )
|
||||
*/
|
||||
void WINAPI RtlAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
{
|
||||
@ -200,7 +201,7 @@ index 225216cbe2a..950a5047752 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -323,34 +244,34 @@ void WINAPI RtlAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
@@ -323,34 +245,34 @@ void WINAPI RtlAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
*/
|
||||
void WINAPI RtlAcquireSRWLockShared( RTL_SRWLOCK *lock )
|
||||
{
|
||||
@ -259,7 +260,7 @@ index 225216cbe2a..950a5047752 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -358,11 +279,23 @@ void WINAPI RtlAcquireSRWLockShared( RTL_SRWLOCK *lock )
|
||||
@@ -358,11 +280,23 @@ void WINAPI RtlAcquireSRWLockShared( RTL_SRWLOCK *lock )
|
||||
*/
|
||||
void WINAPI RtlReleaseSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
{
|
||||
@ -272,11 +273,11 @@ index 225216cbe2a..950a5047752 100644
|
||||
+ {
|
||||
+ old.s = *u.s;
|
||||
+ new = old;
|
||||
+
|
||||
+ if (old.s.owners != -1) ERR("Lock %p is not owned exclusive!\n", lock);
|
||||
|
||||
- srwlock_leave_exclusive( lock, srwlock_unlock_exclusive( (unsigned int *)&lock->Ptr,
|
||||
- - SRWLOCK_RES_EXCLUSIVE ) - SRWLOCK_RES_EXCLUSIVE );
|
||||
+ if (old.s.owners != -1) ERR("Lock %p is not owned exclusive!\n", lock);
|
||||
+
|
||||
+ new.s.owners = 0;
|
||||
+ } while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l);
|
||||
+
|
||||
@ -287,7 +288,7 @@ index 225216cbe2a..950a5047752 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -370,11 +303,22 @@ void WINAPI RtlReleaseSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
@@ -370,11 +304,22 @@ void WINAPI RtlReleaseSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
*/
|
||||
void WINAPI RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
|
||||
{
|
||||
@ -300,12 +301,12 @@ index 225216cbe2a..950a5047752 100644
|
||||
+ {
|
||||
+ old.s = *u.s;
|
||||
+ new = old;
|
||||
+
|
||||
+ if (old.s.owners == -1) ERR("Lock %p is owned exclusive!\n", lock);
|
||||
+ else if (!old.s.owners) ERR("Lock %p is not owned shared!\n", lock);
|
||||
|
||||
- srwlock_leave_shared( lock, srwlock_lock_exclusive( (unsigned int *)&lock->Ptr,
|
||||
- - SRWLOCK_RES_SHARED ) - SRWLOCK_RES_SHARED );
|
||||
+ if (old.s.owners == -1) ERR("Lock %p is owned exclusive!\n", lock);
|
||||
+ else if (!old.s.owners) ERR("Lock %p is not owned shared!\n", lock);
|
||||
+
|
||||
+ --new.s.owners;
|
||||
+ } while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l);
|
||||
+
|
||||
@ -314,7 +315,7 @@ index 225216cbe2a..950a5047752 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -386,13 +330,28 @@ void WINAPI RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
|
||||
@@ -386,13 +331,28 @@ void WINAPI RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
|
||||
*/
|
||||
BOOLEAN WINAPI RtlTryAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
{
|
||||
@ -329,9 +330,7 @@ index 225216cbe2a..950a5047752 100644
|
||||
+ {
|
||||
+ old.s = *u.s;
|
||||
+ new.s = old.s;
|
||||
|
||||
- return InterlockedCompareExchange( (int *)&lock->Ptr, SRWLOCK_MASK_IN_EXCLUSIVE |
|
||||
- SRWLOCK_RES_EXCLUSIVE, 0 ) == 0;
|
||||
+
|
||||
+ if (!old.s.owners)
|
||||
+ {
|
||||
+ /* Not locked exclusive or shared. We can try to grab it. */
|
||||
@ -343,12 +342,14 @@ index 225216cbe2a..950a5047752 100644
|
||||
+ ret = FALSE;
|
||||
+ }
|
||||
+ } while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l);
|
||||
+
|
||||
|
||||
- return InterlockedCompareExchange( (int *)&lock->Ptr, SRWLOCK_MASK_IN_EXCLUSIVE |
|
||||
- SRWLOCK_RES_EXCLUSIVE, 0 ) == 0;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -400,20 +359,29 @@ BOOLEAN WINAPI RtlTryAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
@@ -400,20 +360,29 @@ BOOLEAN WINAPI RtlTryAcquireSRWLockExclusive( RTL_SRWLOCK *lock )
|
||||
*/
|
||||
BOOLEAN WINAPI RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock )
|
||||
{
|
||||
@ -408,7 +409,7 @@ index ab27626fb6f..f98e33b45fb 100644
|
||||
ntdll_ceil,
|
||||
ntdll_cos,
|
||||
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
|
||||
index d4092438644..b67f5fc8f10 100644
|
||||
index ca18c1a22b1..11dd6d65fa0 100644
|
||||
--- a/dlls/ntdll/unix/sync.c
|
||||
+++ b/dlls/ntdll/unix/sync.c
|
||||
@@ -114,8 +114,6 @@ static inline ULONGLONG monotonic_counter(void)
|
||||
@ -746,10 +747,10 @@ index d4092438644..b67f5fc8f10 100644
|
||||
-
|
||||
-#endif
|
||||
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
|
||||
index acbfd6b2a5e..3066dbd325a 100644
|
||||
index 504975538cc..55e91f7a0bd 100644
|
||||
--- a/dlls/ntdll/unix/unix_private.h
|
||||
+++ b/dlls/ntdll/unix/unix_private.h
|
||||
@@ -98,12 +98,6 @@ extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULON
|
||||
@@ -94,12 +94,6 @@ extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULON
|
||||
extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
|
||||
extern void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
|
||||
extern void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) DECLSPEC_HIDDEN;
|
||||
@ -763,15 +764,15 @@ index acbfd6b2a5e..3066dbd325a 100644
|
||||
|
||||
extern USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
|
||||
index 44f0c1aa4ea..9d5aca187fa 100644
|
||||
index 246fd44a53e..8527f44173b 100644
|
||||
--- a/dlls/ntdll/unixlib.h
|
||||
+++ b/dlls/ntdll/unixlib.h
|
||||
@@ -26,7 +26,7 @@
|
||||
struct _DISPATCHER_CONTEXT;
|
||||
|
||||
/* increment this when you change the function table */
|
||||
-#define NTDLL_UNIXLIB_VERSION 113
|
||||
+#define NTDLL_UNIXLIB_VERSION 114
|
||||
-#define NTDLL_UNIXLIB_VERSION 116
|
||||
+#define NTDLL_UNIXLIB_VERSION 117
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user