From 45e3403e7bdabd845864b13f4563ed9c731a58a3 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Thu, 19 May 2005 22:44:13 +0000 Subject: [PATCH] * crt1.c (_gnu_exception_handler): Handle illegal instruction OS exception as a signal if user has defined a SIGILL handler. --- winsup/mingw/ChangeLog | 5 +++++ winsup/mingw/crt1.c | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 32a8f25aa..5c74d22c6 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2005-05-20 Danny Smith * mingwex/math/nexttoward.c: New file. diff --git a/winsup/mingw/crt1.c b/winsup/mingw/crt1.c index 780b75e5a..b9b2bd5b1 100644 --- a/winsup/mingw/crt1.c +++ b/winsup/mingw/crt1.c @@ -124,6 +124,25 @@ _gnu_exception_handler (EXCEPTION_POINTERS * exception_data) } break; + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_PRIV_INSTRUCTION: + /* test if the user has set SIGILL */ + old_handler = signal (SIGILL, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGILL, SIG_IGN); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGILL); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; + case EXCEPTION_FLT_INVALID_OPERATION: case EXCEPTION_FLT_DIVIDE_BY_ZERO: case EXCEPTION_FLT_DENORMAL_OPERAND: