diff --git a/patches/ntdll-unaligned-futex/0001-ntdll-Handle-unaligned-condition-variables-when-usin.patch b/patches/ntdll-unaligned-futex/0001-ntdll-Handle-unaligned-condition-variables-when-usin.patch index bf7b7305..3dded550 100644 --- a/patches/ntdll-unaligned-futex/0001-ntdll-Handle-unaligned-condition-variables-when-usin.patch +++ b/patches/ntdll-unaligned-futex/0001-ntdll-Handle-unaligned-condition-variables-when-usin.patch @@ -1,20 +1,20 @@ -From f48aef32395dee75fff9430fd788262fde5f1e8d Mon Sep 17 00:00:00 2001 +From 7c7d16aa4ee05ed3011ddbda68df2b9696d8da46 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 30 Dec 2019 17:17:47 -0600 -Subject: [PATCH 1/3] ntdll: Handle unaligned condition variables when using +Subject: [PATCH] ntdll: Handle unaligned condition variables when using futexes. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48389 --- - dlls/kernel32/tests/sync.c | 76 ++++++++++++++++----------- - dlls/ntdll/sync.c | 105 ++++++++++++++++++++++++++++++------- - 2 files changed, 132 insertions(+), 49 deletions(-) + dlls/kernel32/tests/sync.c | 76 ++++++++++++++---------- + dlls/ntdll/sync.c | 117 +++++++++++++++++++++++++++++++------ + 2 files changed, 144 insertions(+), 49 deletions(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c -index 9e32312e4d..fb93dfdc53 100644 +index 40cad1c4c50..477a35287d3 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c -@@ -2094,10 +2094,18 @@ static void test_condvars_consumer_producer(void) +@@ -1718,10 +1718,18 @@ static void test_condvars_consumer_producer(void) /* Sample test for some sequence of events happening, sequenced using "condvar_seq" */ static DWORD condvar_seq = 0; @@ -34,7 +34,7 @@ index 9e32312e4d..fb93dfdc53 100644 /* Sequence of wake/sleep to check boundary conditions: * 0: init * 1: producer emits a WakeConditionVariable without consumer waiting. -@@ -2117,28 +2125,31 @@ static SRWLOCK condvar_srwlock; +@@ -1741,28 +1749,31 @@ static SRWLOCK condvar_srwlock; * 12: producer (shared) wakes up consumer (shared) * 13: end */ @@ -72,7 +72,7 @@ index 9e32312e4d..fb93dfdc53 100644 Sleep(50); LeaveCriticalSection (&condvar_crit); -@@ -2148,36 +2159,38 @@ static DWORD WINAPI condvar_base_producer(LPVOID x) { +@@ -1772,36 +1783,38 @@ static DWORD WINAPI condvar_base_producer(LPVOID x) { while (condvar_seq < 9) Sleep(1); pAcquireSRWLockExclusive(&condvar_srwlock); @@ -117,7 +117,7 @@ index 9e32312e4d..fb93dfdc53 100644 LeaveCriticalSection (&condvar_crit); ok (!ret, "SleepConditionVariableCS should return FALSE on out of band wake\n"); ok (GetLastError() == ERROR_TIMEOUT, "SleepConditionVariableCS should return ERROR_TIMEOUT on out of band wake, not %d\n", GetLastError()); -@@ -2187,33 +2200,33 @@ static DWORD WINAPI condvar_base_consumer(LPVOID x) { +@@ -1811,33 +1824,33 @@ static DWORD WINAPI condvar_base_consumer(LPVOID x) { /* wake all was emitted, but we were not sleeping */ EnterCriticalSection (&condvar_crit); @@ -156,7 +156,7 @@ index 9e32312e4d..fb93dfdc53 100644 LeaveCriticalSection (&condvar_crit); ok (ret, "SleepConditionVariableCS should still return TRUE on crit unlock delay\n"); -@@ -2227,25 +2240,25 @@ static DWORD WINAPI condvar_base_consumer(LPVOID x) { +@@ -1851,25 +1864,25 @@ static DWORD WINAPI condvar_base_consumer(LPVOID x) { pAcquireSRWLockExclusive(&condvar_srwlock); condvar_seq = 9; @@ -186,7 +186,7 @@ index 9e32312e4d..fb93dfdc53 100644 pReleaseSRWLockShared(&condvar_srwlock); ok (ret, "pSleepConditionVariableSRW should return TRUE on good wake\n"); -@@ -2253,12 +2266,12 @@ static DWORD WINAPI condvar_base_consumer(LPVOID x) { +@@ -1877,12 +1890,12 @@ static DWORD WINAPI condvar_base_consumer(LPVOID x) { return 0; } @@ -201,7 +201,7 @@ index 9e32312e4d..fb93dfdc53 100644 if (!pInitializeConditionVariable) { /* function is not yet in XP, only in newer Windows */ win_skip("no condition variable support.\n"); -@@ -2271,7 +2284,7 @@ static void test_condvars_base(void) { +@@ -1895,7 +1908,7 @@ static void test_condvars_base(void) { pInitializeSRWLock(&condvar_srwlock); EnterCriticalSection (&condvar_crit); @@ -210,7 +210,7 @@ index 9e32312e4d..fb93dfdc53 100644 LeaveCriticalSection (&condvar_crit); ok (!ret, "SleepConditionVariableCS should return FALSE on untriggered condvar\n"); -@@ -2280,23 +2293,23 @@ static void test_condvars_base(void) { +@@ -1904,23 +1917,23 @@ static void test_condvars_base(void) { if (pInitializeSRWLock) { pAcquireSRWLockExclusive(&condvar_srwlock); @@ -239,7 +239,7 @@ index 9e32312e4d..fb93dfdc53 100644 condvar_seq = 1; /* go */ -@@ -3183,7 +3196,8 @@ START_TEST(sync) +@@ -2728,7 +2741,8 @@ START_TEST(sync) test_WaitForSingleObject(); test_WaitForMultipleObjects(); test_initonce(); @@ -250,10 +250,10 @@ index 9e32312e4d..fb93dfdc53 100644 test_srwlock_base(); test_srwlock_example(); diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c -index ac6c85c556..ac324ebbbe 100644 +index 2b5b6ce44a5..93a947e452a 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c -@@ -117,6 +117,16 @@ static inline int use_futexes(void) +@@ -115,6 +115,16 @@ static inline int use_futexes(void) return supported; } @@ -270,7 +270,7 @@ index ac6c85c556..ac324ebbbe 100644 static void timespec_from_timeout( struct timespec *timespec, const LARGE_INTEGER *timeout ) { LARGE_INTEGER now; -@@ -2236,32 +2246,83 @@ BOOLEAN WINAPI RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock ) +@@ -2179,35 +2189,98 @@ BOOLEAN WINAPI RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock ) } #ifdef __linux__ @@ -361,7 +361,22 @@ index ac6c85c556..ac324ebbbe 100644 return STATUS_SUCCESS; } #else -@@ -2309,9 +2370,11 @@ void WINAPI RtlInitializeConditionVariable( RTL_CONDITION_VARIABLE *variable ) ++static NTSTATUS fast_sleep_srw_cv( RTL_CONDITION_VARIABLE *variable, ++ RTL_SRWLOCK *lock, const LARGE_INTEGER *timeout, ULONG flags ) ++{ ++ return STATUS_NOT_IMPLEMENTED; ++} ++ ++static NTSTATUS fast_sleep_cs_cv( RTL_CONDITION_VARIABLE *variable, ++ RTL_CRITICAL_SECTION *cs, const LARGE_INTEGER *timeout ) ++{ ++ return STATUS_NOT_IMPLEMENTED; ++} ++ + static NTSTATUS fast_wait_cv( RTL_CONDITION_VARIABLE *variable, int val, const LARGE_INTEGER *timeout ) + { + return STATUS_NOT_IMPLEMENTED; +@@ -2252,9 +2325,11 @@ void WINAPI RtlInitializeConditionVariable( RTL_CONDITION_VARIABLE *variable ) */ void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable ) { @@ -374,7 +389,7 @@ index ac6c85c556..ac324ebbbe 100644 } /*********************************************************************** -@@ -2321,9 +2384,11 @@ void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable ) +@@ -2264,9 +2339,11 @@ void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable ) */ void WINAPI RtlWakeAllConditionVariable( RTL_CONDITION_VARIABLE *variable ) { @@ -387,7 +402,7 @@ index ac6c85c556..ac324ebbbe 100644 } /*********************************************************************** -@@ -2345,15 +2410,15 @@ NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, R +@@ -2288,15 +2365,15 @@ NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, R const LARGE_INTEGER *timeout ) { NTSTATUS status; @@ -409,7 +424,7 @@ index ac6c85c556..ac324ebbbe 100644 return status; } -@@ -2380,15 +2445,19 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable, +@@ -2323,15 +2400,19 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable, const LARGE_INTEGER *timeout, ULONG flags ) { NTSTATUS status; @@ -433,5 +448,5 @@ index ac6c85c556..ac324ebbbe 100644 if (flags & RTL_CONDITION_VARIABLE_LOCKMODE_SHARED) RtlAcquireSRWLockShared( lock ); -- -2.24.1 +2.17.1