From c5a6f75488e3703b624169266e8e059350b8de76 Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 7 Jul 2006 04:15:31 +0000 Subject: [PATCH] Eliminate another #ifdef --- vm/mach_signal.c | 9 +-------- vm/os-macosx-ppc.h | 5 +++++ vm/os-macosx-x86.h | 7 +++++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/vm/mach_signal.c b/vm/mach_signal.c index 6023b8ce5e..13d0da5b94 100644 --- a/vm/mach_signal.c +++ b/vm/mach_signal.c @@ -69,17 +69,10 @@ catch_exception_raise (mach_port_t exception_port, sp = (unsigned long) (SIGSEGV_STACK_POINTER (thread_state)); -#ifdef __i386__ - if ((sp & 0xf) != 0) - sp -= (sp & 0xf); - - sp -= 4; -#endif - save_thread_state = thread_state; SIGSEGV_PROGRAM_COUNTER (thread_state) = (unsigned long) terminating_handler; - SIGSEGV_STACK_POINTER (thread_state) = sp; + SIGSEGV_STACK_POINTER (thread_state) = fix_stack_ptr(sp); /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_set_state.html. */ if (thread_set_state (thread, SIGSEGV_THREAD_STATE_FLAVOR, diff --git a/vm/os-macosx-ppc.h b/vm/os-macosx-ppc.h index 932b2253e3..6faf0c0de1 100644 --- a/vm/os-macosx-ppc.h +++ b/vm/os-macosx-ppc.h @@ -6,3 +6,8 @@ #define SIGSEGV_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT #define SIGSEGV_STACK_POINTER(thr_state) (thr_state).r1 #define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).srr0 + +INLINE void fix_stack_ptr(unsigned long sp) +{ + return sp; +} diff --git a/vm/os-macosx-x86.h b/vm/os-macosx-x86.h index a0cb850fd0..5257ca6452 100644 --- a/vm/os-macosx-x86.h +++ b/vm/os-macosx-x86.h @@ -6,3 +6,10 @@ #define SIGSEGV_THREAD_STATE_COUNT i386_THREAD_STATE_COUNT #define SIGSEGV_STACK_POINTER(thr_state) (thr_state).esp #define SIGSEGV_PROGRAM_COUNTER(thr_state) (thr_state).eip + +INLINE void fix_stack_ptr(unsigned long sp) +{ + if ((sp & 0xf) != 0) sp -= (sp & 0xf); + sp -= 4; + return sp; +}