summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-23 03:54:42 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-23 03:54:42 (GMT)
commite29c109d2afa62068528c0adaa3b42dee557cba9 (patch)
treef1f6ace8a3a8c74fc012cec15dca0071dc0a4059 /signal.c
parente3120abd58e7ee2f29a57c658526e5d84aa7b4fe (diff)
Haiku now best effort support
* configure.in: remove obsolete workarounds for Haiku. * dln.c, file.c, io.c: remove obsolete Haiku workarounds. * thread_pthread.c: add stack bounds detection for Haiku. * signal.c: get stack pointer from signal context on Haiku. [ruby-core:67923] [Bug #10811] [Fix GH-1109] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/signal.c b/signal.c
index d413bac..703a778 100644
--- a/signal.c
+++ b/signal.c
@@ -69,7 +69,7 @@ ruby_atomic_compare_and_swap(rb_atomic_t *ptr, rb_atomic_t cmp,
}
#endif
-#if defined(__BEOS__) || defined(__HAIKU__)
+#if defined(__BEOS__)
#undef SIGBUS
#endif
@@ -759,7 +759,9 @@ static const char *received_signal;
#if defined(USE_SIGALTSTACK) || defined(_WIN32)
NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
-# if !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
+# if defined __HAIKU__
+# define USE_UCONTEXT_REG 1
+# elif !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
# elif defined __linux__
# define USE_UCONTEXT_REG 1
# elif defined __APPLE__
@@ -790,6 +792,12 @@ check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
# else
const __register_t sp = mctx->mc_esp;
# endif
+# elif defined __HAIKU__
+# if defined(__amd64__)
+ const unsigned long sp = mctx->rsp;
+# else
+ const unsigned long sp = mctx->esp;
+# endif
# endif
enum {pagesize = 4096};
const uintptr_t sp_page = (uintptr_t)sp / pagesize;