1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * COPYRIGHT: GPL - See COPYING in the top level directory 3*c2c66affSColin Finck * PROJECT: ReactOS Virtual DOS Machine 4*c2c66affSColin Finck * FILE: subsystems/mvdm/ntvdm/cpu/x86context.h 5*c2c66affSColin Finck * PURPOSE: x86 CPU Context Frame definitions 6*c2c66affSColin Finck * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) 7*c2c66affSColin Finck * 8*c2c66affSColin Finck * NOTE: Taken from the PSDK. 9*c2c66affSColin Finck */ 10*c2c66affSColin Finck 11*c2c66affSColin Finck #ifndef __X86CONTEXT_H__ 12*c2c66affSColin Finck #define __X86CONTEXT_H__ 13*c2c66affSColin Finck 14*c2c66affSColin Finck #pragma once 15*c2c66affSColin Finck 16*c2c66affSColin Finck /* Clean everything that may have been defined before */ 17*c2c66affSColin Finck #undef SIZE_OF_80387_REGISTERS 18*c2c66affSColin Finck #undef MAXIMUM_SUPPORTED_EXTENSION 19*c2c66affSColin Finck #undef CONTEXT_i386 20*c2c66affSColin Finck #undef CONTEXT_i486 21*c2c66affSColin Finck #undef CONTEXT_CONTROL 22*c2c66affSColin Finck #undef CONTEXT_INTEGER 23*c2c66affSColin Finck #undef CONTEXT_SEGMENTS 24*c2c66affSColin Finck #undef CONTEXT_FLOATING_POINT 25*c2c66affSColin Finck #undef CONTEXT_DEBUG_REGISTERS 26*c2c66affSColin Finck #undef CONTEXT_EXTENDED_REGISTERS 27*c2c66affSColin Finck #undef CONTEXT_FULL 28*c2c66affSColin Finck #undef CONTEXT_ALL 29*c2c66affSColin Finck #undef CONTEXT_DEBUGGER 30*c2c66affSColin Finck #undef CONTEXT_XSTATE 31*c2c66affSColin Finck 32*c2c66affSColin Finck 33*c2c66affSColin Finck 34*c2c66affSColin Finck #define SIZE_OF_80387_REGISTERS 80 35*c2c66affSColin Finck #define MAXIMUM_SUPPORTED_EXTENSION 512 36*c2c66affSColin Finck 37*c2c66affSColin Finck #define CONTEXT_i386 0x00010000 38*c2c66affSColin Finck #define CONTEXT_i486 0x00010000 39*c2c66affSColin Finck 40*c2c66affSColin Finck #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L) // SS:SP, CS:IP, FLAGS, BP 41*c2c66affSColin Finck #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L) // AX, BX, CX, DX, SI, DI 42*c2c66affSColin Finck #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L) // DS, ES, FS, GS 43*c2c66affSColin Finck #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L) // 387 state 44*c2c66affSColin Finck #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L) // DB 0-3,6,7 45*c2c66affSColin Finck #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L) // CPU-specific extensions 46*c2c66affSColin Finck 47*c2c66affSColin Finck #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS) 48*c2c66affSColin Finck #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \ 49*c2c66affSColin Finck CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \ 50*c2c66affSColin Finck CONTEXT_EXTENDED_REGISTERS) 51*c2c66affSColin Finck 52*c2c66affSColin Finck #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT) 53*c2c66affSColin Finck #define CONTEXT_XSTATE (CONTEXT_i386 | 0x00000040L) 54*c2c66affSColin Finck 55*c2c66affSColin Finck 56*c2c66affSColin Finck typedef struct _X87FLOATING_SAVE_AREA 57*c2c66affSColin Finck { 58*c2c66affSColin Finck ULONG ControlWord; 59*c2c66affSColin Finck ULONG StatusWord; 60*c2c66affSColin Finck ULONG TagWord; 61*c2c66affSColin Finck ULONG ErrorOffset; 62*c2c66affSColin Finck ULONG ErrorSelector; 63*c2c66affSColin Finck ULONG DataOffset; 64*c2c66affSColin Finck ULONG DataSelector; 65*c2c66affSColin Finck UCHAR RegisterArea[SIZE_OF_80387_REGISTERS]; 66*c2c66affSColin Finck ULONG Cr0NpxState; 67*c2c66affSColin Finck } X87FLOATING_SAVE_AREA, *PX87FLOATING_SAVE_AREA; 68*c2c66affSColin Finck 69*c2c66affSColin Finck #include "pshpack4.h" 70*c2c66affSColin Finck /* 71*c2c66affSColin Finck * x86 CPU Context Frame 72*c2c66affSColin Finck */ 73*c2c66affSColin Finck typedef struct _X86CONTEXT 74*c2c66affSColin Finck { 75*c2c66affSColin Finck /* 76*c2c66affSColin Finck * The flags values within this flag control the contents of 77*c2c66affSColin Finck * a CONTEXT record. 78*c2c66affSColin Finck */ 79*c2c66affSColin Finck ULONG ContextFlags; 80*c2c66affSColin Finck 81*c2c66affSColin Finck /* 82*c2c66affSColin Finck * Section specified/returned if CONTEXT_DEBUG_REGISTERS 83*c2c66affSColin Finck * is set in ContextFlags. 84*c2c66affSColin Finck */ 85*c2c66affSColin Finck ULONG Dr0; 86*c2c66affSColin Finck ULONG Dr1; 87*c2c66affSColin Finck ULONG Dr2; 88*c2c66affSColin Finck ULONG Dr3; 89*c2c66affSColin Finck ULONG Dr6; 90*c2c66affSColin Finck ULONG Dr7; 91*c2c66affSColin Finck 92*c2c66affSColin Finck /* 93*c2c66affSColin Finck * Section specified/returned if CONTEXT_FLOATING_POINT 94*c2c66affSColin Finck * is set in ContextFlags. 95*c2c66affSColin Finck */ 96*c2c66affSColin Finck X87FLOATING_SAVE_AREA FloatSave; 97*c2c66affSColin Finck 98*c2c66affSColin Finck /* 99*c2c66affSColin Finck * Section specified/returned if CONTEXT_SEGMENTS 100*c2c66affSColin Finck * is set in ContextFlags. 101*c2c66affSColin Finck */ 102*c2c66affSColin Finck ULONG SegGs; 103*c2c66affSColin Finck ULONG SegFs; 104*c2c66affSColin Finck ULONG SegEs; 105*c2c66affSColin Finck ULONG SegDs; 106*c2c66affSColin Finck 107*c2c66affSColin Finck /* 108*c2c66affSColin Finck * Section specified/returned if CONTEXT_INTEGER 109*c2c66affSColin Finck * is set in ContextFlags. 110*c2c66affSColin Finck */ 111*c2c66affSColin Finck ULONG Edi; 112*c2c66affSColin Finck ULONG Esi; 113*c2c66affSColin Finck ULONG Ebx; 114*c2c66affSColin Finck ULONG Edx; 115*c2c66affSColin Finck ULONG Ecx; 116*c2c66affSColin Finck ULONG Eax; 117*c2c66affSColin Finck 118*c2c66affSColin Finck /* 119*c2c66affSColin Finck * Section specified/returned if CONTEXT_CONTROL 120*c2c66affSColin Finck * is set in ContextFlags. 121*c2c66affSColin Finck */ 122*c2c66affSColin Finck ULONG Ebp; 123*c2c66affSColin Finck ULONG Eip; 124*c2c66affSColin Finck ULONG SegCs; 125*c2c66affSColin Finck ULONG EFlags; 126*c2c66affSColin Finck ULONG Esp; 127*c2c66affSColin Finck ULONG SegSs; 128*c2c66affSColin Finck 129*c2c66affSColin Finck /* 130*c2c66affSColin Finck * Section specified/returned if CONTEXT_EXTENDED_REGISTERS 131*c2c66affSColin Finck * is set in ContextFlags. The format and contexts are processor specific. 132*c2c66affSColin Finck */ 133*c2c66affSColin Finck UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; 134*c2c66affSColin Finck } X86CONTEXT; 135*c2c66affSColin Finck #include "poppack.h" 136*c2c66affSColin Finck 137*c2c66affSColin Finck #endif /* __X86CONTEXT_H__ */ 138