Sat Jun 28 00:12:40 2008 UTC ()
Fix exception handling on i386.


(jmcneill)
diff -r1.24 -r1.25 pkgsrc/emulators/wine/patches/patch-af

cvs diff -r1.24 -r1.25 pkgsrc/emulators/wine/patches/Attic/patch-af (expand / switch to unified diff)

--- pkgsrc/emulators/wine/patches/Attic/patch-af 2008/06/22 23:38:18 1.24
+++ pkgsrc/emulators/wine/patches/Attic/patch-af 2008/06/28 00:12:40 1.25
@@ -1,79 +1,79 @@ @@ -1,79 +1,79 @@
1$NetBSD: patch-af,v 1.24 2008/06/22 23:38:18 dholland Exp $ 1$NetBSD: patch-af,v 1.25 2008/06/28 00:12:40 jmcneill Exp $
2 2
3--- dlls/ntdll/signal_i386.c.orig 2008-06-17 10:07:31.000000000 -0400 3--- dlls/ntdll/signal_i386.c.orig 2008-06-17 10:07:31.000000000 -0400
4+++ dlls/ntdll/signal_i386.c 2008-06-22 13:19:30.000000000 -0400 4+++ dlls/ntdll/signal_i386.c 2008-06-27 18:35:37.000000000 -0400
5@@ -199,7 +199,7 @@ typedef struct trapframe SIGCONTEXT; 5@@ -199,7 +199,7 @@
6  6
7 #endif /* bsdi */ 7 #endif /* bsdi */
8  8
9-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) 9-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
10+#if (defined(__NetBSD__) && (__NetBSD_Version__ < 200000000)) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) 10+#if (defined(__NetBSD__) && (__NetBSD_Version__ < 200000000)) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
11  11
12 typedef struct sigcontext SIGCONTEXT; 12 typedef struct sigcontext SIGCONTEXT;
13  13
14@@ -332,6 +332,39 @@ typedef ucontext_t SIGCONTEXT; 14@@ -332,6 +332,39 @@
15  15
16 #endif /* __APPLE__ */ 16 #endif /* __APPLE__ */
17  17
18+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000) 18+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000)
19+# include <sys/ucontext.h> 19+# include <sys/ucontext.h>
20+# include <sys/types.h> 20+# include <sys/types.h>
21+# include <signal.h> 21+# include <signal.h>
22+ 22+
23+typedef ucontext_t SIGCONTEXT; 23+typedef ucontext_t SIGCONTEXT;
24+ 24+
25+#define EAX_sig(context) ((context)->uc_mcontext.__gregs[_REG_EAX]) 25+#define EAX_sig(context) ((context)->uc_mcontext.__gregs[_REG_EAX])
26+#define EBX_sig(context) ((context)->uc_mcontext.__gregs[_REG_EBX]) 26+#define EBX_sig(context) ((context)->uc_mcontext.__gregs[_REG_EBX])
27+#define ECX_sig(context) ((context)->uc_mcontext.__gregs[_REG_ECX]) 27+#define ECX_sig(context) ((context)->uc_mcontext.__gregs[_REG_ECX])
28+#define EDX_sig(context) ((context)->uc_mcontext.__gregs[_REG_EDX]) 28+#define EDX_sig(context) ((context)->uc_mcontext.__gregs[_REG_EDX])
29+#define ESI_sig(context) ((context)->uc_mcontext.__gregs[_REG_ESI]) 29+#define ESI_sig(context) ((context)->uc_mcontext.__gregs[_REG_ESI])
30+#define EDI_sig(context) ((context)->uc_mcontext.__gregs[_REG_EDI]) 30+#define EDI_sig(context) ((context)->uc_mcontext.__gregs[_REG_EDI])
31+#define EBP_sig(context) ((context)->uc_mcontext.__gregs[_REG_EBP]) 31+#define EBP_sig(context) ((context)->uc_mcontext.__gregs[_REG_EBP])
32+#define ESP_sig(context) (*((unsigned long*)&(context)->uc_mcontext.__gregs[_REG_ESP])) 32+#define ESP_sig(context) _UC_MACHINE_SP(context)
33+ 33+
34+#define CS_sig(context) ((context)->uc_mcontext.__gregs[_REG_CS]) 34+#define CS_sig(context) ((context)->uc_mcontext.__gregs[_REG_CS])
35+#define DS_sig(context) ((context)->uc_mcontext.__gregs[_REG_DS]) 35+#define DS_sig(context) ((context)->uc_mcontext.__gregs[_REG_DS])
36+#define ES_sig(context) ((context)->uc_mcontext.__gregs[_REG_ES]) 36+#define ES_sig(context) ((context)->uc_mcontext.__gregs[_REG_ES])
37+#define SS_sig(context) ((context)->uc_mcontext.__gregs[_REG_SS]) 37+#define SS_sig(context) ((context)->uc_mcontext.__gregs[_REG_SS])
38+#define FS_sig(context) ((context)->uc_mcontext.__gregs[_REG_FS]) 38+#define FS_sig(context) ((context)->uc_mcontext.__gregs[_REG_FS])
39+#define GS_sig(context) ((context)->uc_mcontext.__gregs[_REG_GS]) 39+#define GS_sig(context) ((context)->uc_mcontext.__gregs[_REG_GS])
40+ 40+
41+#define EFL_sig(context) ((context)->uc_mcontext.__gregs[_REG_EFL]) 41+#define EFL_sig(context) ((context)->uc_mcontext.__gregs[_REG_EFL])
42+#define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext.__gregs[_REG_EIP])) 42+#define EIP_sig(context) _UC_MACHINE_PC(context)
43+#define TRAP_sig(context) ((context)->uc_mcontext.__gregs[_REG_TRAPNO]) 43+#define TRAP_sig(context) ((context)->uc_mcontext.__gregs[_REG_TRAPNO])
44+#define ERROR_sig(context) ((context)->uc_mcontext.__gregs[_REG_ERR]) 44+#define ERROR_sig(context) ((context)->uc_mcontext.__gregs[_REG_ERR])
45+ 45+
46+#define FPU_sig(context) NULL 46+#define FPU_sig(context) NULL
47+#define FPUX_sig(context) ((XMM_SAVE_AREA32 *)&((context)->uc_mcontext.__fpregs)) 47+#define FPUX_sig(context) ((XMM_SAVE_AREA32 *)&((context)->uc_mcontext.__fpregs))
48+ 48+
49+#endif /* __NetBSD__ */ 49+#endif /* __NetBSD__ */
50+ 50+
51 WINE_DEFAULT_DEBUG_CHANNEL(seh); 51 WINE_DEFAULT_DEBUG_CHANNEL(seh);
52  52
53 typedef int (*wine_signal_handler)(unsigned int sig); 53 typedef int (*wine_signal_handler)(unsigned int sig);
54@@ -366,8 +399,13 @@ enum i386_trap_code 54@@ -366,8 +399,13 @@
55 TRAP_x86_PAGEFLT = T_PAGEFLT, /* Page fault */ 55 TRAP_x86_PAGEFLT = T_PAGEFLT, /* Page fault */
56 TRAP_x86_ARITHTRAP = T_ARITHTRAP, /* Floating point exception */ 56 TRAP_x86_ARITHTRAP = T_ARITHTRAP, /* Floating point exception */
57 TRAP_x86_ALIGNFLT = T_ALIGNFLT, /* Alignment check exception */ 57 TRAP_x86_ALIGNFLT = T_ALIGNFLT, /* Alignment check exception */
58+#if defined(__NetBSD__) 58+#if defined(__NetBSD__)
59+ TRAP_x86_MCHK = T_MCA, /* Machine check exception */ 59+ TRAP_x86_MCHK = T_MCA, /* Machine check exception */
60+ TRAP_x86_CACHEFLT = T_XMM /* Cache flush exception */ 60+ TRAP_x86_CACHEFLT = T_XMM /* Cache flush exception */
61+#else 61+#else
62 TRAP_x86_MCHK = T_MCHK, /* Machine check exception */ 62 TRAP_x86_MCHK = T_MCHK, /* Machine check exception */
63 TRAP_x86_CACHEFLT = T_XMMFLT /* Cache flush exception */ 63 TRAP_x86_CACHEFLT = T_XMMFLT /* Cache flush exception */
64+#endif 64+#endif
65 #else 65 #else
66 TRAP_x86_DIVIDE = 0, /* Division by zero exception */ 66 TRAP_x86_DIVIDE = 0, /* Division by zero exception */
67 TRAP_x86_TRCTRAP = 1, /* Single-step exception */ 67 TRAP_x86_TRCTRAP = 1, /* Single-step exception */
68@@ -1561,7 +1599,11 @@ BOOL SIGNAL_Init(void) 68@@ -1561,7 +1599,11 @@
69 #endif /* HAVE_SIGALTSTACK */ 69 #endif /* HAVE_SIGALTSTACK */
70  70
71 sig_act.sa_mask = server_block_set; 71 sig_act.sa_mask = server_block_set;
72+#if defined(__NetBSD__) && (__NetBSD_Version__ < 200000000) 72+#if defined(__NetBSD__) && (__NetBSD_Version__ < 200000000)
73+ sig_act.sa_flags = SA_RESTART; 73+ sig_act.sa_flags = SA_RESTART;
74+#else 74+#else
75 sig_act.sa_flags = SA_SIGINFO | SA_RESTART; 75 sig_act.sa_flags = SA_SIGINFO | SA_RESTART;
76+#endif 76+#endif
77 #ifdef SA_ONSTACK 77 #ifdef SA_ONSTACK
78 sig_act.sa_flags |= SA_ONSTACK; 78 sig_act.sa_flags |= SA_ONSTACK;
79 #endif 79 #endif