Module: wine Branch: master Commit: 3062191bf829bca18f4b6fd204a2ccf37c3e51b7 URL: https://gitlab.winehq.org/wine/wine/-/commit/3062191bf829bca18f4b6fd204a2ccf...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jul 5 13:22:15 2024 +0200
wow64: Add more cross-process notifications.
---
dlls/wow64/syscall.c | 20 +++++++++++++++----- dlls/wow64/virtual.c | 2 +- dlls/wow64/wow64_private.h | 3 ++- include/winternl.h | 2 ++ 4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index d5feb6f17c4..5c2e9012d57 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -104,7 +104,8 @@ static void (WINAPI *pBTCpuThreadInit)(void); static void (WINAPI *pBTCpuSimulate)(void) __attribute__((used)); static void * (WINAPI *p__wine_get_unix_opcode)(void); static void * (WINAPI *pKiRaiseUserExceptionDispatcher)(void); -void (WINAPI *pBTCpuNotifyFlushInstructionCache2)( const void *, SIZE_T ) = NULL; +void (WINAPI *pBTCpuFlushInstructionCache2)( const void *, SIZE_T ) = NULL; +void (WINAPI *pBTCpuFlushInstructionCacheHeavy)( const void *, SIZE_T ) = NULL; void (WINAPI *pBTCpuNotifyMapViewOfSection)( void * ) = NULL; void (WINAPI *pBTCpuNotifyMemoryAlloc)( void *, SIZE_T, ULONG, ULONG, BOOL, NTSTATUS ) = NULL; void (WINAPI *pBTCpuNotifyMemoryDirty)( void *, SIZE_T ) = NULL; @@ -804,7 +805,8 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex GET_PTR( BTCpuResetToConsistentState ); GET_PTR( BTCpuSetContext ); GET_PTR( BTCpuSimulate ); - GET_PTR( BTCpuNotifyFlushInstructionCache2 ); + GET_PTR( BTCpuFlushInstructionCache2 ); + GET_PTR( BTCpuFlushInstructionCacheHeavy ); GET_PTR( BTCpuNotifyMapViewOfSection ); GET_PTR( BTCpuNotifyMemoryAlloc ); GET_PTR( BTCpuNotifyMemoryDirty ); @@ -1343,7 +1345,7 @@ void WINAPI Wow64ProcessPendingCrossProcessItems(void)
if (flush) { - if (pBTCpuNotifyFlushInstructionCache2) pBTCpuNotifyFlushInstructionCache2( NULL, ~0ull ); + if (pBTCpuFlushInstructionCacheHeavy) pBTCpuFlushInstructionCacheHeavy( NULL, 0 ); while (entry) { next = entry->next; @@ -1376,8 +1378,16 @@ void WINAPI Wow64ProcessPendingCrossProcessItems(void) entry->id == CrossProcessPostVirtualProtect, entry->args[1] ); break; case CrossProcessFlushCache: - if (!pBTCpuNotifyFlushInstructionCache2) break; - pBTCpuNotifyFlushInstructionCache2( (void *)entry->addr, entry->size ); + if (!pBTCpuFlushInstructionCache2) break; + pBTCpuFlushInstructionCache2( (void *)entry->addr, entry->size ); + break; + case CrossProcessFlushCacheHeavy: + if (!pBTCpuFlushInstructionCacheHeavy) break; + pBTCpuFlushInstructionCacheHeavy( (void *)entry->addr, entry->size ); + break; + case CrossProcessMemoryWrite: + if (!pBTCpuNotifyMemoryDirty) break; + pBTCpuNotifyMemoryDirty( (void *)entry->addr, entry->size ); break; } next = entry->next; diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index 410bc627237..7df14c9b23b 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -240,7 +240,7 @@ NTSTATUS WINAPI wow64_NtFlushInstructionCache( UINT *args )
if (RtlIsCurrentProcess( process )) { - if (pBTCpuNotifyFlushInstructionCache2) pBTCpuNotifyFlushInstructionCache2( addr, size ); + if (pBTCpuFlushInstructionCache2) pBTCpuFlushInstructionCache2( addr, size ); } else send_cross_process_notification( process, CrossProcessFlushCache, addr, size, 0 );
diff --git a/dlls/wow64/wow64_private.h b/dlls/wow64/wow64_private.h index 46a0f513c2b..4f38c704174 100644 --- a/dlls/wow64/wow64_private.h +++ b/dlls/wow64/wow64_private.h @@ -39,7 +39,8 @@ extern ULONG_PTR highest_user_address; extern ULONG_PTR default_zero_bits; extern SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock;
-extern void (WINAPI *pBTCpuNotifyFlushInstructionCache2)( const void *, SIZE_T ); +extern void (WINAPI *pBTCpuFlushInstructionCache2)( const void *, SIZE_T ); +extern void (WINAPI *pBTCpuFlushInstructionCacheHeavy)( const void *, SIZE_T ); extern void (WINAPI *pBTCpuNotifyMapViewOfSection)( void * ); extern void (WINAPI *pBTCpuNotifyMemoryAlloc)( void *, SIZE_T, ULONG, ULONG, BOOL, NTSTATUS ); extern void (WINAPI *pBTCpuNotifyMemoryDirty)( void *, SIZE_T ); diff --git a/include/winternl.h b/include/winternl.h index 8406d4b8d46..224ad4bff0d 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4251,6 +4251,8 @@ typedef enum CrossProcessPreVirtualProtect = 4, CrossProcessPostVirtualProtect = 5, CrossProcessFlushCache = 6, + CrossProcessFlushCacheHeavy = 7, + CrossProcessMemoryWrite = 8, } CROSS_PROCESS_NOTIFICATION;
#define CROSS_PROCESS_LIST_FLUSH 0x80000000