/[cmucl]/src/lisp/sparc-lispregs.h
ViewVC logotype

Contents of /src/lisp/sparc-lispregs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Wed Nov 13 17:14:18 2002 UTC (11 years, 5 months ago) by toy
Branch: MAIN
CVS Tags: snapshot-2003-10, release-18e-base, snapshot-2004-08, remove_negative_zero_not_zero, snapshot-2004-05, snapshot-2004-06, snapshot-2004-07, dynamic-extent-base, mod-arith-base, sparc_gencgc_merge, amd64-merge-start, release-18e-pre2, prm-before-macosx-merge-tag, cold-pcl-base, snapshot-2003-11, release-19a-base, sparc_gencgc, snapshot-2003-12, release-19a-pre1, release-19a-pre3, release-19a-pre2, release-19a, release-18e, snapshot-2004-04, lisp-executable-base, release-18e-pre1
Branch point for: mod-arith-branch, sparc_gencgc_branch, dynamic-extent, lisp-executable, release-18e-branch, cold-pcl, release-19a-branch
Changes since 1.5: +47 -1 lines
File MIME type: text/plain
Add some #defines and macros to make it easier to create (and
understand!) SC_OFFSETs in assembly files.
1 /* $Header: /tiger/var/lib/cvsroots/cmucl/src/lisp/sparc-lispregs.h,v 1.6 2002/11/13 17:14:18 toy Exp $ */
2
3
4
5 #ifdef LANGUAGE_ASSEMBLY
6
7 #ifdef __STDC__
8 /* Standard C token concatenation */
9 #define CAT(a,b) a ## b
10
11 #else
12 /* Reisser CPP token concatenation */
13 #define CAT(a,b) a/**/b
14
15 #endif
16
17 /*
18 * Note: concatenation to non preprocessor symbols is not defined,
19 * SunPRO C 2.0.1 yields % g0, perfectly valid according to ANSI
20 */
21 #define GREG(num) CAT(%g,num)
22 #define OREG(num) CAT(%o,num)
23 #define LREG(num) CAT(%l,num)
24 #define IREG(num) CAT(%i,num)
25
26 #else
27
28 #define GREG(num) (num)
29 #define OREG(num) ((num)+8)
30 #define LREG(num) ((num)+16)
31 #define IREG(num) ((num)+24)
32
33 #endif
34
35 #define GREG_NUM(num) (num)
36 #define OREG_NUM(num) ((num)+8)
37 #define LREG_NUM(num) ((num)+16)
38 #define IREG_NUM(num) ((num)+24)
39
40 #define NREGS (32)
41
42 /*
43 * Define all the Lisp registers appropriately for assembly and C.
44 * The registers ending with NUM are meant for use in assembly
45 * routines where we need the register number for getting SC_OFFSET
46 */
47 #define reg_ZERO GREG(0)
48 #define reg_ZERO_NUM GREG_NUM(0)
49 #define reg_ALLOC GREG(1)
50 #define reg_ALLOC_NUM GREG_NUM(1)
51 #define reg_NIL GREG(2)
52 #define reg_NIL_NUM GREG_NUM(2)
53 #define reg_CSP GREG(3)
54 #define reg_CSP_NUM GREG_NUM(3)
55 #define reg_CFP GREG(4)
56 #define reg_CFP_NUM GREG_NUM(4)
57 #define reg_BSP GREG(5)
58 #define reg_BSP_NUM GREG_NUM(5)
59 /* %g6 and %g7 are supposed to be reserved for the system */
60
61 #define reg_NL0 OREG(0)
62 #define reg_NL0_NUM OREG_NUM(0)
63 #define reg_NL1 OREG(1)
64 #define reg_NL1_NUM OREG_NUM(1)
65 #define reg_NL2 OREG(2)
66 #define reg_NL2_NUM OREG_NUM(2)
67 #define reg_NL3 OREG(3)
68 #define reg_NL3_NUM OREG_NUM(3)
69 #define reg_NL4 OREG(4)
70 #define reg_NL4_NUM OREG_NUM(4)
71 #define reg_NL5 OREG(5)
72 #define reg_NL5_NUM OREG_NUM(5)
73 #define reg_NSP OREG(6)
74 #define reg_NSP_NUM OREG_NUM(6)
75 #define reg_NARGS OREG(7)
76 #define reg_NARGS_NUM OREG_NUM(7)
77
78 #define reg_A0 LREG(0)
79 #define reg_A0_NUM LREG_NUM(0)
80 #define reg_A1 LREG(1)
81 #define reg_A1_NUM LREG_NUM(1)
82 #define reg_A2 LREG(2)
83 #define reg_A2_NUM LREG_NUM(2)
84 #define reg_A3 LREG(3)
85 #define reg_A3_NUM LREG_NUM(3)
86 #define reg_A4 LREG(4)
87 #define reg_A4_NUM LREG_NUM(4)
88 #define reg_A5 LREG(5)
89 #define reg_A5_NUM LREG_NUM(5)
90 #define reg_OCFP LREG(6)
91 #define reg_OCFP_NUM LREG_NUM(6)
92 #define reg_LRA LREG(7)
93 #define reg_LRA_NUM LREG_NUM(7)
94
95 #define reg_FDEFN IREG(0)
96 #define reg_FDEFN_NUM IREG_NUM(0)
97 #define reg_LEXENV IREG(1)
98 #define reg_LEXENV_NUM IREG_NUM(1)
99 #define reg_L0 IREG(2)
100 #define reg_L0_NUM IREG_NUM(2)
101 #define reg_NFP IREG(3)
102 #define reg_NFP_NUM IREG_NUM(3)
103 #define reg_CFUNC IREG(4)
104 #define reg_CFUNC_NUM IREG_NUM(4)
105 #define reg_CODE IREG(5)
106 #define reg_CODE_NUM IREG_NUM(5)
107 #define reg_LIP IREG(7)
108 #define reg_LIP_NUM IREG_NUM(7)
109
110 /*
111 * Macros to compute the SC_OFFSET value. See read-var-integer and
112 * sc-offset and friends in debug-info.lisp
113 */
114 #define SC_OFFSET_HI(sc, reg) ((SC_OFFSET(sc,reg)) >> 8)
115 #define SC_OFFSET_LO(sc, reg) ((SC_OFFSET(sc,reg)) & 0xff)
116
117 #define REGNAMES \
118 "ZERO", "ALLOC", "NULL", "CSP", \
119 "CFP", "BSP", "%g6", "%g7", \
120 "NL0", "NL1", "NL2", "NL3", \
121 "NL4", "NL5", "NSP", "NARGS", \
122 "A0", "A1", "A2", "A3", \
123 "A4", "A5", "OCFP", "LRA", \
124 "FDEFN", "LEXENV", "L0", "NFP", \
125 "CFUNC", "CODE", "???", "LIP"
126
127 #define BOXED_REGISTERS { \
128 reg_A0, reg_A1, reg_A2, reg_A3, reg_A4, reg_A5, reg_FDEFN, reg_LEXENV, \
129 reg_OCFP, reg_LRA, reg_L0, reg_CODE \
130 }
131
132 #ifndef LANGUAGE_ASSEMBLY
133
134 #ifdef SOLARIS
135
136 #include <ucontext.h>
137
138 extern int * solaris_register_address(struct ucontext *, int);
139
140 #define SC_REG(sc, reg) (*solaris_register_address(sc,reg))
141
142 /* short cuts */
143
144 #define SC_PC(sc) ((sc)->uc_mcontext.gregs[REG_PC])
145 #define SC_NPC(sc) ((sc)->uc_mcontext.gregs[REG_nPC])
146
147 #else
148
149 #define SC_REG(sc, n) (((int *)((sc)->sc_g1))[n])
150 #define SC_PC(sc) ((sc)->sc_pc)
151 #define SC_NPC(sc) ((sc)->sc_npc)
152
153 #endif /* SOLARIS */
154
155 #endif

  ViewVC Help
Powered by ViewVC 1.1.5