]> gitweb.factorcode.org Git - factor.git/blob - vm/os-macosx-x86.h
Initial import
[factor.git] / vm / os-macosx-x86.h
1 #define MACH_EXC_STATE_TYPE i386_exception_state_t
2 #define MACH_EXC_STATE_FLAVOR i386_EXCEPTION_STATE
3 #define MACH_EXC_STATE_COUNT i386_EXCEPTION_STATE_COUNT
4 #define MACH_THREAD_STATE_TYPE i386_thread_state_t
5 #define MACH_THREAD_STATE_FLAVOR i386_THREAD_STATE
6 #define MACH_THREAD_STATE_COUNT i386_THREAD_STATE_COUNT
7
8 #if __DARWIN_UNIX03
9     #define MACH_EXC_STATE_FAULT(exc_state) (exc_state).__faultvaddr
10     #define MACH_STACK_POINTER(thr_state) (thr_state).__esp
11     #define MACH_PROGRAM_COUNTER(thr_state) (thr_state).__eip
12 #else
13     #define MACH_EXC_STATE_FAULT(exc_state) (exc_state).faultvaddr
14     #define MACH_STACK_POINTER(thr_state) (thr_state).esp
15     #define MACH_PROGRAM_COUNTER(thr_state) (thr_state).eip
16 #endif
17
18 /* Adjust stack pointer so we can push an arg */
19 INLINE unsigned long fix_stack_ptr(unsigned long sp)
20 {
21           return sp - (sp & 0xf);
22 }
23
24 INLINE void pass_arg0(MACH_THREAD_STATE_TYPE *thr_state, CELL arg)
25 {
26         *(CELL *)MACH_STACK_POINTER(*thr_state) = arg;
27         MACH_STACK_POINTER(*thr_state) -= CELLS;
28 }