]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
8f6c56a5 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
8f6c56a5 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
8ad349bb | 24 | * limitations under the License. |
8f6c56a5 A |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
1c79356b A |
27 | */ |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
31 | /* | |
32 | * Mach Operating System | |
33 | * Copyright (c) 1991,1990,1989 Carnegie Mellon University | |
34 | * All Rights Reserved. | |
35 | * | |
36 | * Permission to use, copy, modify and distribute this software and its | |
37 | * documentation is hereby granted, provided that both the copyright | |
38 | * notice and this permission notice appear in all copies of the | |
39 | * software, derivative works or modified versions, and any portions | |
40 | * thereof, and that both notices appear in supporting documentation. | |
41 | * | |
42 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
43 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
44 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
45 | * | |
46 | * Carnegie Mellon requests users of this software to return to | |
47 | * | |
48 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
49 | * School of Computer Science | |
50 | * Carnegie Mellon University | |
51 | * Pittsburgh PA 15213-3890 | |
52 | * | |
53 | * any improvements or extensions that they make and grant Carnegie Mellon | |
54 | * the rights to redistribute these changes. | |
55 | */ | |
56 | /* | |
57 | */ | |
58 | /* | |
59 | * File: thread_status.h | |
60 | * Author: Avadis Tevanian, Jr. | |
61 | * Date: 1985 | |
62 | * | |
63 | * This file contains the structure definitions for the thread | |
64 | * state as applied to I386 processors. | |
65 | */ | |
66 | ||
67 | #ifndef _MACH_I386_THREAD_STATUS_H_ | |
68 | #define _MACH_I386_THREAD_STATUS_H_ | |
69 | ||
91447636 | 70 | #include <mach/message.h> |
1c79356b A |
71 | #include <mach/i386/fp_reg.h> |
72 | #include <mach/i386/thread_state.h> | |
21362eb3 A |
73 | #include <architecture/i386/frame.h> /* FIXME */ |
74 | #include <architecture/i386/fpu.h> /* FIXME */ | |
1c79356b | 75 | /* |
21362eb3 A |
76 | * i386_thread_state this is the structure that is exported |
77 | * to user threads for use in status/mutate | |
78 | * calls. This structure should never | |
79 | * change. | |
80 | * | |
81 | * i386_float_state exported to use threads for access to | |
82 | * floating point registers. Try not to | |
83 | * change this one, either. | |
84 | * | |
85 | * i386_isa_port_map_state exported to user threads to allow | |
86 | * selective in/out operations | |
87 | * | |
88 | * i386_v86_assist_state | |
8ad349bb | 89 | * |
21362eb3 | 90 | * thread_syscall_state |
c0fea474 A |
91 | */ |
92 | ||
21362eb3 A |
93 | /* THREAD_STATE_FLAVOR_LIST 0 */ |
94 | #define i386_NEW_THREAD_STATE 1 /* used to be i386_THREAD_STATE */ | |
95 | #define i386_FLOAT_STATE 2 | |
96 | #define i386_ISA_PORT_MAP_STATE 3 | |
97 | #define i386_V86_ASSIST_STATE 4 | |
98 | #define i386_REGS_SEGS_STATE 5 | |
99 | #define THREAD_SYSCALL_STATE 6 | |
100 | #define THREAD_STATE_NONE 7 | |
101 | #define i386_SAVED_STATE 8 | |
c0fea474 A |
102 | |
103 | ||
104 | /* | |
21362eb3 | 105 | * x86-64 compatibility |
c0fea474 A |
106 | * THREAD_STATE_FLAVOR_LIST 0 |
107 | * these are the supported flavors | |
1c79356b | 108 | */ |
c0fea474 A |
109 | #define x86_THREAD_STATE32 1 |
110 | #define x86_FLOAT_STATE32 2 | |
111 | #define x86_EXCEPTION_STATE32 3 | |
112 | #define x86_THREAD_STATE64 4 | |
113 | #define x86_FLOAT_STATE64 5 | |
114 | #define x86_EXCEPTION_STATE64 6 | |
115 | #define x86_THREAD_STATE 7 | |
116 | #define x86_FLOAT_STATE 8 | |
117 | #define x86_EXCEPTION_STATE 9 | |
118 | #define x86_DEBUG_STATE32 10 | |
119 | #define x86_DEBUG_STATE64 11 | |
120 | #define x86_DEBUG_STATE 12 | |
8ad349bb | 121 | |
8ad349bb | 122 | |
8f6c56a5 A |
123 | |
124 | /* | |
89b3af67 A |
125 | * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed |
126 | * an exception flavor will return if that is a defined flavor for that | |
127 | * platform. The macro must be manually updated to include all of the valid | |
128 | * exception flavors as defined above. | |
8f6c56a5 | 129 | */ |
21362eb3 A |
130 | #define VALID_THREAD_STATE_FLAVOR(x) \ |
131 | ((x == i386_NEW_THREAD_STATE) || \ | |
132 | (x == i386_FLOAT_STATE) || \ | |
133 | (x == i386_ISA_PORT_MAP_STATE) || \ | |
134 | (x == i386_V86_ASSIST_STATE) || \ | |
135 | (x == i386_REGS_SEGS_STATE) || \ | |
136 | (x == THREAD_SYSCALL_STATE) || \ | |
137 | (x == THREAD_STATE_NONE) || \ | |
138 | (x == i386_SAVED_STATE)) | |
8f6c56a5 | 139 | |
8f6c56a5 | 140 | |
21362eb3 A |
141 | /* |
142 | * x86-64 compatibility | |
143 | */ | |
89b3af67 A |
144 | struct x86_state_hdr { |
145 | int flavor; | |
146 | int count; | |
8f6c56a5 | 147 | }; |
89b3af67 | 148 | typedef struct x86_state_hdr x86_state_hdr_t; |
8f6c56a5 | 149 | |
8f6c56a5 | 150 | |
21362eb3 A |
151 | /* |
152 | * This structure is used for both | |
153 | * i386_THREAD_STATE and i386_REGS_SEGS_STATE. | |
154 | */ | |
155 | struct i386_new_thread_state { | |
156 | unsigned int gs; | |
157 | unsigned int fs; | |
158 | unsigned int es; | |
159 | unsigned int ds; | |
160 | unsigned int edi; | |
161 | unsigned int esi; | |
162 | unsigned int ebp; | |
163 | unsigned int esp; | |
164 | unsigned int ebx; | |
165 | unsigned int edx; | |
166 | unsigned int ecx; | |
167 | unsigned int eax; | |
168 | unsigned int eip; | |
169 | unsigned int cs; | |
170 | unsigned int efl; | |
171 | unsigned int uesp; | |
172 | unsigned int ss; | |
173 | }; | |
174 | #define i386_NEW_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ | |
175 | (sizeof (struct i386_new_thread_state)/sizeof(unsigned int))) | |
176 | ||
177 | /* | |
178 | * Subset of saved state stored by processor on kernel-to-kernel | |
179 | * trap. (Used by ddb to examine state guaranteed to be present | |
180 | * on all traps into debugger.) | |
181 | */ | |
182 | struct i386_saved_state_from_kernel { | |
183 | unsigned int gs; | |
184 | unsigned int fs; | |
185 | unsigned int es; | |
186 | unsigned int ds; | |
187 | unsigned int edi; | |
188 | unsigned int esi; | |
189 | unsigned int ebp; | |
190 | unsigned int esp; /* kernel esp stored by pusha - | |
191 | we save cr2 here later */ | |
192 | unsigned int ebx; | |
193 | unsigned int edx; | |
194 | unsigned int ecx; | |
195 | unsigned int eax; | |
196 | unsigned int trapno; | |
197 | unsigned int err; | |
198 | unsigned int eip; | |
199 | unsigned int cs; | |
200 | unsigned int efl; | |
201 | }; | |
202 | ||
203 | /* | |
204 | * The format in which thread state is saved by Mach on this machine. This | |
205 | * state flavor is most efficient for exception RPC's to kernel-loaded | |
206 | * servers, because copying can be avoided: | |
207 | */ | |
208 | struct i386_saved_state { | |
209 | unsigned int gs; | |
210 | unsigned int fs; | |
211 | unsigned int es; | |
212 | unsigned int ds; | |
213 | unsigned int edi; | |
214 | unsigned int esi; | |
215 | unsigned int ebp; | |
216 | unsigned int esp; /* kernel esp stored by pusha - | |
217 | we save cr2 here later */ | |
218 | unsigned int ebx; | |
219 | unsigned int edx; | |
220 | unsigned int ecx; | |
221 | unsigned int eax; | |
222 | unsigned int trapno; | |
223 | unsigned int err; | |
224 | unsigned int eip; | |
225 | unsigned int cs; | |
226 | unsigned int efl; | |
227 | unsigned int uesp; | |
228 | unsigned int ss; | |
229 | struct v86_segs { | |
230 | unsigned int v86_es; /* virtual 8086 segment registers */ | |
231 | unsigned int v86_ds; | |
232 | unsigned int v86_fs; | |
233 | unsigned int v86_gs; | |
234 | } v86_segs; | |
235 | #define i386_SAVED_ARGV_COUNT 7 | |
236 | unsigned int argv_status; /* Boolean flag indicating whether or | |
237 | * not Mach copied in the args */ | |
238 | unsigned int argv[i386_SAVED_ARGV_COUNT]; | |
239 | /* The return address, and the first several | |
240 | * function call args from the stack, for | |
241 | * efficient syscall exceptions */ | |
242 | }; | |
243 | #define i386_SAVED_STATE_COUNT ((mach_msg_type_number_t) \ | |
244 | (sizeof (struct i386_saved_state)/sizeof(unsigned int))) | |
245 | #define i386_REGS_SEGS_STATE_COUNT i386_SAVED_STATE_COUNT | |
246 | ||
247 | /* | |
248 | * Machine-independent way for servers and Mach's exception mechanism to | |
249 | * choose the most efficient state flavor for exception RPC's: | |
250 | */ | |
251 | #define MACHINE_THREAD_STATE i386_SAVED_STATE | |
252 | #define MACHINE_THREAD_STATE_COUNT 144 | |
253 | ||
254 | /* | |
255 | * Largest state on this machine: | |
256 | * (be sure mach/machine/thread_state.h matches!) | |
257 | */ | |
258 | #define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX | |
259 | ||
260 | /* | |
261 | * Floating point state. | |
262 | * | |
263 | * fpkind tells in what way floating point operations are supported. | |
264 | * See the values for fp_kind in <mach/i386/fp_reg.h>. | |
265 | * | |
266 | * If the kind is FP_NO, then calls to set the state will fail, and | |
267 | * thread_getstatus will return garbage for the rest of the state. | |
268 | * If "initialized" is false, then the rest of the state is garbage. | |
269 | * Clients can set "initialized" to false to force the coprocessor to | |
270 | * be reset. | |
271 | * "exc_status" is non-zero if the thread has noticed (but not | |
272 | * proceeded from) a coprocessor exception. It contains the status | |
273 | * word with the exception bits set. The status word in "fp_status" | |
274 | * will have the exception bits turned off. If an exception bit in | |
275 | * "fp_status" is turned on, then "exc_status" should be zero. This | |
276 | * happens when the coprocessor exception is noticed after the system | |
277 | * has context switched to some other thread. | |
278 | * | |
279 | * If kind is FP_387, then "state" is a i387_state. Other kinds might | |
280 | * also use i387_state, but somebody will have to verify it (XXX). | |
281 | * Note that the registers are ordered from top-of-stack down, not | |
282 | * according to physical register number. | |
283 | */ | |
284 | ||
285 | /* | |
286 | * x86-64 compatibility | |
287 | */ | |
288 | /* defn of 80bit x87 FPU or MMX register */ | |
289 | struct mmst_reg { | |
290 | char mmst_reg[10]; | |
291 | char mmst_rsrv[6]; | |
292 | }; | |
293 | ||
294 | ||
295 | /* defn of 128 bit XMM regs */ | |
296 | struct xmm_reg { | |
297 | char xmm_reg[16]; | |
298 | }; | |
299 | ||
300 | #define FP_STATE_BYTES 512 | |
301 | ||
302 | struct i386_float_state { | |
303 | int fpkind; /* FP_NO..FP_387 (readonly) */ | |
304 | int initialized; | |
305 | unsigned char hw_state[FP_STATE_BYTES]; /* actual "hardware" state */ | |
306 | int exc_status; /* exception status (readonly) */ | |
307 | }; | |
308 | #define i386_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \ | |
309 | (sizeof(struct i386_float_state)/sizeof(unsigned int))) | |
310 | ||
311 | /* | |
312 | * x86-64 compatibility | |
313 | */ | |
314 | typedef struct { | |
315 | int fpu_reserved[2]; | |
316 | fp_control_t fpu_fcw; /* x87 FPU control word */ | |
317 | fp_status_t fpu_fsw; /* x87 FPU status word */ | |
318 | uint8_t fpu_ftw; /* x87 FPU tag word */ | |
319 | uint8_t fpu_rsrv1; /* reserved */ | |
320 | uint16_t fpu_fop; /* x87 FPU Opcode */ | |
321 | uint32_t fpu_ip; /* x87 FPU Instruction Pointer offset */ | |
322 | uint16_t fpu_cs; /* x87 FPU Instruction Pointer Selector */ | |
323 | uint16_t fpu_rsrv2; /* reserved */ | |
324 | uint32_t fpu_dp; /* x87 FPU Instruction Operand(Data) Pointer offset */ | |
325 | uint16_t fpu_ds; /* x87 FPU Instruction Operand(Data) Pointer Selector */ | |
326 | uint16_t fpu_rsrv3; /* reserved */ | |
327 | uint32_t fpu_mxcsr; /* MXCSR Register state */ | |
328 | uint32_t fpu_mxcsrmask; /* MXCSR mask */ | |
329 | struct mmst_reg fpu_stmm0; /* ST0/MM0 */ | |
330 | struct mmst_reg fpu_stmm1; /* ST1/MM1 */ | |
331 | struct mmst_reg fpu_stmm2; /* ST2/MM2 */ | |
332 | struct mmst_reg fpu_stmm3; /* ST3/MM3 */ | |
333 | struct mmst_reg fpu_stmm4; /* ST4/MM4 */ | |
334 | struct mmst_reg fpu_stmm5; /* ST5/MM5 */ | |
335 | struct mmst_reg fpu_stmm6; /* ST6/MM6 */ | |
336 | struct mmst_reg fpu_stmm7; /* ST7/MM7 */ | |
337 | struct xmm_reg fpu_xmm0; /* XMM 0 */ | |
338 | struct xmm_reg fpu_xmm1; /* XMM 1 */ | |
339 | struct xmm_reg fpu_xmm2; /* XMM 2 */ | |
340 | struct xmm_reg fpu_xmm3; /* XMM 3 */ | |
341 | struct xmm_reg fpu_xmm4; /* XMM 4 */ | |
342 | struct xmm_reg fpu_xmm5; /* XMM 5 */ | |
343 | struct xmm_reg fpu_xmm6; /* XMM 6 */ | |
344 | struct xmm_reg fpu_xmm7; /* XMM 7 */ | |
345 | char fpu_rsrv4[14*16]; /* reserved */ | |
346 | int fpu_reserved1; | |
347 | } i386_float_state_t; | |
348 | ||
349 | ||
350 | #define FP_old_STATE_BYTES ((mach_msg_type_number_t) \ | |
351 | (sizeof (struct i386_fp_save) + sizeof (struct i386_fp_regs))) | |
352 | ||
353 | struct i386_old_float_state { | |
354 | int fpkind; /* FP_NO..FP_387 (readonly) */ | |
355 | int initialized; | |
356 | unsigned char hw_state[FP_old_STATE_BYTES]; /* actual "hardware" state */ | |
357 | int exc_status; /* exception status (readonly) */ | |
358 | }; | |
359 | #define i386_old_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \ | |
360 | (sizeof(struct i386_old_float_state)/sizeof(unsigned int))) | |
361 | ||
362 | ||
363 | #define PORT_MAP_BITS 0x400 | |
364 | struct i386_isa_port_map_state { | |
365 | unsigned char pm[PORT_MAP_BITS>>3]; | |
366 | }; | |
367 | ||
368 | #define i386_ISA_PORT_MAP_STATE_COUNT ((mach_msg_type_number_t) \ | |
369 | (sizeof(struct i386_isa_port_map_state)/sizeof(unsigned int))) | |
370 | ||
371 | /* | |
372 | * V8086 assist supplies a pointer to an interrupt | |
373 | * descriptor table in task space. | |
374 | */ | |
375 | struct i386_v86_assist_state { | |
376 | unsigned int int_table; /* interrupt table address */ | |
377 | int int_count; /* interrupt table size */ | |
378 | }; | |
379 | ||
380 | struct v86_interrupt_table { | |
381 | unsigned int count; /* count of pending interrupts */ | |
382 | unsigned short mask; /* ignore this interrupt if true */ | |
383 | unsigned short vec; /* vector to take */ | |
384 | }; | |
385 | ||
386 | #define i386_V86_ASSIST_STATE_COUNT ((mach_msg_type_number_t) \ | |
387 | (sizeof(struct i386_v86_assist_state)/sizeof(unsigned int))) | |
388 | ||
389 | struct thread_syscall_state { | |
390 | unsigned eax; | |
391 | unsigned edx; | |
392 | unsigned efl; | |
393 | unsigned eip; | |
394 | unsigned esp; | |
395 | }; | |
396 | ||
397 | #define i386_THREAD_SYSCALL_STATE_COUNT ((mach_msg_type_number_t) \ | |
398 | (sizeof(struct thread_syscall_state) / sizeof(unsigned int))) | |
399 | ||
1c79356b | 400 | /* |
c0fea474 A |
401 | * Main thread state consists of |
402 | * general registers, segment registers, | |
403 | * eip and eflags. | |
1c79356b | 404 | */ |
c0fea474 | 405 | |
21362eb3 A |
406 | #define i386_THREAD_STATE -1 |
407 | ||
408 | typedef struct { | |
c0fea474 A |
409 | unsigned int eax; |
410 | unsigned int ebx; | |
411 | unsigned int ecx; | |
412 | unsigned int edx; | |
413 | unsigned int edi; | |
414 | unsigned int esi; | |
415 | unsigned int ebp; | |
416 | unsigned int esp; | |
417 | unsigned int ss; | |
418 | unsigned int eflags; | |
419 | unsigned int eip; | |
420 | unsigned int cs; | |
421 | unsigned int ds; | |
422 | unsigned int es; | |
423 | unsigned int fs; | |
424 | unsigned int gs; | |
21362eb3 | 425 | } i386_thread_state_t; |
c0fea474 | 426 | |
c0fea474 A |
427 | #define i386_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ |
428 | ( sizeof (i386_thread_state_t) / sizeof (int) )) | |
429 | ||
21362eb3 A |
430 | /* |
431 | * x86-64 compatibility | |
432 | */ | |
433 | typedef i386_thread_state_t x86_thread_state32_t; | |
c0fea474 A |
434 | #define x86_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \ |
435 | ( sizeof (x86_thread_state32_t) / sizeof (int) )) | |
436 | ||
437 | ||
438 | ||
439 | ||
440 | struct x86_thread_state64 { | |
441 | uint64_t rax; | |
442 | uint64_t rbx; | |
443 | uint64_t rcx; | |
444 | uint64_t rdx; | |
445 | uint64_t rdi; | |
446 | uint64_t rsi; | |
447 | uint64_t rbp; | |
448 | uint64_t rsp; | |
449 | uint64_t r8; | |
450 | uint64_t r9; | |
451 | uint64_t r10; | |
452 | uint64_t r11; | |
453 | uint64_t r12; | |
454 | uint64_t r13; | |
455 | uint64_t r14; | |
456 | uint64_t r15; | |
457 | uint64_t rip; | |
458 | uint64_t rflags; | |
459 | uint64_t cs; | |
460 | uint64_t fs; | |
461 | uint64_t gs; | |
462 | } ; | |
463 | ||
464 | ||
465 | typedef struct x86_thread_state64 x86_thread_state64_t; | |
466 | #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ | |
467 | ( sizeof (x86_thread_state64_t) / sizeof (int) )) | |
468 | ||
469 | ||
470 | ||
471 | ||
472 | struct x86_thread_state { | |
473 | x86_state_hdr_t tsh; | |
474 | union { | |
475 | x86_thread_state32_t ts32; | |
476 | x86_thread_state64_t ts64; | |
477 | } uts; | |
478 | } ; | |
479 | ||
480 | ||
481 | typedef struct x86_thread_state x86_thread_state_t; | |
482 | #define x86_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ | |
483 | ( sizeof (x86_thread_state_t) / sizeof (int) )) | |
484 | ||
485 | ||
486 | ||
487 | /* | |
488 | * Default segment register values. | |
489 | */ | |
490 | ||
491 | #define USER_CODE_SELECTOR 0x0017 | |
492 | #define USER_DATA_SELECTOR 0x001f | |
493 | #define KERN_CODE_SELECTOR 0x0008 | |
494 | #define KERN_DATA_SELECTOR 0x0010 | |
495 | ||
c0fea474 | 496 | /* |
21362eb3 A |
497 | * Thread floating point state |
498 | * includes FPU environment as | |
499 | * well as the register stack. | |
89b3af67 | 500 | */ |
21362eb3 A |
501 | |
502 | #define i386_THREAD_FPSTATE -2 | |
5d5c5d0d | 503 | |
21362eb3 A |
504 | typedef struct { |
505 | fp_env_t environ; | |
506 | fp_stack_t stack; | |
507 | } i386_thread_fpstate_t; | |
89b3af67 | 508 | |
21362eb3 A |
509 | #define i386_THREAD_FPSTATE_COUNT ((mach_msg_type_number_t) \ |
510 | ( sizeof (i386_thread_fpstate_t) / sizeof (int) )) | |
c0fea474 A |
511 | |
512 | ||
513 | /* | |
21362eb3 | 514 | * x86-64 compatibility |
c0fea474 | 515 | */ |
21362eb3 | 516 | typedef i386_float_state_t x86_float_state32_t; |
c0fea474 A |
517 | #define x86_FLOAT_STATE32_COUNT ((mach_msg_type_number_t) \ |
518 | (sizeof(x86_float_state32_t)/sizeof(unsigned int))) | |
519 | ||
520 | ||
521 | struct x86_float_state64 { | |
522 | int fpu_reserved[2]; | |
523 | fp_control_t fpu_fcw; /* x87 FPU control word */ | |
524 | fp_status_t fpu_fsw; /* x87 FPU status word */ | |
525 | uint8_t fpu_ftw; /* x87 FPU tag word */ | |
526 | uint8_t fpu_rsrv1; /* reserved */ | |
527 | uint16_t fpu_fop; /* x87 FPU Opcode */ | |
528 | uint32_t fpu_ip; /* x87 FPU Instruction Pointer offset */ | |
529 | uint16_t fpu_cs; /* x87 FPU Instruction Pointer Selector */ | |
530 | uint16_t fpu_rsrv2; /* reserved */ | |
531 | uint32_t fpu_dp; /* x87 FPU Instruction Operand(Data) Pointer offset */ | |
532 | uint16_t fpu_ds; /* x87 FPU Instruction Operand(Data) Pointer Selector */ | |
533 | uint16_t fpu_rsrv3; /* reserved */ | |
534 | uint32_t fpu_mxcsr; /* MXCSR Register state */ | |
535 | uint32_t fpu_mxcsrmask; /* MXCSR mask */ | |
536 | struct mmst_reg fpu_stmm0; /* ST0/MM0 */ | |
537 | struct mmst_reg fpu_stmm1; /* ST1/MM1 */ | |
538 | struct mmst_reg fpu_stmm2; /* ST2/MM2 */ | |
539 | struct mmst_reg fpu_stmm3; /* ST3/MM3 */ | |
540 | struct mmst_reg fpu_stmm4; /* ST4/MM4 */ | |
541 | struct mmst_reg fpu_stmm5; /* ST5/MM5 */ | |
542 | struct mmst_reg fpu_stmm6; /* ST6/MM6 */ | |
543 | struct mmst_reg fpu_stmm7; /* ST7/MM7 */ | |
544 | struct xmm_reg fpu_xmm0; /* XMM 0 */ | |
545 | struct xmm_reg fpu_xmm1; /* XMM 1 */ | |
546 | struct xmm_reg fpu_xmm2; /* XMM 2 */ | |
547 | struct xmm_reg fpu_xmm3; /* XMM 3 */ | |
548 | struct xmm_reg fpu_xmm4; /* XMM 4 */ | |
549 | struct xmm_reg fpu_xmm5; /* XMM 5 */ | |
550 | struct xmm_reg fpu_xmm6; /* XMM 6 */ | |
551 | struct xmm_reg fpu_xmm7; /* XMM 7 */ | |
552 | struct xmm_reg fpu_xmm8; /* XMM 8 */ | |
553 | struct xmm_reg fpu_xmm9; /* XMM 9 */ | |
554 | struct xmm_reg fpu_xmm10; /* XMM 10 */ | |
555 | struct xmm_reg fpu_xmm11; /* XMM 11 */ | |
556 | struct xmm_reg fpu_xmm12; /* XMM 12 */ | |
557 | struct xmm_reg fpu_xmm13; /* XMM 13 */ | |
558 | struct xmm_reg fpu_xmm14; /* XMM 14 */ | |
559 | struct xmm_reg fpu_xmm15; /* XMM 15 */ | |
560 | char fpu_rsrv4[6*16]; /* reserved */ | |
561 | int fpu_reserved1; | |
562 | }; | |
563 | ||
564 | typedef struct x86_float_state64 x86_float_state64_t; | |
565 | #define x86_FLOAT_STATE64_COUNT ((mach_msg_type_number_t) \ | |
566 | (sizeof(x86_float_state64_t)/sizeof(unsigned int))) | |
567 | ||
568 | ||
569 | ||
570 | ||
571 | struct x86_float_state { | |
572 | x86_state_hdr_t fsh; | |
573 | union { | |
574 | x86_float_state32_t fs32; | |
575 | x86_float_state64_t fs64; | |
576 | } ufs; | |
577 | } ; | |
578 | ||
579 | ||
580 | typedef struct x86_float_state x86_float_state_t; | |
581 | #define x86_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \ | |
582 | ( sizeof (x86_float_state_t) / sizeof (int) )) | |
583 | ||
584 | ||
585 | ||
586 | /* | |
587 | * Extra state that may be | |
588 | * useful to exception handlers. | |
589 | */ | |
590 | ||
21362eb3 A |
591 | #define i386_THREAD_EXCEPTSTATE -3 |
592 | ||
593 | typedef struct { | |
594 | unsigned int trapno; | |
595 | err_code_t err; | |
596 | } i386_thread_exceptstate_t; | |
597 | ||
598 | #define i386_THREAD_EXCEPTSTATE_COUNT ((mach_msg_type_number_t) \ | |
599 | ( sizeof (i386_thread_exceptstate_t) / sizeof (int) )) | |
600 | ||
601 | ||
602 | /* | |
603 | * x86-64 compatibility | |
604 | */ | |
c0fea474 A |
605 | struct i386_exception_state { |
606 | unsigned int trapno; | |
607 | unsigned int err; | |
608 | unsigned int faultvaddr; | |
609 | }; | |
610 | ||
c0fea474 A |
611 | typedef struct i386_exception_state x86_exception_state32_t; |
612 | #define x86_EXCEPTION_STATE32_COUNT ((mach_msg_type_number_t) \ | |
613 | ( sizeof (x86_exception_state32_t) / sizeof (int) )) | |
614 | ||
615 | struct x86_debug_state32 { | |
616 | unsigned int dr0; | |
617 | unsigned int dr1; | |
618 | unsigned int dr2; | |
619 | unsigned int dr3; | |
620 | unsigned int dr4; | |
621 | unsigned int dr5; | |
622 | unsigned int dr6; | |
623 | unsigned int dr7; | |
624 | }; | |
625 | ||
626 | typedef struct x86_debug_state32 x86_debug_state32_t; | |
627 | #define x86_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \ | |
628 | ( sizeof (x86_debug_state32_t) / sizeof (int) )) | |
629 | #define X86_DEBUG_STATE32_COUNT x86_DEBUG_STATE32_COUNT | |
630 | ||
631 | ||
632 | struct x86_exception_state64 { | |
633 | unsigned int trapno; | |
634 | unsigned int err; | |
635 | uint64_t faultvaddr; | |
636 | }; | |
637 | ||
638 | typedef struct x86_exception_state64 x86_exception_state64_t; | |
639 | #define x86_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \ | |
640 | ( sizeof (x86_exception_state64_t) / sizeof (int) )) | |
641 | ||
642 | ||
643 | struct x86_debug_state64 { | |
644 | uint64_t dr0; | |
645 | uint64_t dr1; | |
646 | uint64_t dr2; | |
647 | uint64_t dr3; | |
648 | uint64_t dr4; | |
649 | uint64_t dr5; | |
650 | uint64_t dr6; | |
651 | uint64_t dr7; | |
652 | }; | |
653 | ||
654 | ||
655 | typedef struct x86_debug_state64 x86_debug_state64_t; | |
656 | #define x86_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \ | |
657 | ( sizeof (x86_debug_state64_t) / sizeof (int) )) | |
658 | ||
659 | #define X86_DEBUG_STATE64_COUNT x86_DEBUG_STATE64_COUNT | |
660 | ||
661 | ||
662 | ||
663 | struct x86_exception_state { | |
664 | x86_state_hdr_t esh; | |
665 | union { | |
666 | x86_exception_state32_t es32; | |
667 | x86_exception_state64_t es64; | |
668 | } ues; | |
669 | } ; | |
670 | ||
671 | ||
672 | typedef struct x86_exception_state x86_exception_state_t; | |
673 | #define x86_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \ | |
674 | ( sizeof (x86_exception_state_t) / sizeof (int) )) | |
675 | ||
676 | struct x86_debug_state { | |
677 | x86_state_hdr_t dsh; | |
678 | union { | |
679 | x86_debug_state32_t ds32; | |
680 | x86_debug_state64_t ds64; | |
681 | } uds; | |
682 | }; | |
683 | ||
684 | ||
685 | ||
686 | typedef struct x86_debug_state x86_debug_state_t; | |
687 | #define x86_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \ | |
688 | (sizeof(x86_debug_state_t)/sizeof(unsigned int))) | |
689 | ||
c0fea474 A |
690 | |
691 | /* | |
21362eb3 A |
692 | * Per-thread variable used |
693 | * to store 'self' id for cthreads. | |
1c79356b | 694 | */ |
c0fea474 | 695 | |
21362eb3 A |
696 | #define i386_THREAD_CTHREADSTATE -4 |
697 | ||
89b3af67 | 698 | typedef struct { |
21362eb3 A |
699 | unsigned int self; |
700 | } i386_thread_cthreadstate_t; | |
701 | ||
702 | #define i386_THREAD_CTHREADSTATE_COUNT ((mach_msg_type_number_t) \ | |
703 | ( sizeof (i386_thread_cthreadstate_t) / sizeof (int) )) | |
1c79356b A |
704 | |
705 | #endif /* _MACH_I386_THREAD_STATUS_H_ */ |