[PATCH 0/2] MR11738: win87em, krnl386: Set and call application-defined floating-point error handler.
From: Alex Henrie <alexhenrie24@gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=60230 --- dlls/win87em.dll16/win87em.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/win87em.dll16/win87em.c b/dlls/win87em.dll16/win87em.c index 126c94f94e0..2ea62b5fe6a 100644 --- a/dlls/win87em.dll16/win87em.c +++ b/dlls/win87em.dll16/win87em.c @@ -22,6 +22,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(int); +extern void WINAPI __wine_call_int_handler16( BYTE intnum, CONTEXT *context ); + struct Win87EmInfoStruct { unsigned short Version; @@ -69,6 +71,16 @@ static void WIN87_SetCtrlWord( CONTEXT *context ) } } +static void WIN87_SetExceptionHandler( WORD selector, WORD offset ) +{ + CONTEXT set_pm_handler = {0}; + set_pm_handler.Eax = 0x0205; /* set protected mode interrupt vector */ + set_pm_handler.Ebx = 0x75; /* floating point error */ + set_pm_handler.Ecx = selector; + set_pm_handler.Edx = offset; + __wine_call_int_handler16(0x31, &set_pm_handler); +} + static void WIN87_Init( CONTEXT *context ) { if (Installed) { @@ -118,7 +130,7 @@ void WINAPI __fpMath( CONTEXT *context ) break; case 3: - /*INT_SetHandler(0x3E,MAKELONG(AX,DX));*/ + WIN87_SetExceptionHandler(context->Edx, context->Eax); break; case 4: /* set control word (& ~(CW_Denormal|CW_Invalid)) */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11738
From: Alex Henrie <alexhenrie24@gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=60230 --- dlls/krnl386.exe16/wowthunk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/krnl386.exe16/wowthunk.c b/dlls/krnl386.exe16/wowthunk.c index 72e86bfdf04..626af0fbb42 100644 --- a/dlls/krnl386.exe16/wowthunk.c +++ b/dlls/krnl386.exe16/wowthunk.c @@ -30,6 +30,7 @@ #include "winternl.h" #include "ntgdi.h" #include "kernel16_private.h" +#include "dosexe.h" #include "wine/asm.h" #include "wine/exception.h" #include "wine/debug.h" @@ -182,6 +183,12 @@ static DWORD call16_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RE } } } + else if (record->ExceptionCode >= STATUS_FLOAT_DENORMAL_OPERAND && + record->ExceptionCode <= STATUS_FLOAT_UNDERFLOW) + { + if (DOSVM_EmulateInterruptPM( context, 0x75 )) + return ExceptionContinueExecution; + } return ExceptionContinueSearch; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11738
participants (2)
-
Alex Henrie -
Alex Henrie (@alexhenrie)