From: Rémi Bernon rbernon@codeweavers.com
International Rally Championship executes cli on startup and sti on exit, this currently crashes as an exception is thrown and isn't handled by the game.
The ntdll:exception tests show that an exception is thrown on x86_64, i386 and WOW64 mode, however the game also runs fine when executed in a Windows 10 64bit VM (with 640x480 16bpp compatibility mode). It crashes when run in a Windows 8 32bit VM, so possibly something WOW64 related swallows the exception.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57381 --- dlls/kernelbase/debug.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c index cbefc0c8733..e49fa3dcb6e 100644 --- a/dlls/kernelbase/debug.c +++ b/dlls/kernelbase/debug.c @@ -761,6 +761,42 @@ LONG WINAPI UnhandledExceptionFilter( EXCEPTION_POINTERS *epointers ) if (ret != EXCEPTION_CONTINUE_SEARCH) return ret; }
+#ifndef _WIN64 + if (rec->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION && is_wow64) + { + BYTE *instr = rec->ExceptionAddress, prefix_len = 0; + CONTEXT *ctx = epointers->ContextRecord; + + for (;;) switch (*instr++) + { + /* instruction prefixes */ + case 0x2e: /* %cs: */ + case 0x36: /* %ss: */ + case 0x3e: /* %ds: */ + case 0x26: /* %es: */ + case 0x64: /* %fs: */ + case 0x65: /* %gs: */ + case 0x66: /* opcode size */ + case 0x67: /* addr size */ + case 0xf0: /* lock */ + case 0xf2: /* repne */ + case 0xf3: /* repe */ + if (++prefix_len >= 15) break; + continue; + case 0x0f: /* extended instruction */ + break; + + case 0xfa: /* cli */ + case 0xfb: /* sti */ + WARN( "Ignoring privileged instruction exception\n" ); + ctx->Eip += prefix_len + 1; + return EXCEPTION_CONTINUE_EXECUTION; + default: + break; + } + } +#endif + if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) || !start_debugger_atomic( epointers ) || !NtCurrentTeb()->Peb->BeingDebugged) return EXCEPTION_EXECUTE_HANDLER;