1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_PROCFS_ISA_H
#define _SYS_PROCFS_ISA_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Instruction Set Architecture specific component of <sys/procfs.h>
* sparc v8/v9 version
*/
#include <sys/regset.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Possible values of pr_dmodel.
* This isn't isa-specific, but it needs to be defined here for other reasons.
*/
#define PR_MODEL_UNKNOWN 0
#define PR_MODEL_ILP32 1 /* process data model is ILP32 */
#define PR_MODEL_LP64 2 /* process data model is LP64 */
/*
* To determine whether application is running native.
*/
#if defined(_LP64)
#define PR_MODEL_NATIVE PR_MODEL_LP64
#elif defined(_ILP32)
#define PR_MODEL_NATIVE PR_MODEL_ILP32
#else
#error "No DATAMODEL_NATIVE specified"
#endif /* _LP64 || _ILP32 */
/*
* Holds one sparc instruction, for both ILP32 and LP64.
*/
typedef uint32_t instr_t;
/*
* General register access (sparc).
* Don't confuse definitions here with definitions in <sys/regset.h>.
* Registers are 32 bits for ILP32, 64 bits for LP64.
*/
#define NPRGREG 38
#if defined(_LP64) || defined(_I32LPx)
typedef long prgreg_t;
#else
typedef int prgreg_t;
#endif
typedef prgreg_t prgregset_t[NPRGREG];
#define R_G0 0
#define R_G1 1
#define R_G2 2
#define R_G3 3
#define R_G4 4
#define R_G5 5
#define R_G6 6
#define R_G7 7
#define R_O0 8
#define R_O1 9
#define R_O2 10
#define R_O3 11
#define R_O4 12
#define R_O5 13
#define R_O6 14
#define R_O7 15
#define R_L0 16
#define R_L1 17
#define R_L2 18
#define R_L3 19
#define R_L4 20
#define R_L5 21
#define R_L6 22
#define R_L7 23
#define R_I0 24
#define R_I1 25
#define R_I2 26
#define R_I3 27
#define R_I4 28
#define R_I5 29
#define R_I6 30
#define R_I7 31
#ifdef __sparcv9
#define R_CCR 32 /* v9 condition code register */
#else
#define R_PSR 32 /* v7/v8 processor status register */
#endif
#define R_PC 33
#define R_nPC 34
#define R_Y 35
#ifdef __sparcv9
#define R_ASI 36
#define R_FPRS 37
#else
#define R_WIM 36
#define R_TBR 37
#endif
/*
* The following defines are for portability.
*/
#ifdef __sparcv9
#define R_PS R_CCR
#else
#define R_PS R_PSR
#endif
#define R_SP R_O6
#define R_FP R_I6
#define R_R0 R_O0
#define R_R1 R_O1
#if defined(_SYSCALL32)
/*
* kernel view of the _ILP32 register set
*/
typedef int32_t prgreg32_t;
typedef prgreg32_t prgregset32_t[NPRGREG];
#define R_PSR 32
#define R_WIM 36
#define R_TBR 37
#endif
/*
* Floating-point register access (sparc FPU).
* See <sys/regset.h> for details of interpretation.
*/
#ifdef __sparcv9
typedef struct prfpregset {
union { /* FPU floating point regs */
uint32_t pr_regs[32]; /* 32 singles */
double pr_dregs[32]; /* 32 doubles */
long double pr_qregs[16]; /* 16 quads */
} pr_fr;
uint64_t pr_filler;
uint64_t pr_fsr; /* FPU status register */
uint8_t pr_qcnt; /* # of entries in saved FQ */
uint8_t pr_q_entrysize; /* # of bytes per FQ entry */
uint8_t pr_en; /* flag signifying fpu in use */
char pr_pad[13]; /* ensure sizeof(prfpregset)%16 == 0 */
struct fq pr_q[16]; /* contains the FQ array */
} prfpregset_t;
#else
typedef struct prfpregset {
union { /* FPU floating point regs */
uint32_t pr_regs[32]; /* 32 singles */
double pr_dregs[16]; /* 16 doubles */
} pr_fr;
uint32_t pr_filler;
uint32_t pr_fsr; /* FPU status register */
uint8_t pr_qcnt; /* # of entries in saved FQ */
uint8_t pr_q_entrysize; /* # of bytes per FQ entry */
uint8_t pr_en; /* flag signifying fpu in use */
struct fq pr_q[32]; /* contains the FQ array */
} prfpregset_t;
#endif /* __sparcv9 */
#if defined(_SYSCALL32)
/*
* kernel view of the _ILP32 floating point register set
*/
typedef struct prfpregset32 {
union { /* FPU floating point regs */
uint32_t pr_regs[32]; /* 32 singles */
double pr_dregs[16]; /* 16 doubles */
} pr_fr;
uint32_t pr_filler;
uint32_t pr_fsr; /* FPU status register */
uint8_t pr_qcnt; /* # of entries in saved FQ */
uint8_t pr_q_entrysize; /* # of bytes per FQ entry */
uint8_t pr_en; /* flag signifying fpu in use */
struct fq32 pr_q[32]; /* contains the FQ array */
} prfpregset32_t;
#endif /* _SYSCALL32 */
/*
* Extra register access
*/
#define XR_G0 0
#define XR_G1 1
#define XR_G2 2
#define XR_G3 3
#define XR_G4 4
#define XR_G5 5
#define XR_G6 6
#define XR_G7 7
#define NPRXGREG 8
#define XR_O0 0
#define XR_O1 1
#define XR_O2 2
#define XR_O3 3
#define XR_O4 4
#define XR_O5 5
#define XR_O6 6
#define XR_O7 7
#define NPRXOREG 8
#define NPRXFILLER 8
#define XR_TYPE_V8P 1 /* interpret union as pr_v8p */
typedef struct prxregset {
uint32_t pr_type; /* how to interpret union */
uint32_t pr_align; /* alignment for the union */
union {
struct pr_v8p {
union { /* extra FP registers */
uint32_t pr_regs[32];
double pr_dregs[16];
#ifndef __sparcv9 /* 32-bit alignment problem */
long double pr_qregs[8];
#endif
} pr_xfr;
uint32_t pr_xfsr; /* upper 32bits, FP state reg */
uint32_t pr_fprs; /* FP registers state */
uint32_t pr_xg[NPRXGREG]; /* upper 32bits, G registers */
uint32_t pr_xo[NPRXOREG]; /* upper 32bits, O registers */
uint64_t pr_tstate; /* TSTATE register */
uint32_t pr_filler[NPRXFILLER];
} pr_v8p;
} pr_un;
} prxregset_t;
/*
* Given a pointer to a prxregset structure, this macro yields the value
* of the %gsr embedded in the structure. It is an lvalue, so it can
* be used to assign the value of the %gsr into the structure.
* (Please don't ask why this is done this way.)
*/
#define PRXREG_GSR(xrp) (*(uint64_t *)((xrp)->pr_un.pr_v8p.pr_filler))
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PROCFS_ISA_H */
|