Merge branch 'master' of git://factorcode.org/git/factor
[factor/jcg.git] / vm / os-macosx-ppc.h
blob13213acbbc06c05502cdf801438d3cde5a747fe9
1 /* Fault handler information. MacOSX version.
2 Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
3 Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
5 Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
6 2005-03-10:
8 http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
10 Modified for Factor by Slava Pestov */
11 #include <ucontext.h>
13 #define FRAME_RETURN_ADDRESS(frame) *((XT *)(frame_successor(frame) + 1) + 2)
15 #define MACH_EXC_STATE_TYPE ppc_exception_state_t
16 #define MACH_EXC_STATE_FLAVOR PPC_EXCEPTION_STATE
17 #define MACH_EXC_STATE_COUNT PPC_EXCEPTION_STATE_COUNT
18 #define MACH_THREAD_STATE_TYPE ppc_thread_state_t
19 #define MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE
20 #define MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
22 #if __DARWIN_UNIX03
23 #define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->__dar
24 #define MACH_STACK_POINTER(thr_state) (thr_state)->__r1
25 #define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->__srr0
26 #define UAP_PROGRAM_COUNTER(ucontext) \
27 MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->__ss))
28 #else
29 #define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->dar
30 #define MACH_STACK_POINTER(thr_state) (thr_state)->r1
31 #define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->srr0
32 #define UAP_PROGRAM_COUNTER(ucontext) \
33 MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
34 #endif
36 INLINE CELL fix_stack_pointer(CELL sp)
38 return sp;