OSDN Git Service

* crt1.c (_gnu_exception_handler): Handle illegal instruction
authordannysmith <dannysmith>
Thu, 19 May 2005 22:44:12 +0000 (22:44 +0000)
committerdannysmith <dannysmith>
Thu, 19 May 2005 22:44:12 +0000 (22:44 +0000)
OS exception as a signal if user has defined a SIGILL handler.

winsup/mingw/ChangeLog
winsup/mingw/crt1.c

index 32a8f25..5c74d22 100644 (file)
@@ -1,3 +1,8 @@
+2005-05-20  Danny Smith  <dannysmith@users.sourceforge
+
+       * crt1.c (_gnu_exception_handler): Handle illegal instruction
+       OS exception as a signal if user has defined a SIGILL handler.
+
 2005-05-10  Danny Smith  <dannysmith@users.sourceforge.net>
 
        * mingwex/math/nexttoward.c: New file.
index 780b75e..b9b2bd5 100644 (file)
@@ -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: