Print this page
XXX AVX procfs
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/ia32/sys/privregs.h
+++ new/usr/src/uts/intel/ia32/sys/privregs.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21
22 22 /*
23 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 #ifndef _IA32_SYS_PRIVREGS_H
28 28 #define _IA32_SYS_PRIVREGS_H
29 29
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 30 #ifdef __cplusplus
33 31 extern "C" {
34 32 #endif
35 33
36 34 /*
37 35 * This file describes the cpu's privileged register set, and
38 36 * how the machine state is saved on the stack when a trap occurs.
39 37 */
40 38
41 39 #if !defined(__i386)
42 40 #error "non-i386 code depends on i386 privileged header!"
43 41 #endif
44 42
45 43 #ifndef _ASM
46 44
47 45 /*
48 46 * This is NOT the structure to use for general purpose debugging;
49 47 * see /proc for that. This is NOT the structure to use to decode
50 48 * the ucontext or grovel about in a core file; see <sys/regset.h>.
51 49 */
52 50
53 51 struct regs {
54 52 /*
55 53 * Extra frame for mdb to follow through high level interrupts and
56 54 * system traps. Set them to 0 to terminate stacktrace.
57 55 */
58 56 greg_t r_savfp; /* a copy of %ebp */
59 57 greg_t r_savpc; /* a copy of %eip */
60 58
61 59 greg_t r_gs;
62 60 greg_t r_fs;
63 61 greg_t r_es;
64 62 greg_t r_ds;
65 63 greg_t r_edi;
66 64 greg_t r_esi;
67 65 greg_t r_ebp;
68 66 greg_t r_esp;
69 67 greg_t r_ebx;
70 68 greg_t r_edx;
71 69 greg_t r_ecx;
72 70 greg_t r_eax;
73 71 greg_t r_trapno;
74 72 greg_t r_err;
75 73 greg_t r_eip;
76 74 greg_t r_cs;
77 75 greg_t r_efl;
78 76 greg_t r_uesp;
79 77 greg_t r_ss;
80 78 };
81 79
82 80 #define r_r0 r_eax /* r0 for portability */
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
83 81 #define r_r1 r_edx /* r1 for portability */
84 82 #define r_fp r_ebp /* system frame pointer */
85 83 #define r_sp r_uesp /* user stack pointer */
86 84 #define r_pc r_eip /* user's instruction pointer */
87 85 #define r_ps r_efl /* user's EFLAGS */
88 86
89 87 #define GREG_NUM 8 /* Number of regs between %edi and %eax */
90 88
91 89 #ifdef _KERNEL
92 90 #define lwptoregs(lwp) ((struct regs *)((lwp)->lwp_regs))
91 +#define lwptofpu(lwp) ((kfpu_t *)((lwp)->lwp_fpu))
93 92 #endif /* _KERNEL */
94 93
95 94 #else /* !_ASM */
96 95
97 96 #if defined(_MACHDEP)
98 97
99 98 #include <sys/machprivregs.h>
100 99
101 100 /*
102 101 * Save current frame on the stack. Uses %eax.
103 102 */
104 103 #define __FRAME_PUSH \
105 104 subl $8, %esp; \
106 105 movl REGOFF_EIP(%esp), %eax; \
107 106 movl %eax, REGOFF_SAVPC(%esp); \
108 107 movl %ebp, REGOFF_SAVFP(%esp);
109 108
110 109 /*
111 110 * Save segment registers on the stack.
112 111 */
113 112 #define __SEGREGS_PUSH \
114 113 subl $16, %esp; \
115 114 movw %ds, 12(%esp); \
116 115 movw %es, 8(%esp); \
117 116 movw %fs, 4(%esp); \
118 117 movw %gs, 0(%esp);
119 118
120 119 /*
121 120 * Load segment register with kernel selectors.
122 121 * %gs must be the last one to be set to make the
123 122 * check in cmnint valid.
124 123 */
125 124 #define __SEGREGS_LOAD_KERNEL \
126 125 movw $KDS_SEL, %cx; \
127 126 movw %cx, %ds; \
128 127 movw %cx, %es; \
129 128 movw $KFS_SEL, %cx; \
130 129 movw $KGS_SEL, %dx; \
131 130 movw %cx, %fs; \
132 131 movw %dx, %gs;
133 132
134 133 /*
135 134 * Restore segment registers off the stack.
136 135 *
137 136 * NOTE THE ORDER IS VITAL!
138 137 *
139 138 * Also note the subtle interdependency with kern_gpfault()
140 139 * that needs to disassemble these instructions to diagnose
141 140 * what happened when things (like bad segment register
142 141 * values) go horribly wrong.
143 142 */
144 143 #define __SEGREGS_POP \
145 144 movw 0(%esp), %gs; \
146 145 movw 4(%esp), %fs; \
147 146 movw 8(%esp), %es; \
148 147 movw 12(%esp), %ds; \
149 148 addl $16, %esp;
150 149
151 150 /*
152 151 * Macros for saving all registers necessary on interrupt entry,
153 152 * and restoring them on exit.
154 153 */
155 154 #define INTR_PUSH \
156 155 cld; \
157 156 pusha; \
158 157 __SEGREGS_PUSH \
159 158 __FRAME_PUSH \
160 159 cmpw $KGS_SEL, REGOFF_GS(%esp); \
161 160 je 8f; \
162 161 movl $0, REGOFF_SAVFP(%esp); \
163 162 __SEGREGS_LOAD_KERNEL \
164 163 8: CLEAN_CS
165 164
166 165 #define __INTR_POP \
167 166 popa; \
168 167 addl $8, %esp; /* get TRAPNO and ERR off the stack */
169 168
170 169 #define INTR_POP_USER \
171 170 addl $8, %esp; /* get extra frame off the stack */ \
172 171 __SEGREGS_POP \
173 172 __INTR_POP
174 173
175 174 #define INTR_POP_KERNEL \
176 175 addl $24, %esp; /* skip extra frame and segment registers */ \
177 176 __INTR_POP
178 177 /*
179 178 * Macros for saving all registers necessary on system call entry,
180 179 * and restoring them on exit.
181 180 */
182 181 #define SYSCALL_PUSH \
183 182 cld; \
184 183 pusha; \
185 184 __SEGREGS_PUSH \
186 185 subl $8, %esp; \
187 186 pushfl; \
188 187 popl %ecx; \
189 188 orl $PS_IE, %ecx; \
190 189 movl %ecx, REGOFF_EFL(%esp); \
191 190 movl $0, REGOFF_SAVPC(%esp); \
192 191 movl $0, REGOFF_SAVFP(%esp); \
193 192 __SEGREGS_LOAD_KERNEL; \
194 193
195 194 #define SYSENTER_PUSH \
196 195 cld; \
197 196 pusha; \
198 197 __SEGREGS_PUSH \
199 198 subl $8, %esp; \
200 199 movl $0, REGOFF_SAVPC(%esp); \
201 200 movl $0, REGOFF_SAVFP(%esp); \
202 201 __SEGREGS_LOAD_KERNEL
203 202
204 203 #define SYSCALL_POP \
205 204 INTR_POP_USER
206 205
207 206 #endif /* _MACHDEP */
208 207
209 208 /*
210 209 * This is used to set eflags to known values at the head of an
211 210 * interrupt gate handler, i.e. interrupts are -already- disabled.
212 211 */
213 212 #define INTGATE_INIT_KERNEL_FLAGS \
214 213 pushl $F_OFF; \
215 214 popfl
216 215
217 216 #endif /* !_ASM */
218 217
219 218 #include <sys/controlregs.h>
220 219
221 220 /* Control register layout for panic dump */
222 221
223 222 #define CREGSZ 36
224 223 #define CREG_GDT 0
225 224 #define CREG_IDT 8
226 225 #define CREG_LDT 16
227 226 #define CREG_TASKR 18
228 227 #define CREG_CR0 20
229 228 #define CREG_CR2 24
230 229 #define CREG_CR3 28
231 230 #define CREG_CR4 32
232 231
233 232 #if !defined(_ASM) && defined(_INT64_TYPE)
234 233
235 234 typedef uint64_t creg64_t;
236 235
237 236 struct cregs {
238 237 creg64_t cr_gdt;
239 238 creg64_t cr_idt;
240 239 uint16_t cr_ldt;
241 240 uint16_t cr_task;
242 241 uint32_t cr_cr0;
243 242 uint32_t cr_cr2;
244 243 uint32_t cr_cr3;
245 244 uint32_t cr_cr4;
246 245 };
247 246
248 247 #if defined(_KERNEL)
249 248 extern void getcregs(struct cregs *);
250 249 #endif /* _KERNEL */
251 250
252 251 #endif /* !_ASM && _INT64_TYPE */
253 252
254 253 #ifdef __cplusplus
255 254 }
256 255 #endif
257 256
258 257 #endif /* !_IA32_SYS_PRIVREGS_H */
↓ open down ↓ |
156 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX