rename CPU exception macros (was: Re: [PATCH] GNU/kFreeBSD port)

Robert Millan rmh at aybabtu.com
Thu Feb 2 12:28:24 CST 2006


Oops.  Forgot the patch :)

On Thu, Feb 02, 2006 at 07:12:57PM +0100, Robert Millan wrote:
> 
> This new patch renames cpu exception macros as Julliard asked me to do via IRC.
> 
> 2006-02-02  Robert Millan  <robertmh at gnu.org>
> 
> 	* dlls/ntdll/signal_i386.c: Rename T_* cpu exception macros to E_*
> 	in order to avoid collision with system headers.
> 	* dlls/ntdll/signal_x86_64.c: Ditto.

-- 
Robert Millan
-------------- next part --------------
2006-02-02  Robert Millan  <robertmh at gnu.org>

	* dlls/ntdll/signal_i386.c: Rename T_* cpu exception macros to E_*
	in order to avoid collision with system headers.
	* dlls/ntdll/signal_x86_64.c: Ditto.

diff -ur wine.old/dlls/ntdll/signal_i386.c wine/dlls/ntdll/signal_i386.c
--- wine.old/dlls/ntdll/signal_i386.c	2006-01-27 16:22:33.000000000 +0100
+++ wine/dlls/ntdll/signal_i386.c	2006-02-02 19:05:03.000000000 +0100
@@ -411,34 +411,28 @@
 
 #endif  /* svr4 || SCO_DS */
 
-/* exception code definitions (already defined by FreeBSD/NetBSD) */
-#if !defined(__FreeBSD__) && !defined(__NetBSD__) /* FIXME: other BSDs? */
-#define T_DIVIDE        0   /* Division by zero exception */
-#define T_TRCTRAP       1   /* Single-step exception */
-#define T_NMI           2   /* NMI interrupt */
-#define T_BPTFLT        3   /* Breakpoint exception */
-#define T_OFLOW         4   /* Overflow exception */
-#define T_BOUND         5   /* Bound range exception */
-#define T_PRIVINFLT     6   /* Invalid opcode exception */
-#define T_DNA           7   /* Device not available exception */
-#define T_DOUBLEFLT     8   /* Double fault exception */
-#define T_FPOPFLT       9   /* Coprocessor segment overrun */
-#define T_TSSFLT        10  /* Invalid TSS exception */
-#define T_SEGNPFLT      11  /* Segment not present exception */
-#define T_STKFLT        12  /* Stack fault */
-#define T_PROTFLT       13  /* General protection fault */
-#define T_PAGEFLT       14  /* Page fault */
-#define T_RESERVED      15  /* Unknown exception */
-#define T_ARITHTRAP     16  /* Floating point exception */
-#define T_ALIGNFLT      17  /* Alignment check exception */
-#define T_MCHK          18  /* Machine check exception */
-#define T_CACHEFLT      19  /* Cache flush exception */
-#endif
-#if defined(__NetBSD__)
-#define T_MCHK          19  /* Machine check exception */
-#endif
-
-#define T_UNKNOWN     (-1)  /* Unknown fault (TRAP_sig not defined) */
+/* exception code definitions */
+#define E_UNKNOWN     (-1)  /* Unknown fault (TRAP_sig not defined) */
+#define E_DIVIDE        0   /* Division by zero exception */
+#define E_TRCTRAP       1   /* Single-step exception */
+#define E_NMI           2   /* NMI interrupt */
+#define E_BPTFLT        3   /* Breakpoint exception */
+#define E_OFLOW         4   /* Overflow exception */
+#define E_BOUND         5   /* Bound range exception */
+#define E_PRIVINFLT     6   /* Invalid opcode exception */
+#define E_DNA           7   /* Device not available exception */
+#define E_DOUBLEFLT     8   /* Double fault exception */
+#define E_FPOPFLT       9   /* Coprocessor segment overrun */
+#define E_TSSFLT        10  /* Invalid TSS exception */
+#define E_SEGNPFLT      11  /* Segment not present exception */
+#define E_STKFLT        12  /* Stack fault */
+#define E_PROTFLT       13  /* General protection fault */
+#define E_PAGEFLT       14  /* Page fault */
+#define E_RESERVED      15  /* Unknown exception */
+#define E_ARITHTRAP     16  /* Floating point exception */
+#define E_ALIGNFLT      17  /* Alignment check exception */
+#define E_MCHK          18  /* Machine check exception */
+#define E_CACHEFLT      19  /* Cache flush exception */
 
 #include "wine/exception.h"
 #include "wine/debug.h"
@@ -475,7 +469,7 @@
 #ifdef TRAP_sig
     return TRAP_sig(sigcontext);
 #else
-    return T_UNKNOWN;  /* unknown trap code */
+    return E_UNKNOWN;  /* unknown trap code */
 #endif
 }
 
@@ -1149,21 +1143,21 @@
 
     switch(get_trap_code(HANDLER_CONTEXT))
     {
-    case T_OFLOW:   /* Overflow exception */
+    case E_OFLOW:   /* Overflow exception */
         rec->ExceptionCode = EXCEPTION_INT_OVERFLOW;
         break;
-    case T_BOUND:   /* Bound range exception */
+    case E_BOUND:   /* Bound range exception */
         rec->ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED;
         break;
-    case T_PRIVINFLT:   /* Invalid opcode exception */
+    case E_PRIVINFLT:   /* Invalid opcode exception */
         rec->ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
         break;
-    case T_STKFLT:  /* Stack fault */
+    case E_STKFLT:  /* Stack fault */
         rec->ExceptionCode = EXCEPTION_STACK_OVERFLOW;
         break;
-    case T_SEGNPFLT:  /* Segment not present exception */
-    case T_PROTFLT:   /* General protection fault */
-    case T_UNKNOWN:   /* Unknown fault code */
+    case E_SEGNPFLT:  /* Segment not present exception */
+    case E_PROTFLT:   /* General protection fault */
+    case E_UNKNOWN:   /* Unknown fault code */
         if (!get_error_code(HANDLER_CONTEXT) && is_privileged_instr( get_exception_context(rec) ))
             rec->ExceptionCode = EXCEPTION_PRIV_INSTRUCTION;
         else
@@ -1176,7 +1170,7 @@
             rec->ExceptionInformation[1] = (err & 7) == 4 ? (err & ~7) : 0xffffffff;
         }
         break;
-    case T_PAGEFLT:  /* Page fault */
+    case E_PAGEFLT:  /* Page fault */
         rec->ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
 #ifdef FAULT_ADDRESS
         rec->NumberParameters = 2;
@@ -1184,20 +1178,20 @@
         rec->ExceptionInformation[1] = (ULONG_PTR)FAULT_ADDRESS;
 #endif
         break;
-    case T_ALIGNFLT:  /* Alignment check exception */
+    case E_ALIGNFLT:  /* Alignment check exception */
         rec->ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT;
         break;
     default:
         ERR( "Got unexpected trap %d\n", get_trap_code(HANDLER_CONTEXT) );
         /* fall through */
-    case T_NMI:       /* NMI interrupt */
-    case T_DNA:       /* Device not available exception */
-    case T_DOUBLEFLT: /* Double fault exception */
-    case T_TSSFLT:    /* Invalid TSS exception */
-    case T_RESERVED:  /* Unknown exception */
-    case T_MCHK:      /* Machine check exception */
-#ifdef T_CACHEFLT
-    case T_CACHEFLT:  /* Cache flush exception */
+    case E_NMI:       /* NMI interrupt */
+    case E_DNA:       /* Device not available exception */
+    case E_DOUBLEFLT: /* Double fault exception */
+    case E_TSSFLT:    /* Invalid TSS exception */
+    case E_RESERVED:  /* Unknown exception */
+    case E_MCHK:      /* Machine check exception */
+#ifdef E_CACHEFLT
+    case E_CACHEFLT:  /* Cache flush exception */
 #endif
         rec->ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
         break;
@@ -1216,10 +1210,10 @@
 
     switch(get_trap_code(HANDLER_CONTEXT))
     {
-    case T_TRCTRAP:  /* Single-step exception */
+    case E_TRCTRAP:  /* Single-step exception */
         rec->ExceptionCode = EXCEPTION_SINGLE_STEP;
         break;
-    case T_BPTFLT:   /* Breakpoint exception */
+    case E_BPTFLT:   /* Breakpoint exception */
         rec->ExceptionAddress = (char *)rec->ExceptionAddress - 1;  /* back up over the int3 instruction */
         /* fall through */
     default:
@@ -1244,14 +1238,14 @@
 
     switch(get_trap_code(HANDLER_CONTEXT))
     {
-    case T_DIVIDE:   /* Division by zero exception */
+    case E_DIVIDE:   /* Division by zero exception */
         rec->ExceptionCode = EXCEPTION_INT_DIVIDE_BY_ZERO;
         break;
-    case T_FPOPFLT:   /* Coprocessor segment overrun */
+    case E_FPOPFLT:   /* Coprocessor segment overrun */
         rec->ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION;
         break;
-    case T_ARITHTRAP:  /* Floating point exception */
-    case T_UNKNOWN:    /* Unknown fault code */
+    case E_ARITHTRAP:  /* Floating point exception */
+    case E_UNKNOWN:    /* Unknown fault code */
         rec->ExceptionCode = get_fpu_code( context );
         break;
     default:
@@ -1491,10 +1485,10 @@
         case VM86_TRAP: /* return due to DOS-debugger request */
             switch(VM86_ARG(res))
             {
-            case T_TRCTRAP:  /* Single-step exception, single step flag is cleared by raise_trap_exception */
+            case E_TRCTRAP:  /* Single-step exception, single step flag is cleared by raise_trap_exception */
                 rec.ExceptionCode = EXCEPTION_SINGLE_STEP;
                 break;
-            case T_BPTFLT:   /* Breakpoint exception */
+            case E_BPTFLT:   /* Breakpoint exception */
                 rec.ExceptionAddress = (char *)rec.ExceptionAddress - 1;  /* back up over the int3 instruction */
                 /* fall through */
             default:
diff -ur wine.old/dlls/ntdll/signal_x86_64.c wine/dlls/ntdll/signal_x86_64.c
--- wine.old/dlls/ntdll/signal_x86_64.c	2006-01-11 21:36:17.000000000 +0100
+++ wine/dlls/ntdll/signal_x86_64.c	2006-02-02 19:05:43.000000000 +0100
@@ -93,27 +93,27 @@
 
 #endif /* linux */
 
-#define T_UNKNOWN     (-1)  /* Unknown fault (TRAP_sig not defined) */
-#define T_DIVIDE        0   /* Division by zero exception */
-#define T_TRCTRAP       1   /* Single-step exception */
-#define T_NMI           2   /* NMI interrupt */
-#define T_BPTFLT        3   /* Breakpoint exception */
-#define T_OFLOW         4   /* Overflow exception */
-#define T_BOUND         5   /* Bound range exception */
-#define T_PRIVINFLT     6   /* Invalid opcode exception */
-#define T_DNA           7   /* Device not available exception */
-#define T_DOUBLEFLT     8   /* Double fault exception */
-#define T_FPOPFLT       9   /* Coprocessor segment overrun */
-#define T_TSSFLT        10  /* Invalid TSS exception */
-#define T_SEGNPFLT      11  /* Segment not present exception */
-#define T_STKFLT        12  /* Stack fault */
-#define T_PROTFLT       13  /* General protection fault */
-#define T_PAGEFLT       14  /* Page fault */
-#define T_RESERVED      15  /* Unknown exception */
-#define T_ARITHTRAP     16  /* Floating point exception */
-#define T_ALIGNFLT      17  /* Alignment check exception */
-#define T_MCHK          18  /* Machine check exception */
-#define T_CACHEFLT      19  /* Cache flush exception */
+#define E_UNKNOWN     (-1)  /* Unknown fault (TRAP_sig not defined) */
+#define E_DIVIDE        0   /* Division by zero exception */
+#define E_TRCTRAP       1   /* Single-step exception */
+#define E_NMI           2   /* NMI interrupt */
+#define E_BPTFLT        3   /* Breakpoint exception */
+#define E_OFLOW         4   /* Overflow exception */
+#define E_BOUND         5   /* Bound range exception */
+#define E_PRIVINFLT     6   /* Invalid opcode exception */
+#define E_DNA           7   /* Device not available exception */
+#define E_DOUBLEFLT     8   /* Double fault exception */
+#define E_FPOPFLT       9   /* Coprocessor segment overrun */
+#define E_TSSFLT        10  /* Invalid TSS exception */
+#define E_SEGNPFLT      11  /* Segment not present exception */
+#define E_STKFLT        12  /* Stack fault */
+#define E_PROTFLT       13  /* General protection fault */
+#define E_PAGEFLT       14  /* Page fault */
+#define E_RESERVED      15  /* Unknown exception */
+#define E_ARITHTRAP     16  /* Floating point exception */
+#define E_ALIGNFLT      17  /* Alignment check exception */
+#define E_MCHK          18  /* Machine check exception */
+#define E_CACHEFLT      19  /* Cache flush exception */
 
 typedef int (*wine_signal_handler)(unsigned int sig);
 
@@ -226,25 +226,25 @@
 
     switch(TRAP_sig(HANDLER_CONTEXT))
     {
-    case T_OFLOW:   /* Overflow exception */
+    case E_OFLOW:   /* Overflow exception */
         rec.ExceptionCode = EXCEPTION_INT_OVERFLOW;
         break;
-    case T_BOUND:   /* Bound range exception */
+    case E_BOUND:   /* Bound range exception */
         rec.ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED;
         break;
-    case T_PRIVINFLT:   /* Invalid opcode exception */
+    case E_PRIVINFLT:   /* Invalid opcode exception */
         rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
         break;
-    case T_STKFLT:  /* Stack fault */
+    case E_STKFLT:  /* Stack fault */
         rec.ExceptionCode = EXCEPTION_STACK_OVERFLOW;
         break;
-    case T_SEGNPFLT:  /* Segment not present exception */
-    case T_PROTFLT:   /* General protection fault */
-    case T_UNKNOWN:   /* Unknown fault code */
+    case E_SEGNPFLT:  /* Segment not present exception */
+    case E_PROTFLT:   /* General protection fault */
+    case E_UNKNOWN:   /* Unknown fault code */
         rec.ExceptionCode = ERROR_sig(HANDLER_CONTEXT) ? EXCEPTION_ACCESS_VIOLATION
                                                        : EXCEPTION_PRIV_INSTRUCTION;
         break;
-    case T_PAGEFLT:  /* Page fault */
+    case E_PAGEFLT:  /* Page fault */
         rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
 #ifdef FAULT_ADDRESS
         rec.NumberParameters = 2;
@@ -252,19 +252,19 @@
         rec.ExceptionInformation[1] = (ULONG_PTR)FAULT_ADDRESS;
 #endif
         break;
-    case T_ALIGNFLT:  /* Alignment check exception */
+    case E_ALIGNFLT:  /* Alignment check exception */
         rec.ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT;
         break;
     default:
         ERR( "Got unexpected trap %ld\n", TRAP_sig(HANDLER_CONTEXT) );
         /* fall through */
-    case T_NMI:       /* NMI interrupt */
-    case T_DNA:       /* Device not available exception */
-    case T_DOUBLEFLT: /* Double fault exception */
-    case T_TSSFLT:    /* Invalid TSS exception */
-    case T_RESERVED:  /* Unknown exception */
-    case T_MCHK:      /* Machine check exception */
-    case T_CACHEFLT:  /* Cache flush exception */
+    case E_NMI:       /* NMI interrupt */
+    case E_DNA:       /* Device not available exception */
+    case E_DOUBLEFLT: /* Double fault exception */
+    case E_TSSFLT:    /* Invalid TSS exception */
+    case E_RESERVED:  /* Unknown exception */
+    case E_MCHK:      /* Machine check exception */
+    case E_CACHEFLT:  /* Cache flush exception */
         rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
         break;
     }


More information about the wine-patches mailing list