[Mono-dev] [PATCH 4/8] mini: Add support for BeOS-style signal handlers
Andreas Färber
andreas.faerber at web.de
Wed Mar 31 20:27:55 EDT 2010
Haiku does not support SA_SIGINFO-style signal handlers but supports
a BeOS extension to signal handlers.
This commit is licensed under the MIT X11 license.
---
mono/mini/ChangeLog | 7 +++++++
mono/mini/mini-x86.h | 18 ++++++++++++++++++
mono/mini/mini.h | 6 ++++++
3 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog
index d271c36..e2d5c85 100755
--- a/mono/mini/ChangeLog
+++ b/mono/mini/ChangeLog
@@ -1,5 +1,12 @@
2010-03-30 Andreas Faerber <andreas.faerber at web.de>
+ * mini.h, mini-x86.h: Suppress sigaction for Haiku, add support for
+ BeOS-style signal handlers.
+
+ Code is contributed under MIT/X11 license.
+
+2010-03-30 Andreas Faerber <andreas.faerber at web.de>
+
* mini-posix.c: Fix the build on platforms without SA_SIGINFO (Haiku).
Code is contributed under MIT/X11 license.
diff --git a/mono/mini/mini-x86.h b/mono/mini/mini-x86.h
index 5af560c..1567a61 100644
--- a/mono/mini/mini-x86.h
+++ b/mono/mini/mini-x86.h
@@ -44,6 +44,12 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
#endif /* HOST_WIN32 */
+#ifdef __HAIKU__
+struct sigcontext {
+ vregs regs;
+};
+#endif /* __HAIKU__ */
+
#if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \
defined(__FreeBSD__) || defined(__OpenBSD__)
#define MONO_ARCH_USE_SIGACTION
@@ -59,7 +65,9 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
#ifndef __sun
#define MONO_ARCH_SIGSEGV_ON_ALTSTACK
#endif
+#ifndef __HAIKU__
#define MONO_ARCH_USE_SIGACTION
+#endif /* __HAIKU__ */
#endif /* HAVE_WORKING_SIGALTSTACK */
#endif /* !HOST_WIN32 */
@@ -161,6 +169,16 @@ typedef struct {
# define SC_ESP sc_esp
# define SC_EDI sc_edi
# define SC_ESI sc_esi
+#elif defined(__HAIKU__)
+# define SC_EAX regs.eax
+# define SC_EBX regs._reserved_2[2]
+# define SC_ECX regs.ecx
+# define SC_EDX regs.edx
+# define SC_EBP regs.ebp
+# define SC_EIP regs.eip
+# define SC_ESP regs.esp
+# define SC_EDI regs._reserved_2[0]
+# define SC_ESI regs._reserved_2[1]
#else
# define SC_EAX eax
# define SC_EBX ebx
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index dcf5a49..8d00ad4 100644
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -2106,6 +2106,9 @@ gboolean mono_gdb_render_native_backtraces (void) MONO_INTERNAL;
#ifdef MONO_ARCH_USE_SIGACTION
#define GET_CONTEXT \
void *ctx = context;
+#elif defined(__HAIKU__)
+#define GET_CONTEXT \
+ void *ctx = ®s;
#else
#define GET_CONTEXT \
void **_p = (void **)&_dummy; \
@@ -2120,6 +2123,9 @@ gboolean mono_gdb_render_native_backtraces (void) MONO_INTERNAL;
#elif defined(HOST_WIN32)
#define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, EXCEPTION_RECORD *info, void *context)
#define SIG_HANDLER_PARAMS _dummy, info, context
+#elif defined(__HAIKU__)
+#define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, void *userData, vregs regs)
+#define SIG_HANDLER_PARAMS _dummy, userData, regs
#else
#define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy)
#define SIG_HANDLER_PARAMS _dummy
--
1.7.0.3
More information about the Mono-devel-list
mailing list