From ca8c23034d2f013775ba93bccc2fccaf7d123150 Mon Sep 17 00:00:00 2001 From: Kevin Koltzau Date: Mon, 18 Jul 2005 09:11:42 +0000 Subject: [PATCH] Define x86_64 context. --- include/basetsd.h | 4 ++ include/winnt.h | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/include/basetsd.h b/include/basetsd.h index 987d843f6bb..d9db9b8a8f1 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -149,6 +149,10 @@ typedef ULONG_PTR KAFFINITY, *PKAFFINITY; # undef WORDS_BIGENDIAN # undef BITFIELDS_BIGENDIAN # define ALLOW_UNALIGNED_ACCESS +#elif defined(__x86_64__) +# undef WORDS_BIGENDIAN +# undef BITFIELDS_BIGENDIAN +# define ALLOW_UNALIGNED_ACCESS #elif defined(__sparc__) # define WORDS_BIGENDIAN # define BITFIELDS_BIGENDIAN diff --git a/include/winnt.h b/include/winnt.h index 832c070e2ad..1acd47245d9 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -452,6 +452,10 @@ typedef HANDLE *PHANDLE, *LPHANDLE; #define PROCESSOR_ARCHITECTURE_PPC 3 #define PROCESSOR_ARCHITECTURE_SHX 4 #define PROCESSOR_ARCHITECTURE_ARM 5 +#define PROCESSOR_ARCHITECTURE_IA64 6 +#define PROCESSOR_ARCHITECTURE_ALPHA64 7 +#define PROCESSOR_ARCHITECTURE_MSIL 8 +#define PROCESSOR_ARCHITECTURE_AMD64 9 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF /* dwProcessorType */ @@ -459,6 +463,8 @@ typedef HANDLE *PHANDLE, *LPHANDLE; #define PROCESSOR_INTEL_486 486 #define PROCESSOR_INTEL_PENTIUM 586 #define PROCESSOR_INTEL_860 860 +#define PROCESSOR_INTEL_IA64 2200 +#define PROCESSOR_AMD_X8664 8664 #define PROCESSOR_MIPS_R2000 2000 #define PROCESSOR_MIPS_R3000 3000 #define PROCESSOR_MIPS_R4000 4000 @@ -707,6 +713,132 @@ typedef struct _LDT_ENTRY { } HighWord; } LDT_ENTRY, *PLDT_ENTRY; +/* x86-64 context definitions */ +#if defined(__x86_64__) + +#define CONTEXT_AMD64 0x00100000 + +#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001) +#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002) +#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004) +#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L) +#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L) +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) +#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) + +typedef struct DECLSPEC_ALIGN(16) _M128A { + ULONGLONG Low; + LONGLONG High; +} M128A, *PM128A; + +typedef struct _XMM_SAVE_AREA32 { + WORD ControlWord; + WORD StatusWord; + BYTE TagWord; + BYTE Reserved1; + WORD ErrorOpcode; + DWORD ErrorOffset; + WORD ErrorSelector; + WORD Reserved2; + DWORD DataOffset; + WORD DataSelector; + WORD Reserved3; + DWORD MxCsr; + DWORD MxCsr_Mask; + M128A FloatRegisters[8]; + M128A XmmRegisters[16]; + BYTE Reserved4[96]; +} XMM_SAVE_AREA32, *PXMM_SAVE_AREA32; + +typedef struct DECLSPEC_ALIGN(16) _CONTEXT { + DWORD64 P1Home; + DWORD64 P2Home; + DWORD64 P3Home; + DWORD64 P4Home; + DWORD64 P5Home; + DWORD64 P6Home; + + /* Control flags */ + DWORD ContextFlags; + DWORD MxCsr; + + /* Segment */ + WORD SegCs; + WORD SegDs; + WORD SegEs; + WORD SegFs; + WORD SegGs; + WORD SegSs; + DWORD EFlags; + + /* Debug */ + DWORD64 Dr0; + DWORD64 Dr1; + DWORD64 Dr2; + DWORD64 Dr3; + DWORD64 Dr6; + DWORD64 Dr7; + + /* Integer */ + DWORD64 Rax; + DWORD64 Rcx; + DWORD64 Rdx; + DWORD64 Rbx; + DWORD64 Rsp; + DWORD64 Rbp; + DWORD64 Rsi; + DWORD64 Rdi; + DWORD64 R8; + DWORD64 R9; + DWORD64 R10; + DWORD64 R11; + DWORD64 R12; + DWORD64 R13; + DWORD64 R14; + DWORD64 R15; + + /* Counter */ + DWORD64 Rip; + + /* Floating point */ + union { + XMM_SAVE_AREA32 FltSave; + struct { + M128A Header[2]; + M128A Legacy[8]; + M128A Xmm0; + M128A Xmm1; + M128A Xmm2; + M128A Xmm3; + M128A Xmm4; + M128A Xmm5; + M128A Xmm6; + M128A Xmm7; + M128A Xmm8; + M128A Xmm9; + M128A Xmm10; + M128A Xmm11; + M128A Xmm12; + M128A Xmm13; + M128A Xmm14; + M128A Xmm15; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + + /* Vector */ + M128A VectorRegister[26]; + DWORD64 VectorControl; + + /* Debug control */ + DWORD64 DebugControl; + DWORD64 LastBranchToRip; + DWORD64 LastBranchFromRip; + DWORD64 LastExceptionToRip; + DWORD64 LastExceptionFromRip; +} CONTEXT; + +#endif /* __x86_64__ */ + /* Alpha context definitions */ #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__) -- 2.11.4.GIT