Merge branch 'master' of git://factorcode.org/git/factor
[factor/jcg.git] / vm / os-macosx-x86.64.h
blobb11aa80ce8f4a3161aacf0eee47ead540121bd4f
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 and Daniel Ehrenberg */
11 #include <ucontext.h>
13 #define MACH_EXC_STATE_TYPE x86_exception_state64_t
14 #define MACH_EXC_STATE_FLAVOR x86_EXCEPTION_STATE64
15 #define MACH_EXC_STATE_COUNT x86_EXCEPTION_STATE64_COUNT
16 #define MACH_THREAD_STATE_TYPE x86_thread_state64_t
17 #define MACH_THREAD_STATE_FLAVOR x86_THREAD_STATE64
18 #define MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
20 #if __DARWIN_UNIX03
21 #define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->__faultvaddr
22 #define MACH_STACK_POINTER(thr_state) (thr_state)->__rsp
23 #define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->__rip
24 #define UAP_PROGRAM_COUNTER(ucontext) \
25 MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->__ss))
26 #else
27 #define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->faultvaddr
28 #define MACH_STACK_POINTER(thr_state) (thr_state)->rsp
29 #define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->rip
30 #define UAP_PROGRAM_COUNTER(ucontext) \
31 MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
32 #endif
34 INLINE CELL fix_stack_pointer(CELL sp)
36 return ((sp + 8) & ~15) - 8;