diff --git a/patches/ntdll-NtAlertThreadByThreadId/0009-ntdll-Reimplement-the-critical-section-fast-path-on-.patch b/patches/ntdll-NtAlertThreadByThreadId/0009-ntdll-Reimplement-the-critical-section-fast-path-on-.patch index 00083732..7ec7a71d 100644 --- a/patches/ntdll-NtAlertThreadByThreadId/0009-ntdll-Reimplement-the-critical-section-fast-path-on-.patch +++ b/patches/ntdll-NtAlertThreadByThreadId/0009-ntdll-Reimplement-the-critical-section-fast-path-on-.patch @@ -1,4 +1,4 @@ -From 92401268a87c4b5dd5dcb029303ced740b019a59 Mon Sep 17 00:00:00 2001 +From 7dccf4db15b800a7781fea24b357b5c804802993 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 31 Aug 2020 23:38:09 -0500 Subject: [PATCH] ntdll: Reimplement the critical section fast path on top of @@ -83,10 +83,10 @@ index c73fb09da47..6edf104c5e9 100644 return ret; } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c -index 6626e02139b..1fb2d79dc8e 100644 +index e9942c0ceeb..5abdc1dc545 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c -@@ -1811,9 +1811,6 @@ static struct unix_funcs unix_funcs = +@@ -1822,9 +1822,6 @@ static struct unix_funcs unix_funcs = #endif DbgUiIssueRemoteBreakin, RtlGetSystemTimePrecise, @@ -97,10 +97,10 @@ index 6626e02139b..1fb2d79dc8e 100644 fast_RtlAcquireSRWLockExclusive, fast_RtlTryAcquireSRWLockShared, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c -index d8663e47ee6..302698dc5b6 100644 +index 5e49593fa4a..84f7c937be3 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c -@@ -2497,115 +2497,6 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG +@@ -2553,115 +2553,6 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG #endif @@ -217,13 +217,13 @@ index d8663e47ee6..302698dc5b6 100644 /* Futex-based SRW lock implementation: diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 15a4387bdc0..bac75ac2d13 100644 +index a721a29dc5a..c9793da8ec1 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -97,9 +97,6 @@ extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULON - extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN; +@@ -104,9 +104,6 @@ extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) 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; + extern void (WINAPI *p__wine_ctrl_routine)(void *) DECLSPEC_HIDDEN; -extern NTSTATUS CDECL fast_RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit, int timeout ) DECLSPEC_HIDDEN; -extern NTSTATUS CDECL fast_RtlpUnWaitCriticalSection( RTL_CRITICAL_SECTION *crit ) DECLSPEC_HIDDEN; -extern NTSTATUS CDECL fast_RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit ) DECLSPEC_HIDDEN; diff --git a/patches/ntdll-NtAlertThreadByThreadId/0011-ntdll-Reimplement-SRW-locks-on-top-of-Win32-futexes.patch b/patches/ntdll-NtAlertThreadByThreadId/0011-ntdll-Reimplement-SRW-locks-on-top-of-Win32-futexes.patch index cece9ee2..1050dcec 100644 --- a/patches/ntdll-NtAlertThreadByThreadId/0011-ntdll-Reimplement-SRW-locks-on-top-of-Win32-futexes.patch +++ b/patches/ntdll-NtAlertThreadByThreadId/0011-ntdll-Reimplement-SRW-locks-on-top-of-Win32-futexes.patch @@ -1,4 +1,4 @@ -From ef3f578935c35d108f1f44506a27c64741f30d12 Mon Sep 17 00:00:00 2001 +From 79a9bdf605de59b3f1800ef577327af6fa565b62 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 22 Nov 2020 20:51:10 -0600 Subject: [PATCH] ntdll: Reimplement SRW locks on top of Win32 futexes. @@ -74,15 +74,13 @@ index 4b92379a0ff..2edc9f8d558 100644 -#endif - -static inline void srwlock_check_invalid( unsigned int val ) -+struct srw_lock - { +-{ - /* Throw exception if it's impossible to acquire/release this lock. */ - if ((val & SRWLOCK_MASK_EXCLUSIVE_QUEUE) == SRWLOCK_MASK_EXCLUSIVE_QUEUE || - (val & SRWLOCK_MASK_SHARED_QUEUE) == SRWLOCK_MASK_SHARED_QUEUE) - RtlRaiseStatus(STATUS_RESOURCE_NOT_OWNED); -} -+ short exclusive_waiters; - +- -static inline unsigned int srwlock_lock_exclusive( unsigned int *dest, int incr ) -{ - unsigned int val, tmp; @@ -122,7 +120,8 @@ index 4b92379a0ff..2edc9f8d558 100644 -} - -static inline void srwlock_leave_exclusive( RTL_SRWLOCK *lock, unsigned int val ) --{ ++struct srw_lock + { - /* Used when a thread leaves an exclusive section. If there are other - * exclusive access threads they are processed first, followed by - * the shared waiters. */ @@ -135,7 +134,8 @@ index 4b92379a0ff..2edc9f8d558 100644 - NtReleaseKeyedEvent( 0, srwlock_key_shared(lock), FALSE, NULL ); - } -} -- ++ short exclusive_waiters; + -static inline void srwlock_leave_shared( RTL_SRWLOCK *lock, unsigned int val ) -{ - /* Wake up one exclusive thread as soon as the last shared access thread @@ -167,9 +167,7 @@ index 4b92379a0ff..2edc9f8d558 100644 - if (unix_funcs->fast_RtlAcquireSRWLockExclusive( lock ) != STATUS_NOT_IMPLEMENTED) - return; + union { RTL_SRWLOCK *rtl; struct srw_lock *s; LONG *l; } u = { lock }; - -- if (srwlock_lock_exclusive( (unsigned int *)&lock->Ptr, SRWLOCK_RES_EXCLUSIVE )) -- NtWaitForKeyedEvent( 0, srwlock_key_exclusive(lock), FALSE, NULL ); ++ + InterlockedIncrement16( &u.s->exclusive_waiters ); + + for (;;) @@ -194,7 +192,9 @@ index 4b92379a0ff..2edc9f8d558 100644 + wait = TRUE; + } + } while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l); -+ + +- if (srwlock_lock_exclusive( (unsigned int *)&lock->Ptr, SRWLOCK_RES_EXCLUSIVE )) +- NtWaitForKeyedEvent( 0, srwlock_key_exclusive(lock), FALSE, NULL ); + if (!wait) return; + RtlWaitOnAddress( &u.s->owners, &new.s.owners, sizeof(short), NULL ); + } @@ -206,11 +206,11 @@ index 4b92379a0ff..2edc9f8d558 100644 void WINAPI RtlAcquireSRWLockShared( RTL_SRWLOCK *lock ) { - unsigned int val, tmp; -+ union { RTL_SRWLOCK *rtl; struct srw_lock *s; LONG *l; } u = { lock }; - +- - if (unix_funcs->fast_RtlAcquireSRWLockShared( lock ) != STATUS_NOT_IMPLEMENTED) - return; -- ++ union { RTL_SRWLOCK *rtl; struct srw_lock *s; LONG *l; } u = { lock }; + - /* Acquires a shared lock. If it's currently not possible to add elements to - * the shared queue, then request exclusive access instead. */ - for (val = *(unsigned int *)&lock->Ptr;; val = tmp) @@ -268,16 +268,16 @@ index 4b92379a0ff..2edc9f8d558 100644 - return; + union { RTL_SRWLOCK *rtl; struct srw_lock *s; LONG *l; } u = { lock }; + union { struct srw_lock s; LONG l; } old, new; - -- srwlock_leave_exclusive( lock, srwlock_unlock_exclusive( (unsigned int *)&lock->Ptr, -- - SRWLOCK_RES_EXCLUSIVE ) - SRWLOCK_RES_EXCLUSIVE ); ++ + do + { + 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 ); + new.s.owners = 0; + } while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l); + @@ -296,9 +296,7 @@ index 4b92379a0ff..2edc9f8d558 100644 - return; + union { RTL_SRWLOCK *rtl; struct srw_lock *s; LONG *l; } u = { lock }; + union { struct srw_lock s; LONG l; } old, new; - -- srwlock_leave_shared( lock, srwlock_lock_exclusive( (unsigned int *)&lock->Ptr, -- - SRWLOCK_RES_SHARED ) - SRWLOCK_RES_SHARED ); ++ + do + { + old.s = *u.s; @@ -306,7 +304,9 @@ index 4b92379a0ff..2edc9f8d558 100644 + + 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 ); + --new.s.owners; + } while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l); + @@ -392,10 +392,10 @@ index 4b92379a0ff..2edc9f8d558 100644 /*********************************************************************** diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c -index 73f22b83b3d..09e8c849ac4 100644 +index e40bff5ba3e..d88be456bff 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c -@@ -1811,12 +1811,6 @@ static struct unix_funcs unix_funcs = +@@ -1822,12 +1822,6 @@ static struct unix_funcs unix_funcs = #endif DbgUiIssueRemoteBreakin, RtlGetSystemTimePrecise, @@ -409,10 +409,10 @@ index 73f22b83b3d..09e8c849ac4 100644 ntdll_ceil, ntdll_cos, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c -index 45472a72ed8..1e790962425 100644 +index 45b0b03bda0..82094813570 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c -@@ -117,8 +117,6 @@ static inline ULONGLONG monotonic_counter(void) +@@ -118,8 +118,6 @@ static inline ULONGLONG monotonic_counter(void) #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -421,7 +421,7 @@ index 45472a72ed8..1e790962425 100644 static int futex_private = 128; -@@ -132,16 +130,6 @@ static inline int futex_wake( const int *addr, int val ) +@@ -133,16 +131,6 @@ static inline int futex_wake( const int *addr, int val ) return syscall( __NR_futex, addr, FUTEX_WAKE | futex_private, val, NULL, 0, 0 ); } @@ -438,7 +438,7 @@ index 45472a72ed8..1e790962425 100644 static inline int use_futexes(void) { static int supported = -1; -@@ -159,16 +147,6 @@ static inline int use_futexes(void) +@@ -160,16 +148,6 @@ static inline int use_futexes(void) return supported; } @@ -455,7 +455,7 @@ index 45472a72ed8..1e790962425 100644 #endif -@@ -2479,289 +2457,3 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG +@@ -2535,289 +2513,3 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG } #endif @@ -746,13 +746,13 @@ index 45472a72ed8..1e790962425 100644 - -#endif diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 07ce95230f1..a0375afebf1 100644 +index f17d527b2ed..541d395a615 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -97,12 +97,6 @@ extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULON - extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN; +@@ -104,12 +104,6 @@ extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) 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; + extern void (WINAPI *p__wine_ctrl_routine)(void *) DECLSPEC_HIDDEN; -extern NTSTATUS CDECL fast_RtlTryAcquireSRWLockExclusive( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN; -extern NTSTATUS CDECL fast_RtlAcquireSRWLockExclusive( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN; -extern NTSTATUS CDECL fast_RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock ) DECLSPEC_HIDDEN; diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index aff77dab..bfe521d9 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "aadcff491fc9d823a90cee567c8e1d55cd9a589b" + echo "2a505efb1ca14f33503657eb070de6edd484b4f3" } # Show version information diff --git a/patches/winex11-key_translation/0001-winex11-Match-keyboard-in-Unicode.patch b/patches/winex11-key_translation/0001-winex11-Match-keyboard-in-Unicode.patch index f413c8e7..28eb253b 100644 --- a/patches/winex11-key_translation/0001-winex11-Match-keyboard-in-Unicode.patch +++ b/patches/winex11-key_translation/0001-winex11-Match-keyboard-in-Unicode.patch @@ -1,14 +1,14 @@ -From 298b86133dd143722c0395474c0a98e89c0af937 Mon Sep 17 00:00:00 2001 +From b3e883936f94d291de16a551df25ebaa544fd22d Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Tue, 11 Dec 2018 08:30:41 +1100 Subject: [PATCH] winex11: Match keyboard in Unicode --- - dlls/winex11.drv/keyboard.c | 163 ++++++++++++++++++++++-------------- - 1 file changed, 98 insertions(+), 65 deletions(-) + dlls/winex11.drv/keyboard.c | 161 ++++++++++++++++++++++-------------- + 1 file changed, 97 insertions(+), 64 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c -index 37c96c926f4..95cb4100bc9 100644 +index 4db0dafb4ee..cba0dd44736 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -37,6 +37,7 @@ @@ -65,13 +65,11 @@ index 37c96c926f4..95cb4100bc9 100644 /********************************************************************** * X11DRV_KEYBOARD_DetectLayout * -@@ -1433,8 +1464,8 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) - KeySym keysym = 0; +@@ -1434,7 +1465,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) const char (*lkey)[MAIN_LEN][4]; unsigned max_seq = 0; -- int max_score = 0, ismatch = 0; + int max_score = INT_MIN, ismatch = 0; - char ckey[256][4]; -+ int max_score = INT_MIN, ismatch = 0; + WCHAR ckey[256][4]; syms = keysyms_per_keycode; @@ -145,12 +143,12 @@ index 37c96c926f4..95cb4100bc9 100644 - char str[5]; - for (i = 0; i < 4; i++) str[i] = ckey[keyc][i] ? ckey[keyc][i] : ' '; - str[4] = 0; -- TRACE_(key)("mismatch for keycode %u, got %s\n", keyc, str); +- TRACE_(key)("mismatch for keycode %u, got %s\n", keyc, debugstr_a(str)); + TRACE_(key)("mismatch for keycode %u, got %s\n", keyc, debugstr_wn(ckey[keyc], 4)); mismatch++; score -= syms; } -@@ -1613,9 +1633,11 @@ void X11DRV_InitKeyboard( Display *display ) +@@ -1576,9 +1596,11 @@ void X11DRV_InitKeyboard( Display *display ) XKeyEvent e2; WORD scan, vkey; int keyc, i, keyn, syms; @@ -163,7 +161,7 @@ index 37c96c926f4..95cb4100bc9 100644 /* Ranges of OEM, function key, and character virtual key codes. * Don't include those handled specially in X11DRV_ToUnicodeEx and -@@ -1672,7 +1694,11 @@ void X11DRV_InitKeyboard( Display *display ) +@@ -1633,7 +1655,11 @@ void X11DRV_InitKeyboard( Display *display ) /* Detect the keyboard layout */ X11DRV_KEYBOARD_DetectLayout( display ); lkey = main_key_tab[kbd_layout].key; @@ -175,7 +173,7 @@ index 37c96c926f4..95cb4100bc9 100644 /* Now build two conversion arrays : * keycode -> vkey + scancode + extended -@@ -1713,26 +1739,14 @@ void X11DRV_InitKeyboard( Display *display ) +@@ -1674,26 +1700,14 @@ void X11DRV_InitKeyboard( Display *display ) int maxlen=0,maxval=-1,ok; for (i=0; imaxlen)) { maxlen=i; maxval=keyn; -@@ -2350,7 +2364,7 @@ INT CDECL X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize) +@@ -2256,7 +2270,7 @@ INT CDECL X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize) /*********************************************************************** * X11DRV_KEYBOARD_MapDeadKeysym */ @@ -216,7 +214,7 @@ index 37c96c926f4..95cb4100bc9 100644 { switch (keysym) { -@@ -2360,65 +2374,84 @@ static char KEYBOARD_MapDeadKeysym(KeySym keysym) +@@ -2266,65 +2280,84 @@ static char KEYBOARD_MapDeadKeysym(KeySym keysym) #endif case 0x1000FE7E : /* Xfree's XK_Dtilde */ return '~'; /* '? */ @@ -316,7 +314,7 @@ index 37c96c926f4..95cb4100bc9 100644 */ } TRACE("no character for dead keysym 0x%08lx\n",keysym); -@@ -2603,7 +2636,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState +@@ -2509,7 +2542,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState if (ret == 0) { @@ -325,7 +323,7 @@ index 37c96c926f4..95cb4100bc9 100644 #ifdef XK_EuroSign /* An ugly hack for EuroSign: X can't translate it to a character -@@ -2627,7 +2660,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState +@@ -2533,7 +2566,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState dead_char = KEYBOARD_MapDeadKeysym(keysym); if (dead_char) { @@ -335,5 +333,5 @@ index 37c96c926f4..95cb4100bc9 100644 goto found; } -- -2.24.1 +2.30.2 diff --git a/staging/upstream-commit b/staging/upstream-commit index ad2f38d4..71d602e6 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -649385e7d47091fa25b9114668075b06d2942e2f +2a505efb1ca14f33503657eb070de6edd484b4f3