-
-/*
- * This structure is used for both
- * i386_THREAD_STATE and i386_REGS_SEGS_STATE.
- */
-struct i386_new_thread_state {
- unsigned int gs;
- unsigned int fs;
- unsigned int es;
- unsigned int ds;
- unsigned int edi;
- unsigned int esi;
- unsigned int ebp;
- unsigned int esp;
- unsigned int ebx;
- unsigned int edx;
- unsigned int ecx;
- unsigned int eax;
- unsigned int eip;
- unsigned int cs;
- unsigned int efl;
- unsigned int uesp;
- unsigned int ss;
-};
-#define i386_NEW_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof (struct i386_new_thread_state)/sizeof(unsigned int)))
-
-/*
- * Subset of saved state stored by processor on kernel-to-kernel
- * trap. (Used by ddb to examine state guaranteed to be present
- * on all traps into debugger.)
- */
-struct i386_saved_state_from_kernel {
- unsigned int gs;
- unsigned int fs;
- unsigned int es;
- unsigned int ds;
- unsigned int edi;
- unsigned int esi;
- unsigned int ebp;
- unsigned int esp; /* kernel esp stored by pusha -
- we save cr2 here later */
- unsigned int ebx;
- unsigned int edx;
- unsigned int ecx;
- unsigned int eax;
- unsigned int trapno;
- unsigned int err;
- unsigned int eip;
- unsigned int cs;
- unsigned int efl;
-};
-
-/*
- * The format in which thread state is saved by Mach on this machine. This
- * state flavor is most efficient for exception RPC's to kernel-loaded
- * servers, because copying can be avoided:
- */
-struct i386_saved_state {
- unsigned int gs;
- unsigned int fs;
- unsigned int es;
- unsigned int ds;
- unsigned int edi;
- unsigned int esi;
- unsigned int ebp;
- unsigned int esp; /* kernel esp stored by pusha -
- we save cr2 here later */
- unsigned int ebx;
- unsigned int edx;
- unsigned int ecx;
- unsigned int eax;
- unsigned int trapno;
- unsigned int err;
- unsigned int eip;
- unsigned int cs;
- unsigned int efl;
- unsigned int uesp;
- unsigned int ss;
- struct v86_segs {
- unsigned int v86_es; /* virtual 8086 segment registers */
- unsigned int v86_ds;
- unsigned int v86_fs;
- unsigned int v86_gs;
- } v86_segs;
-#define i386_SAVED_ARGV_COUNT 7
- unsigned int argv_status; /* Boolean flag indicating whether or
- * not Mach copied in the args */
- unsigned int argv[i386_SAVED_ARGV_COUNT];
- /* The return address, and the first several
- * function call args from the stack, for
- * efficient syscall exceptions */
-};
-#define i386_SAVED_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof (struct i386_saved_state)/sizeof(unsigned int)))
-#define i386_REGS_SEGS_STATE_COUNT i386_SAVED_STATE_COUNT
-
-/*
- * Machine-independent way for servers and Mach's exception mechanism to
- * choose the most efficient state flavor for exception RPC's:
- */
-#define MACHINE_THREAD_STATE i386_SAVED_STATE
-#define MACHINE_THREAD_STATE_COUNT 144
-
-/*
- * Largest state on this machine:
- * (be sure mach/machine/thread_state.h matches!)
- */
-#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
-
-/*
- * Floating point state.
- *
- * fpkind tells in what way floating point operations are supported.
- * See the values for fp_kind in <mach/i386/fp_reg.h>.
- *
- * If the kind is FP_NO, then calls to set the state will fail, and
- * thread_getstatus will return garbage for the rest of the state.
- * If "initialized" is false, then the rest of the state is garbage.
- * Clients can set "initialized" to false to force the coprocessor to
- * be reset.
- * "exc_status" is non-zero if the thread has noticed (but not
- * proceeded from) a coprocessor exception. It contains the status
- * word with the exception bits set. The status word in "fp_status"
- * will have the exception bits turned off. If an exception bit in
- * "fp_status" is turned on, then "exc_status" should be zero. This
- * happens when the coprocessor exception is noticed after the system
- * has context switched to some other thread.
- *
- * If kind is FP_387, then "state" is a i387_state. Other kinds might
- * also use i387_state, but somebody will have to verify it (XXX).
- * Note that the registers are ordered from top-of-stack down, not
- * according to physical register number.
- */
-
-/*
- * x86-64 compatibility
- */
-/* defn of 80bit x87 FPU or MMX register */
-struct mmst_reg {
- char mmst_reg[10];
- char mmst_rsrv[6];
-};
-
-
-/* defn of 128 bit XMM regs */
-struct xmm_reg {
- char xmm_reg[16];
-};
-
-#define FP_STATE_BYTES 512
-
-struct i386_float_state {
- int fpkind; /* FP_NO..FP_387 (readonly) */
- int initialized;
- unsigned char hw_state[FP_STATE_BYTES]; /* actual "hardware" state */
- int exc_status; /* exception status (readonly) */
-};
-#define i386_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof(struct i386_float_state)/sizeof(unsigned int)))
-
-/*
- * x86-64 compatibility
- */
-typedef struct {
- int fpu_reserved[2];
- fp_control_t fpu_fcw; /* x87 FPU control word */
- fp_status_t fpu_fsw; /* x87 FPU status word */
- uint8_t fpu_ftw; /* x87 FPU tag word */
- uint8_t fpu_rsrv1; /* reserved */
- uint16_t fpu_fop; /* x87 FPU Opcode */
- uint32_t fpu_ip; /* x87 FPU Instruction Pointer offset */
- uint16_t fpu_cs; /* x87 FPU Instruction Pointer Selector */
- uint16_t fpu_rsrv2; /* reserved */
- uint32_t fpu_dp; /* x87 FPU Instruction Operand(Data) Pointer offset */
- uint16_t fpu_ds; /* x87 FPU Instruction Operand(Data) Pointer Selector */
- uint16_t fpu_rsrv3; /* reserved */
- uint32_t fpu_mxcsr; /* MXCSR Register state */
- uint32_t fpu_mxcsrmask; /* MXCSR mask */
- struct mmst_reg fpu_stmm0; /* ST0/MM0 */
- struct mmst_reg fpu_stmm1; /* ST1/MM1 */
- struct mmst_reg fpu_stmm2; /* ST2/MM2 */
- struct mmst_reg fpu_stmm3; /* ST3/MM3 */
- struct mmst_reg fpu_stmm4; /* ST4/MM4 */
- struct mmst_reg fpu_stmm5; /* ST5/MM5 */
- struct mmst_reg fpu_stmm6; /* ST6/MM6 */
- struct mmst_reg fpu_stmm7; /* ST7/MM7 */
- struct xmm_reg fpu_xmm0; /* XMM 0 */
- struct xmm_reg fpu_xmm1; /* XMM 1 */
- struct xmm_reg fpu_xmm2; /* XMM 2 */
- struct xmm_reg fpu_xmm3; /* XMM 3 */
- struct xmm_reg fpu_xmm4; /* XMM 4 */
- struct xmm_reg fpu_xmm5; /* XMM 5 */
- struct xmm_reg fpu_xmm6; /* XMM 6 */
- struct xmm_reg fpu_xmm7; /* XMM 7 */
- char fpu_rsrv4[14*16]; /* reserved */
- int fpu_reserved1;
-} i386_float_state_t;
-
-
-#define FP_old_STATE_BYTES ((mach_msg_type_number_t) \
- (sizeof (struct i386_fp_save) + sizeof (struct i386_fp_regs)))
-
-struct i386_old_float_state {
- int fpkind; /* FP_NO..FP_387 (readonly) */
- int initialized;
- unsigned char hw_state[FP_old_STATE_BYTES]; /* actual "hardware" state */
- int exc_status; /* exception status (readonly) */
-};
-#define i386_old_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof(struct i386_old_float_state)/sizeof(unsigned int)))
-
-
-#define PORT_MAP_BITS 0x400
-struct i386_isa_port_map_state {
- unsigned char pm[PORT_MAP_BITS>>3];
-};
-
-#define i386_ISA_PORT_MAP_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof(struct i386_isa_port_map_state)/sizeof(unsigned int)))
-
-/*
- * V8086 assist supplies a pointer to an interrupt
- * descriptor table in task space.
- */
-struct i386_v86_assist_state {
- unsigned int int_table; /* interrupt table address */
- int int_count; /* interrupt table size */
-};
-
-struct v86_interrupt_table {
- unsigned int count; /* count of pending interrupts */
- unsigned short mask; /* ignore this interrupt if true */
- unsigned short vec; /* vector to take */
-};
-
-#define i386_V86_ASSIST_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof(struct i386_v86_assist_state)/sizeof(unsigned int)))
-
-struct thread_syscall_state {
- unsigned eax;
- unsigned edx;
- unsigned efl;
- unsigned eip;
- unsigned esp;
-};
-
-#define i386_THREAD_SYSCALL_STATE_COUNT ((mach_msg_type_number_t) \
- (sizeof(struct thread_syscall_state) / sizeof(unsigned int)))
-
-/*
- * Main thread state consists of
- * general registers, segment registers,
- * eip and eflags.
- */
-
-#define i386_THREAD_STATE -1
-
-typedef struct {
- unsigned int eax;
- unsigned int ebx;
- unsigned int ecx;
- unsigned int edx;
- unsigned int edi;
- unsigned int esi;
- unsigned int ebp;
- unsigned int esp;
- unsigned int ss;
- unsigned int eflags;
- unsigned int eip;
- unsigned int cs;
- unsigned int ds;
- unsigned int es;
- unsigned int fs;
- unsigned int gs;
-} i386_thread_state_t;
-
-#define i386_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
- ( sizeof (i386_thread_state_t) / sizeof (int) ))
-
-/*
- * x86-64 compatibility
- */
-typedef i386_thread_state_t x86_thread_state32_t;
-#define x86_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
- ( sizeof (x86_thread_state32_t) / sizeof (int) ))
-
-
-
-
-struct x86_thread_state64 {
- uint64_t rax;
- uint64_t rbx;
- uint64_t rcx;
- uint64_t rdx;
- uint64_t rdi;
- uint64_t rsi;
- uint64_t rbp;
- uint64_t rsp;
- uint64_t r8;
- uint64_t r9;
- uint64_t r10;
- uint64_t r11;
- uint64_t r12;
- uint64_t r13;
- uint64_t r14;
- uint64_t r15;
- uint64_t rip;
- uint64_t rflags;
- uint64_t cs;
- uint64_t fs;
- uint64_t gs;
-} ;
-
-
-typedef struct x86_thread_state64 x86_thread_state64_t;
-#define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
- ( sizeof (x86_thread_state64_t) / sizeof (int) ))
-
-
-
-
-struct x86_thread_state {
- x86_state_hdr_t tsh;
- union {
- x86_thread_state32_t ts32;
- x86_thread_state64_t ts64;
- } uts;
-} ;
-
-
-typedef struct x86_thread_state x86_thread_state_t;
-#define x86_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
- ( sizeof (x86_thread_state_t) / sizeof (int) ))
-
-
-