Module: wine Branch: master Commit: 259b92d13e2d2c67876006ff0485e7031f4ec7bf URL: https://gitlab.winehq.org/wine/wine/-/commit/259b92d13e2d2c67876006ff0485e70...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 27 16:02:18 2024 +0100
wow64: Update Wow64RaiseException behavior to match i386 hardware exceptions.
---
dlls/wow64/syscall.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index db51948057f..78338f7ef6a 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -1330,11 +1330,13 @@ NTSTATUS WINAPI Wow64RaiseException( int code, EXCEPTION_RECORD *rec ) int_rec.ExceptionCode = EXCEPTION_INT_DIVIDE_BY_ZERO; break; case 0x01: /* single-step */ + ctx32.i386.EFlags &= ~0x100; + pBTCpuSetContext( GetCurrentThread(), GetCurrentProcess(), NULL, &ctx32.i386 ); int_rec.ExceptionCode = EXCEPTION_SINGLE_STEP; break; case 0x03: /* breakpoint */ int_rec.ExceptionCode = EXCEPTION_BREAKPOINT; - int_rec.ExceptionAddress = (void *)(ULONG_PTR)(ctx32.i386.Eip + 1); + int_rec.ExceptionAddress = (void *)(ULONG_PTR)(ctx32.i386.Eip - 1); int_rec.NumberParameters = 1; break; case 0x04: /* overflow */ @@ -1352,6 +1354,9 @@ NTSTATUS WINAPI Wow64RaiseException( int code, EXCEPTION_RECORD *rec ) case 0x0c: /* stack fault */ int_rec.ExceptionCode = EXCEPTION_STACK_OVERFLOW; break; + case 0x0d: /* general protection fault */ + int_rec.ExceptionCode = EXCEPTION_PRIV_INSTRUCTION; + break; case 0x29: /* __fastfail */ int_rec.ExceptionCode = STATUS_STACK_BUFFER_OVERRUN; int_rec.ExceptionFlags = EH_NONCONTINUABLE; @@ -1360,7 +1365,7 @@ NTSTATUS WINAPI Wow64RaiseException( int code, EXCEPTION_RECORD *rec ) first_chance = FALSE; break; case 0x2d: /* debug service */ - ctx32.i386.Eip++; + ctx32.i386.Eip += 3; pBTCpuSetContext( GetCurrentThread(), GetCurrentProcess(), NULL, &ctx32.i386 ); int_rec.ExceptionCode = EXCEPTION_BREAKPOINT; int_rec.ExceptionAddress = (void *)(ULONG_PTR)ctx32.i386.Eip; @@ -1368,8 +1373,6 @@ NTSTATUS WINAPI Wow64RaiseException( int code, EXCEPTION_RECORD *rec ) int_rec.ExceptionInformation[0] = ctx32.i386.Eax; break; default: - ctx32.i386.Eip -= 2; - pBTCpuSetContext( GetCurrentThread(), GetCurrentProcess(), NULL, &ctx32.i386 ); int_rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION; int_rec.ExceptionAddress = (void *)(ULONG_PTR)ctx32.i386.Eip; int_rec.NumberParameters = 2;