1 /* x86-lispregs.h -*- Mode: C; -*-
2 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-lispregs.h,v 1.16 2010/12/24 06:01:34 rtoy Exp $
5 #ifndef _X86_LISPREGS_H_
6 #define _X86_LISPREGS_H_
8 /* These register names and offsets correspond to definitions
9 * in compiler/x86/vm.lisp. They map into accessors in the
10 * os dependent <machine/signal.h> structure via the sc_reg
11 * os dependent function.
16 #ifdef LANGUAGE_ASSEMBLY
17 #define REG(num) $ ## num
22 #define reg_EAX REG( 0)
23 #define reg_ECX REG( 2)
24 #define reg_EDX REG( 4)
25 #define reg_EBX REG( 6)
26 #define reg_ESP REG( 8)
27 #define reg_EBP REG(10)
28 #define reg_ESI REG(12)
29 #define reg_EDI REG(14)
31 #define reg_SP reg_ESP
32 #define reg_FP reg_EBP
33 #define reg_NARGS reg_ECX
35 #define REGNAMES "EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI"
37 /* These registers can contain lisp object pointers */
38 #define BOXED_REGISTERS {\
39 reg_EAX, reg_ECX, reg_EDX, reg_EBX, reg_ESI, reg_EDI \
42 /* N is offset in storage class (SC) as defined in vm.lisp.
43 * Ordering in sigcontext is probably os dependent so let
47 #define SC_REG(scp, offset) (*os_sigcontext_reg(scp, offset))
48 #define SC_PC(scp) (*os_sigcontext_pc(scp))
49 #define SC_SP(scp) SC_REG(scp, reg_ESP)
54 #define SC_EFLAGS(sc) ((sc)->uc_mcontext->__ss.__eflags)
57 #define SC_EFLAGS(sc) ((sc)->uc_mcontext->ss.eflags)
59 #elif defined(__linux__)
60 #define SC_EFLAGS(sc) ((sc)->uc_mcontext.gregs[REG_EFL])
61 #elif defined(__NetBSD__)
62 #define SC_EFLAGS(sc) ((sc)->uc_mcontext.__gregs[_REG_EFL])
63 #elif defined(SOLARIS)
65 * Solaris/x86 has access the the eflags value, but this doesn't
66 * currently work. It seems that when we set the EFLAG to enable
67 * single-stepping, we never actually step the new instruction but we
68 * stop at exactly the same place. This is not how it works on other
69 * OSes where we do step an instruction. I (rtoy) do not know why.
70 * Some more work needs to be done in x86-arch.c to make this work.
71 * But the default code there works fine on Solaris/x86.
73 /* #define SC_EFLAGS(sc) ((sc)->uc_mcontext.gregs[EFL])*/
76 #endif /* _X86_LISPREGS_H_ */