Module: wine Branch: master Commit: 111398c364c2639432981c32e7af4e39888f2090 URL: https://source.winehq.org/git/wine.git/?a=commit;h=111398c364c2639432981c32e...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Dec 1 11:47:03 2021 +0100
wow64: Add handler for exceptions happening in 32-bit mode.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wow64/syscall.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index 74fc8d9905e..bee186456cc 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -670,6 +670,39 @@ NTSTATUS WINAPI Wow64SystemServiceEx( UINT num, UINT *args ) }
+static void cpu_simulate(void); + +/********************************************************************** + * simulate_filter + */ +static LONG CALLBACK simulate_filter( EXCEPTION_POINTERS *ptrs ) +{ + Wow64PassExceptionToGuest( ptrs ); + cpu_simulate(); /* re-enter simulation to run the exception dispatcher */ + return EXCEPTION_EXECUTE_HANDLER; +} + + +/********************************************************************** + * cpu_simulate + */ +static void cpu_simulate(void) +{ + for (;;) + { + __TRY + { + pBTCpuSimulate(); + } + __EXCEPT( simulate_filter ) + { + /* restart simulation loop */ + } + __ENDTRY + } +} + + /********************************************************************** * Wow64AllocateTemp (wow64.@) * @@ -769,7 +802,7 @@ void WINAPI Wow64LdrpInitialize( CONTEXT *context )
RtlRunOnceExecuteOnce( &init_done, process_init, NULL, NULL ); thread_init(); - pBTCpuSimulate(); + cpu_simulate(); }