Module: wine Branch: master Commit: b8edf6d92082ea755bc473e7891235a6cfac9cd2 URL: https://gitlab.winehq.org/wine/wine/-/commit/b8edf6d92082ea755bc473e7891235a...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jun 4 12:30:13 2024 +0200
msvcrt: Share the common part of _fpieee_flt between platforms.
---
dlls/msvcrt/cppexcept.h | 3 +++ dlls/msvcrt/except.c | 19 +++++++++++++++++++ dlls/msvcrt/except_arm.c | 6 +++--- dlls/msvcrt/except_arm64.c | 6 +++--- dlls/msvcrt/except_arm64ec.c | 6 +++--- dlls/msvcrt/except_i386.c | 22 +++++----------------- dlls/msvcrt/except_x86_64.c | 6 +++--- 7 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h index cb0ce03c960..10b3a200b66 100644 --- a/dlls/msvcrt/cppexcept.h +++ b/dlls/msvcrt/cppexcept.h @@ -21,6 +21,7 @@ #ifndef __MSVCRT_CPPEXCEPT_H #define __MSVCRT_CPPEXCEPT_H
+#include <fpieee.h> #include "cxx.h"
#define CXX_FRAME_MAGIC_VC6 0x19930520 @@ -276,6 +277,8 @@ extern void dump_function_descr( const cxx_function_descr *descr, uintptr_t base extern void *find_catch_handler( void *object, uintptr_t frame, uintptr_t exc_base, const tryblock_info *tryblock, cxx_exception_type *exc_type, uintptr_t image_base ); +extern int handle_fpieee_flt( __msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, + int (__cdecl *handler)(_FPIEEE_RECORD*) );
#if _MSVCR_VER >= 80 #define EXCEPTION_MANGLED_NAME ".?AVexception@std@@" diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c index 4bdfefd49ef..074d6051a78 100644 --- a/dlls/msvcrt/except.c +++ b/dlls/msvcrt/except.c @@ -448,6 +448,25 @@ BOOL CDECL __uncaught_exception(void) return msvcrt_get_thread_data()->processing_throw != 0; }
+/********************************************************************* + * _fpieee_flt (MSVCRT.@) + */ +int __cdecl _fpieee_flt( __msvcrt_ulong code, EXCEPTION_POINTERS *ep, + int (__cdecl *handler)(_FPIEEE_RECORD*) ) +{ + switch (code) + { + case STATUS_FLOAT_DIVIDE_BY_ZERO: + case STATUS_FLOAT_INEXACT_RESULT: + case STATUS_FLOAT_INVALID_OPERATION: + case STATUS_FLOAT_OVERFLOW: + case STATUS_FLOAT_UNDERFLOW: + return handle_fpieee_flt( code, ep, handler ); + default: + return EXCEPTION_CONTINUE_SEARCH; + } +} + #if _MSVCR_VER>=70 && _MSVCR_VER<=71
/********************************************************************* diff --git a/dlls/msvcrt/except_arm.c b/dlls/msvcrt/except_arm.c index 93511728138..69dbd7324b0 100644 --- a/dlls/msvcrt/except_arm.c +++ b/dlls/msvcrt/except_arm.c @@ -51,10 +51,10 @@ EXCEPTION_DISPOSITION CDECL __CxxFrameHandler(EXCEPTION_RECORD *rec, DWORD frame
/********************************************************************* - * _fpieee_flt (MSVCRT.@) + * handle_fpieee_flt */ -int __cdecl _fpieee_flt(__msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, - int (__cdecl *handler)(_FPIEEE_RECORD*)) +int handle_fpieee_flt( __msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, + int (__cdecl *handler)(_FPIEEE_RECORD*) ) { FIXME("(%lx %p %p)\n", exception_code, ep, handler); return EXCEPTION_CONTINUE_SEARCH; diff --git a/dlls/msvcrt/except_arm64.c b/dlls/msvcrt/except_arm64.c index 2a5a67ef7c8..8d4465744bc 100644 --- a/dlls/msvcrt/except_arm64.c +++ b/dlls/msvcrt/except_arm64.c @@ -58,10 +58,10 @@ __ASM_GLOBAL_FUNC( _setjmp, "b _setjmpex" );
/********************************************************************* - * _fpieee_flt (MSVCRT.@) + * handle_fpieee_flt */ -int __cdecl _fpieee_flt(__msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, - int (__cdecl *handler)(_FPIEEE_RECORD*)) +int handle_fpieee_flt( __msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, + int (__cdecl *handler)(_FPIEEE_RECORD*) ) { FIXME("(%lx %p %p)\n", exception_code, ep, handler); return EXCEPTION_CONTINUE_SEARCH; diff --git a/dlls/msvcrt/except_arm64ec.c b/dlls/msvcrt/except_arm64ec.c index 779cf077bbe..5b03000a323 100644 --- a/dlls/msvcrt/except_arm64ec.c +++ b/dlls/msvcrt/except_arm64ec.c @@ -51,10 +51,10 @@ EXCEPTION_DISPOSITION CDECL __CxxFrameHandler( EXCEPTION_RECORD *rec, ULONG64 fr
/********************************************************************* - * _fpieee_flt (MSVCRT.@) + * handle_fpieee_flt */ -int __cdecl _fpieee_flt( __msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, - int (__cdecl *handler)(_FPIEEE_RECORD*) ) +int handle_fpieee_flt( __msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, + int (__cdecl *handler)(_FPIEEE_RECORD*) ) { FIXME("(%lx %p %p)\n", exception_code, ep, handler); return EXCEPTION_CONTINUE_SEARCH; diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c index abea9b28fd1..7d1faa95272 100644 --- a/dlls/msvcrt/except_i386.c +++ b/dlls/msvcrt/except_i386.c @@ -856,28 +856,15 @@ void __stdcall _seh_longjmp_unwind4(_JUMP_BUFFER *jmp) }
/********************************************************************* - * _fpieee_flt (MSVCRT.@) + * handle_fpieee_flt */ -int __cdecl _fpieee_flt(__msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, - int (__cdecl *handler)(_FPIEEE_RECORD*)) +int handle_fpieee_flt( __msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, + int (__cdecl *handler)(_FPIEEE_RECORD*) ) { FLOATING_SAVE_AREA *ctx = &ep->ContextRecord->FloatSave; _FPIEEE_RECORD rec; int ret;
- TRACE("(%lx %p %p)\n", exception_code, ep, handler); - - switch(exception_code) { - case STATUS_FLOAT_DIVIDE_BY_ZERO: - case STATUS_FLOAT_INEXACT_RESULT: - case STATUS_FLOAT_INVALID_OPERATION: - case STATUS_FLOAT_OVERFLOW: - case STATUS_FLOAT_UNDERFLOW: - break; - default: - return EXCEPTION_CONTINUE_SEARCH; - } - memset(&rec, 0, sizeof(rec)); rec.RoundingMode = ctx->ControlWord >> 10; switch((ctx->ControlWord >> 8) & 0x3) { @@ -902,7 +889,8 @@ int __cdecl _fpieee_flt(__msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, rec.Cause.Underflow = rec.Enable.Underflow & rec.Status.Underflow; rec.Cause.Inexact = rec.Enable.Inexact & rec.Status.Inexact;
- TRACE("opcode: %lx\n", *(ULONG*)ep->ContextRecord->FloatSave.ErrorOffset); + TRACE("code %lx handler %p opcode %lx\n", exception_code, handler, + *(ULONG*)ep->ContextRecord->FloatSave.ErrorOffset);
if(*(WORD*)ctx->ErrorOffset == 0x35dc) { /* fdiv m64fp */ if(exception_code==STATUS_FLOAT_DIVIDE_BY_ZERO || exception_code==STATUS_FLOAT_INVALID_OPERATION) { diff --git a/dlls/msvcrt/except_x86_64.c b/dlls/msvcrt/except_x86_64.c index 23369599e61..15ca416d34b 100644 --- a/dlls/msvcrt/except_x86_64.c +++ b/dlls/msvcrt/except_x86_64.c @@ -454,10 +454,10 @@ void __cdecl _local_unwind( void *frame, void *target ) }
/********************************************************************* - * _fpieee_flt (MSVCRT.@) + * handle_fpieee_flt */ -int __cdecl _fpieee_flt(__msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, - int (__cdecl *handler)(_FPIEEE_RECORD*)) +int handle_fpieee_flt( __msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, + int (__cdecl *handler)(_FPIEEE_RECORD*) ) { FIXME("(%lx %p %p) opcode: %#I64x\n", exception_code, ep, handler, *(ULONG64*)ep->ContextRecord->Rip);