winnt.h - Add AMD64 Context Definition

Steven Edwards steven_ed4153 at yahoo.com
Sun Jul 3 00:28:36 CDT 2005


Hi,
I wrote this quite a while back on sourceforge's compile farm when I was attempting to learn asm
for x86 and x86-64. After a short amount of time dealing with the pain of transfering files in and
out of sourceforge and keeping CVS updated I gave up but before this gets perged I wanted to send
it. I hope it is of use to someone as due to my lack of a x86-64 system it might be a while before
I get back to it. To correct this minor oversight, please contact AMD and kindly request they
donate me a system.

Thanks
Steven

Changelog: 
Add CONTEXT Definitions for AMD x86-64.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
Index: include/winnt.h
===================================================================
RCS file: /home/wine/wine/include/winnt.h,v
retrieving revision 1.214
diff -u -r1.214 winnt.h
--- include/winnt.h	27 Jun 2005 11:09:42 -0000	1.214
+++ include/winnt.h	3 Jul 2005 05:20:26 -0000
@@ -451,6 +451,7 @@
 #define PROCESSOR_ARCHITECTURE_PPC	3
 #define PROCESSOR_ARCHITECTURE_SHX	4
 #define PROCESSOR_ARCHITECTURE_ARM	5
+#define PROCESSOR_ARCHITECTURE_AMD64	9
 #define PROCESSOR_ARCHITECTURE_UNKNOWN	0xFFFF
 
 /* dwProcessorType */
@@ -705,6 +706,143 @@
         } Bits;
     } HighWord;
 } LDT_ENTRY, *PLDT_ENTRY;
+
+#ifdef _M_AMD64
+
+#define CONTEXT_AMD64	0x100000
+
+#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L )
+#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L )
+#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L )
+#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
+
+#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)
+
+/* 128 Bit 16 byte xmm regster */
+
+typedef struct _M128 {
+    ULONGLONG Low;
+    LONGLONG High;
+} M128;
+
+/* Legacy Floating Point State */
+
+typedef struct _LEGACY_SAVE_AREA {
+    WORD ControlWord;
+    WORD Reserved0;
+    WORD StatusWord;
+    WORD Reserverd1;
+    WORD TagWord;
+    WORD Reserved2;
+    DWORD ErrorOffset;
+    WORD ErrorSelector;
+    WORD ErrorOpcode;
+    DWORD DataOffset;
+    WORD DataSelector;
+    WORD Reserved3;
+    BYTE FloatRegistrers[8 * 10];
+} LEGACY_SAVE_AREA, *PLEGACY_SAVE_AREA;
+
+#define LEGACY_SAVE_AREA_LENGTH  ((sizeof(LEGACY_SAVE_AREA) + 15) & ~15)
+
+/* Context Frame */
+
+typedef struct _CONTEXT {
+    /* Register Param Home Addr */
+
+    DWORD64 P1Home;
+    DWORD64 P2Home;
+    DWORD64 P3Home;
+    DWORD64 P4Home;
+    DWORD64 P5Home;
+    DWORD64 P6Home;
+
+    /* Control Flags */
+
+    DWORD ContextFlags;
+    DWORD MxCsr;
+
+    /* Segment Regs and Procs Flags */
+
+    WORD SegCs;
+    WORD SegDs;
+    WORD SegEs;
+    WORD SegFs;
+    WORD SegGs;
+    WORD SegSs;
+    DWORD EFlags;
+
+    /* Debug Regs */
+    DWORD64 Dr0;
+    DWORD64 Dr1;
+    DWORD64 Dr2;
+    DWORD64 Dr3;
+    DWORD64 Dr6;
+    DWORD64 Dr7;
+
+    /* Intger Regs */
+
+    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;
+*/
+    /* Program Counter */
+
+    DWORD64 Rip;
+
+    /* MMX and Floating point state. */
+
+    M128 Xmm0;
+    M128 Xmm1;
+    M128 Xmm2;
+    M128 Xmm3;
+    M128 Xmm4;
+    M128 Xmm5;
+    M128 Xmm6;
+    M128 Xmm7;
+    M128 Xmm8;
+    M128 Xmm9;
+    M128 Xmm10;
+    M128 Xmm11;
+    M128 Xmm12;
+    M128 Xmm13;
+    M128 Xmm14;
+    M128 Xmm15;
+
+    /* Legacy floating point state */
+
+    LEGACY_SAVE_AREA FltSave;
+    DWORD Fill;
+
+    /* Special Debug Control Regs */
+
+    DWORD64 DebugControl;
+    DWORD64 LastBranchToRip;
+    DWORD64 LastBranchFromRip;
+    DWORD64 LastExceptionToRip;
+    DWORD64 LastExceptionFromRip;
+    DWORD64 Fill1;
+
+} CONTEXT;
+
+#endif /* __x86_64__ */
+
 
 /* Alpha context definitions */
 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)


More information about the wine-patches mailing list