Clean up RCS ids
[projects/cmucl/cmucl.git] / src / lisp / sparc-lispregs.h
1 /*
2
3  This code was written as part of the CMU Common Lisp project at
4  Carnegie Mellon University, and has been placed in the public domain.
5
6 */
7
8 #ifndef _SPARC_LISPREGS_H_
9 #define _SPARC_LISPREGS_H_
10
11 #ifdef LANGUAGE_ASSEMBLY
12
13 #ifdef __STDC__
14                                 /* Standard C token concatenation */
15 #define CAT(a,b) a ## b
16
17 #else
18                                 /* Reisser CPP token concatenation */
19 #define CAT(a,b) a/**/b
20
21 #endif
22
23 /*
24  * Note: concatenation to non preprocessor symbols is not defined,
25  * SunPRO C 2.0.1 yields % g0, perfectly valid according to ANSI
26  */
27 #define GREG(num) CAT(%g,num)
28 #define OREG(num) CAT(%o,num)
29 #define LREG(num) CAT(%l,num)
30 #define IREG(num) CAT(%i,num)
31
32 #else
33
34 #define GREG(num) (num)
35 #define OREG(num) ((num)+8)
36 #define LREG(num) ((num)+16)
37 #define IREG(num) ((num)+24)
38
39 #endif
40
41 #define GREG_NUM(num) (num)
42 #define OREG_NUM(num) ((num)+8)
43 #define LREG_NUM(num) ((num)+16)
44 #define IREG_NUM(num) ((num)+24)
45
46 #define NREGS   (32)
47
48 /*
49  * Define all the Lisp registers appropriately for assembly and C.
50  * The registers ending with NUM are meant for use in assembly
51  * routines where we need the register number for getting SC_OFFSET
52  */
53 #define reg_ZERO        GREG(0)
54 #define reg_ZERO_NUM    GREG_NUM(0)
55 #define reg_ALLOC       GREG(1)
56 #define reg_ALLOC_NUM   GREG_NUM(1)
57 #define reg_NIL         GREG(2)
58 #define reg_NIL_NUM     GREG_NUM(2)
59 #define reg_CSP         GREG(3)
60 #define reg_CSP_NUM     GREG_NUM(3)
61 #define reg_CFP         GREG(4)
62 #define reg_CFP_NUM     GREG_NUM(4)
63 #define reg_BSP         GREG(5)
64 #define reg_BSP_NUM     GREG_NUM(5)
65 /* %g6 and %g7 are supposed to be reserved for the system */
66
67 #define reg_NL0         OREG(0)
68 #define reg_NL0_NUM     OREG_NUM(0)
69 #define reg_NL1         OREG(1)
70 #define reg_NL1_NUM     OREG_NUM(1)
71 #define reg_NL2         OREG(2)
72 #define reg_NL2_NUM     OREG_NUM(2)
73 #define reg_NL3         OREG(3)
74 #define reg_NL3_NUM     OREG_NUM(3)
75 #define reg_NL4         OREG(4)
76 #define reg_NL4_NUM     OREG_NUM(4)
77 #define reg_NL5         OREG(5)
78 #define reg_NL5_NUM     OREG_NUM(5)
79 #define reg_NSP         OREG(6)
80 #define reg_NSP_NUM     OREG_NUM(6)
81 #define reg_NARGS       OREG(7)
82 #define reg_NARGS_NUM   OREG_NUM(7)
83
84 #define reg_A0          LREG(0)
85 #define reg_A0_NUM      LREG_NUM(0)
86 #define reg_A1          LREG(1)
87 #define reg_A1_NUM      LREG_NUM(1)
88 #define reg_A2          LREG(2)
89 #define reg_A2_NUM      LREG_NUM(2)
90 #define reg_A3          LREG(3)
91 #define reg_A3_NUM      LREG_NUM(3)
92 #define reg_A4          LREG(4)
93 #define reg_A4_NUM      LREG_NUM(4)
94 #define reg_A5          LREG(5)
95 #define reg_A5_NUM      LREG_NUM(5)
96 #define reg_OCFP        LREG(6)
97 #define reg_OCFP_NUM    LREG_NUM(6)
98 #define reg_LRA         LREG(7)
99 #define reg_LRA_NUM     LREG_NUM(7)
100
101 #define reg_FDEFN       IREG(0)
102 #define reg_FDEFN_NUM   IREG_NUM(0)
103 #define reg_LEXENV      IREG(1)
104 #define reg_LEXENV_NUM  IREG_NUM(1)
105 #define reg_L0          IREG(2)
106 #define reg_L0_NUM      IREG_NUM(2)
107 #define reg_NFP         IREG(3)
108 #define reg_NFP_NUM     IREG_NUM(3)
109 #define reg_CFUNC       IREG(4)
110 #define reg_CFUNC_NUM   IREG_NUM(4)
111 #define reg_CODE        IREG(5)
112 #define reg_CODE_NUM    IREG_NUM(5)
113 #define reg_LIP         IREG(7)
114 #define reg_LIP_NUM     IREG_NUM(7)
115
116 #define REGNAMES \
117         "ZERO",         "ALLOC",        "NULL",         "CSP", \
118         "CFP",          "BSP",          "%g6",          "%g7", \
119         "NL0",          "NL1",          "NL2",          "NL3", \
120         "NL4",          "NL5",          "NSP",          "NARGS", \
121         "A0",           "A1",           "A2",           "A3", \
122         "A4",           "A5",           "OCFP",         "LRA", \
123         "FDEFN",        "LEXENV",       "L0",           "NFP", \
124         "CFUNC",        "CODE",         "???",          "LIP"
125
126 #define BOXED_REGISTERS { \
127     reg_A0, reg_A1, reg_A2, reg_A3, reg_A4, reg_A5, reg_FDEFN, reg_LEXENV, \
128     reg_OCFP, reg_LRA, reg_CODE \
129 }
130
131 #ifndef LANGUAGE_ASSEMBLY
132
133 #ifdef SOLARIS
134
135 #include <ucontext.h>
136
137 extern int *solaris_register_address(struct ucontext *, int);
138
139 #define SC_REG(sc, reg) (*solaris_register_address(sc,reg))
140
141 /* short cuts */
142
143 #define SC_PC(sc) ((sc)->uc_mcontext.gregs[REG_PC])
144 #define SC_NPC(sc) ((sc)->uc_mcontext.gregs[REG_nPC])
145
146 #else
147
148 #define SC_REG(sc, n) (((int *)((sc)->sc_g1))[n])
149 #define SC_PC(sc) ((sc)->sc_pc)
150 #define SC_NPC(sc) ((sc)->sc_npc)
151
152 #endif /* SOLARIS */
153
154 #endif
155
156 #endif /* _SPARC_LISPREGS_H_ */