Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
7.7 KiB

  1. import "..\exdi.idl";
  2. interface IeXdiX86_64Context;
  3. // HRESULT GetContext ([in, out] PCONTEXT_X86_64 pContext);
  4. // HRESULT SetContext ([in] CONTEXT_X86_64 Context);
  5. cpp_quote("// The following constants are bit definitions for the ModeFlags value in CONTEXT_X86_64.")
  6. cpp_quote("// They are provided to allow debuggers to correctly disassemble instructions based on")
  7. cpp_quote("// the current operating mode of the processor.")
  8. cpp_quote("#define X86_64_MODE_D (0x0001) // D bit from the current CS selector")
  9. cpp_quote("#define X86_64_MODE_L (0x0002) // L bit (long mode) from the current CS selector")
  10. cpp_quote("#define X86_64_MODE_LME (0x0004) // LME bit (lomg mode enable) from extended feature MSR")
  11. cpp_quote("#define X86_64_MODE_REX (0x0008) // REX bit (register extension) from extended feature MSR")
  12. typedef
  13. struct _SEG64_DESC_INFO
  14. {
  15. DWORD64 SegBase;
  16. DWORD64 SegLimit;
  17. DWORD SegFlags;
  18. } SEG64_DESC_INFO;
  19. typedef
  20. struct _SSE_REG
  21. {
  22. DWORD Reg0;
  23. DWORD Reg1;
  24. DWORD Reg2;
  25. DWORD Reg3;
  26. } SSE_REG;
  27. #define NUM_SSE_REGS 16
  28. typedef
  29. struct _CONTEXT_X86_64
  30. {
  31. struct
  32. {
  33. BOOL fSegmentRegs;
  34. BOOL fControlRegs;
  35. BOOL fIntegerRegs;
  36. BOOL fFloatingPointRegs;
  37. BOOL fDebugRegs;
  38. BOOL fSegmentDescriptors;
  39. BOOL fSSERegisters;
  40. BOOL fSystemRegisters;
  41. } RegGroupSelection; // These flags are used to select groups of registers only
  42. // (instead of the totality) for reading or writing.
  43. // both Segment & Control registers (used if either RegGroupSelection.fSegmentRegs or
  44. // RegGroupSelection.fControlRegs is TRUE).
  45. DWORD SegCs;
  46. DWORD SegSs;
  47. // Segment registers (used if RegGroupSelection.fSegmentRegs is TRUE).
  48. // except CS and SS which are in "Segment and Control" - see above
  49. DWORD SegGs;
  50. DWORD SegFs;
  51. DWORD SegEs;
  52. DWORD SegDs;
  53. // Mode flags define the current processor mode (16/32/64 bit)
  54. DWORD64 ModeFlags;
  55. // Control registers (used if RegGroupSelection.fControlRegs is TRUE).
  56. // except CS and SS which are in "Segment and Control" - see above
  57. DWORD64 EFlags;
  58. DWORD64 Rbp;
  59. DWORD64 Rip;
  60. DWORD64 Rsp;
  61. // Integer registers (used if RegGroupSelection.fIntegerRegs is TRUE).
  62. DWORD64 Rax;
  63. DWORD64 Rbx;
  64. DWORD64 Rcx;
  65. DWORD64 Rdx;
  66. DWORD64 Rsi;
  67. DWORD64 Rdi;
  68. DWORD64 R8;
  69. DWORD64 R9;
  70. DWORD64 R10;
  71. DWORD64 R11;
  72. DWORD64 R12;
  73. DWORD64 R13;
  74. DWORD64 R14;
  75. DWORD64 R15;
  76. // Floating point registers (used if RegGroupSelection.fFloatingPointRegs is TRUE).
  77. DWORD ControlWord;
  78. DWORD StatusWord;
  79. DWORD TagWord;
  80. DWORD ErrorOffset;
  81. DWORD ErrorSelector;
  82. DWORD DataOffset;
  83. DWORD DataSelector;
  84. BYTE RegisterArea [SIZE_OF_80387_REGISTERS_IN_BYTES];
  85. // Debug registers (used if RegGroupSelection.fDebugRegs is TRUE)
  86. DWORD64 Dr0;
  87. DWORD64 Dr1;
  88. DWORD64 Dr2;
  89. DWORD64 Dr3;
  90. DWORD64 Dr6;
  91. DWORD64 Dr7;
  92. // Descriptors and base registers (used if RegGroupSelection.fSegmentDescriptors is TRUE)
  93. SEG64_DESC_INFO DescriptorCs;
  94. SEG64_DESC_INFO DescriptorSs;
  95. SEG64_DESC_INFO DescriptorGs;
  96. SEG64_DESC_INFO DescriptorFs;
  97. SEG64_DESC_INFO DescriptorEs;
  98. SEG64_DESC_INFO DescriptorDs;
  99. DWORD64 IDTBase;
  100. DWORD64 IDTLimit;
  101. DWORD64 GDTBase;
  102. DWORD64 GDTLimit;
  103. DWORD SelLDT;
  104. SEG64_DESC_INFO SegLDT;
  105. DWORD SelTSS;
  106. SEG64_DESC_INFO SegTSS;
  107. // System registers (used if RegGroupSelection.fSystemRegisters is TRUE)
  108. DWORD64 RegCr0;
  109. DWORD64 RegCr2;
  110. DWORD64 RegCr3;
  111. DWORD64 RegCr4;
  112. DWORD64 RegCr8; // Cr8 - Task priority register.
  113. // SSE registers (used if RegGroupSelection.fSSERegisters is TRUE)
  114. DWORD RegMXCSR;
  115. SSE_REG RegSSE[NUM_SSE_REGS];
  116. } CONTEXT_X86_64, *PCONTEXT_X86_64;
  117. /////////////////////////////////////////////////////////////////////////////
  118. /////////////////////////////////////////////////////////////////////////////
  119. //
  120. // IeXdiX86_64Context
  121. //
  122. /////////////////////////////////////////////////////////////////////////////
  123. /////////////////////////////////////////////////////////////////////////////
  124. // X86_64 context access interface
  125. [
  126. object,
  127. uuid(4795B125-6CDE-4e76-B8D3-D5ED69ECE739),
  128. helpstring("IeXdiX86_64Context interface - eXdi Context access for 64 Bit X86 processors 1.0 for Platform Builder 3.0 debugger - Microsoft 1999"),
  129. pointer_default(ref)
  130. ]
  131. interface IeXdiX86_64Context : IUnknown
  132. {
  133. /*++
  134. Routine Name:
  135. GetContext
  136. Routine Description:
  137. Read Context - Read a set of CPU / Co-Proc registers that define the state of the target
  138. The CONTEXT.RegGroupSelection bitfield allow to select which group of register need to be read only
  139. Argument(s):
  140. pContext - Return context (CPU dependant structure).
  141. Note: The context is also passed in to indicate only the RegGroupSelection (which reg groups are read)
  142. Return Value:
  143. Error status:
  144. S_OK: Function successful
  145. EXDI_E_CANNOTWHILETGTRUNNING Cannot proceed while target running. Must halt the target first.
  146. Note: this error is generated only if the probe / target does not support this operation "on the fly".
  147. see DEBUG_ACCESS_CAPABILITIES_STRUCT.fReadRegWhileRunning
  148. EXDI_E_NOTIMPL: Not implemented
  149. EXDI_E_OUTOFMEMORY: Failed to allocate necessary memory
  150. EXDI_E_INVALIDARG: One or more arguments are invalid
  151. EXDI_E_ABORT: Operation aborted
  152. EXDI_E_FAIL: Unspecified failure
  153. EXDI_E_COMMUNICATION: Communication error between host driver and target
  154. EXDI_E_USEDBYCONCURENTTHREAD: Cannot proceed immediately because resource is already used by concurent thread.
  155. --*/
  156. HRESULT GetContext
  157. (
  158. [in, out] PCONTEXT_X86_64 pContext
  159. );
  160. /*++
  161. Routine Name:
  162. SetContext
  163. Routine Description:
  164. Write Context - Write a set of CPU / Co-Proc registers that define the state of the target
  165. The CONTEXT.RegGroupSelection bitfield allow to select which group of register need to be written only
  166. Argument(s):
  167. pContext - Return context (CPU dependant structure).
  168. Note: The context is also passed in to indicate only the RegGroupSelection (which reg groups are read)
  169. Return Value:
  170. Error status:
  171. S_OK: Function successful
  172. EXDI_E_CANNOTWHILETGTRUNNING Cannot proceed while target running. Must halt the target first.
  173. Note: this error is generated only if the probe / target does not support this operation "on the fly".
  174. see DEBUG_ACCESS_CAPABILITIES_STRUCT.fWriteRegWhileRunning
  175. EXDI_E_NOTIMPL: Not implemented
  176. EXDI_E_OUTOFMEMORY: Failed to allocate necessary memory
  177. EXDI_E_INVALIDARG: One or more arguments are invalid
  178. EXDI_E_ABORT: Operation aborted
  179. EXDI_E_FAIL: Unspecified failure
  180. EXDI_E_COMMUNICATION: Communication error between host driver and target
  181. EXDI_E_USEDBYCONCURENTTHREAD: Cannot proceed immediately because resource is already used by concurent thread.
  182. --*/
  183. HRESULT SetContext
  184. (
  185. [in] CONTEXT_X86_64 Context
  186. );
  187. }; // interface IeXdiX86_64Context