Leaked source code of windows server 2003
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.

252 lines
12 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // IA64 machine implementation.
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000-2002.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __IA64_MACH_HPP__
  9. #define __IA64_MACH_HPP__
  10. //
  11. // NOTE: Be very careful when using machine-specific header files
  12. // such as nt<plat>.h. The machine implementation class is
  13. // compiled for all platforms so the nt<plat>.h file will be the
  14. // one for the build platform, not necessarily the platform
  15. // of the machine implementation. ntdbg.h contains many cross-platform
  16. // types and definitions that can be used to avoid problems.
  17. //
  18. class Ia64MachineInfo : public MachineInfo
  19. {
  20. public:
  21. Ia64MachineInfo(TargetInfo* Target);
  22. // MachineInfo.
  23. virtual HRESULT Initialize(void);
  24. virtual void GetSystemTypeInfo(PSYSTEM_TYPE_INFO Info);
  25. virtual void GetDefaultKdData(PKDDEBUGGER_DATA64 KdData);
  26. virtual void InitializeContext
  27. (ULONG64 Pc, PDBGKD_ANY_CONTROL_REPORT ControlReport);
  28. virtual HRESULT KdGetContextState(ULONG State);
  29. virtual HRESULT KdSetContext(void);
  30. virtual HRESULT ConvertContextFrom(PCROSS_PLATFORM_CONTEXT Context,
  31. ULONG FromSver,
  32. ULONG FromSize, PVOID From);
  33. virtual HRESULT ConvertContextTo(PCROSS_PLATFORM_CONTEXT Context,
  34. ULONG ToSver, ULONG ToSize, PVOID To);
  35. virtual void InitializeContextFlags(PCROSS_PLATFORM_CONTEXT Context,
  36. ULONG Version);
  37. virtual HRESULT GetContextFromThreadStack(ULONG64 ThreadBase,
  38. PCROSS_PLATFORM_CONTEXT Context,
  39. ULONG64 Stack);
  40. virtual HRESULT GetContextFromFiber(ProcessInfo* Process,
  41. ULONG64 FiberBase,
  42. PCROSS_PLATFORM_CONTEXT Context,
  43. BOOL Verbose);
  44. virtual HRESULT GetContextFromTrapFrame(ULONG64 TrapBase,
  45. PCROSS_PLATFORM_CONTEXT Context,
  46. BOOL Verbose);
  47. virtual void GetScopeFrameFromContext(PCROSS_PLATFORM_CONTEXT Context,
  48. PDEBUG_STACK_FRAME ScopeFrame);
  49. virtual HRESULT GetScopeFrameRegister(ULONG Reg,
  50. PDEBUG_STACK_FRAME ScopeFrame,
  51. PULONG64 Value);
  52. virtual HRESULT SetScopeFrameRegister(ULONG Reg,
  53. PDEBUG_STACK_FRAME ScopeFrame,
  54. ULONG64 Value);
  55. virtual HRESULT GetExdiContext(IUnknown* Exdi,
  56. PEXDI_CONTEXT Context,
  57. EXDI_CONTEXT_TYPE CtxType);
  58. virtual HRESULT SetExdiContext(IUnknown* Exdi,
  59. PEXDI_CONTEXT Context,
  60. EXDI_CONTEXT_TYPE CtxType);
  61. virtual void ConvertExdiContextFromContext(PCROSS_PLATFORM_CONTEXT Context,
  62. PEXDI_CONTEXT ExdiContext,
  63. EXDI_CONTEXT_TYPE CtxType);
  64. virtual void ConvertExdiContextToContext(PEXDI_CONTEXT ExdiContext,
  65. EXDI_CONTEXT_TYPE CtxType,
  66. PCROSS_PLATFORM_CONTEXT Context);
  67. virtual void ConvertExdiContextToSegDescs(PEXDI_CONTEXT ExdiContext,
  68. EXDI_CONTEXT_TYPE CtxType,
  69. ULONG Start, ULONG Count,
  70. PDESCRIPTOR64 Descs);
  71. virtual void ConvertExdiContextFromSpecial
  72. (PCROSS_PLATFORM_KSPECIAL_REGISTERS Special,
  73. PEXDI_CONTEXT ExdiContext,
  74. EXDI_CONTEXT_TYPE CtxType);
  75. virtual void ConvertExdiContextToSpecial
  76. (PEXDI_CONTEXT ExdiContext,
  77. EXDI_CONTEXT_TYPE CtxType,
  78. PCROSS_PLATFORM_KSPECIAL_REGISTERS Special);
  79. virtual int GetType(ULONG Reg);
  80. virtual HRESULT GetVal(ULONG Reg, REGVAL* Val);
  81. virtual HRESULT SetVal(ULONG Reg, REGVAL* Val);
  82. virtual void GetPC(PADDR Address);
  83. virtual void SetPC(PADDR Address);
  84. virtual void GetFP(PADDR Address);
  85. virtual void GetSP(PADDR Address);
  86. virtual ULONG64 GetArgReg(void);
  87. virtual ULONG64 GetRetReg(void);
  88. virtual void OutputAll(ULONG Mask, ULONG OutMask);
  89. virtual HRESULT SetAndOutputTrapFrame(ULONG64 TrapBase,
  90. PCROSS_PLATFORM_CONTEXT Context);
  91. virtual TRACEMODE GetTraceMode(void);
  92. virtual void SetTraceMode(TRACEMODE Mode);
  93. virtual BOOL IsStepStatusSupported(ULONG Status);
  94. virtual void KdUpdateControlSet
  95. (PDBGKD_ANY_CONTROL_SET ControlSet);
  96. virtual ULONG ExecutingMachine(void);
  97. virtual HRESULT SetPageDirectory(ThreadInfo* Thread,
  98. ULONG Idx, ULONG64 PageDir,
  99. PULONG NextIdx);
  100. virtual HRESULT GetVirtualTranslationPhysicalOffsets
  101. (ThreadInfo* Thread, ULONG64 Virt, PULONG64 Offsets, ULONG OffsetsSize,
  102. PULONG Levels, PULONG PfIndex, PULONG64 LastVal);
  103. virtual HRESULT GetBaseTranslationVirtualOffset(PULONG64 Offset);
  104. virtual void DecodePte(ULONG64 Pte, PULONG64 PageFrameNumber,
  105. PULONG Flags);
  106. virtual void Assemble(ProcessInfo* Process,
  107. PADDR Addr, PSTR Input);
  108. virtual BOOL Disassemble(ProcessInfo* Process,
  109. PADDR Addr, PSTR Buffer, BOOL EffAddr);
  110. virtual HRESULT NewBreakpoint(DebugClient* Client,
  111. ULONG Type,
  112. ULONG Id,
  113. Breakpoint** RetBp);
  114. virtual BOOL IsBreakpointInstruction(ProcessInfo* Process, PADDR Addr);
  115. virtual HRESULT InsertBreakpointInstruction(PUSER_DEBUG_SERVICES Services,
  116. ULONG64 Process,
  117. ULONG64 Offset,
  118. ULONG Flags,
  119. PUCHAR SaveInstr,
  120. PULONG64 ChangeStart,
  121. PULONG ChangeLen);
  122. virtual HRESULT RemoveBreakpointInstruction(PUSER_DEBUG_SERVICES Services,
  123. ULONG64 Process,
  124. ULONG64 Offset,
  125. PUCHAR SaveInstr,
  126. PULONG64 ChangeStart,
  127. PULONG ChangeLen);
  128. virtual void AdjustPCPastBreakpointInstruction(PADDR Addr,
  129. ULONG BreakType);
  130. virtual void InsertThreadDataBreakpoints(void);
  131. virtual void RemoveThreadDataBreakpoints(void);
  132. virtual ULONG IsBreakpointOrStepException(PEXCEPTION_RECORD64 Record,
  133. ULONG FirstChance,
  134. PADDR BpAddr,
  135. PADDR RelAddr);
  136. virtual BOOL IsCallDisasm(PCSTR Disasm);
  137. virtual BOOL IsReturnDisasm(PCSTR Disasm);
  138. virtual BOOL IsSystemCallDisasm(PCSTR Disasm);
  139. virtual BOOL IsDelayInstruction(PADDR Addr);
  140. virtual void GetEffectiveAddr(PADDR Addr, PULONG Size);
  141. virtual void GetNextOffset(ProcessInfo* Process, BOOL StepOver,
  142. PADDR NextAddr, PULONG NextMachine);
  143. virtual BOOL GetPrefixedSymbolOffset(ProcessInfo* Process,
  144. ULONG64 SymOffset,
  145. ULONG Flags,
  146. PULONG64 PrefixedSymOffset);
  147. virtual void IncrementBySmallestInstruction(PADDR Addr);
  148. virtual void DecrementBySmallestInstruction(PADDR Addr);
  149. virtual void OutputFunctionEntry(PVOID RawEntry);
  150. virtual HRESULT ReadDynamicFunctionTable(ProcessInfo* Process,
  151. ULONG64 Table,
  152. PULONG64 NextTable,
  153. PULONG64 MinAddress,
  154. PULONG64 MaxAddress,
  155. PULONG64 BaseAddress,
  156. PULONG64 TableData,
  157. PULONG TableSize,
  158. PWSTR OutOfProcessDll,
  159. PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE RawTable);
  160. virtual PVOID FindDynamicFunctionEntry(PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE Table,
  161. ULONG64 Address,
  162. PVOID TableData,
  163. ULONG TableSize);
  164. virtual HRESULT GetUnwindInfoBounds(ProcessInfo* Process,
  165. ULONG64 TableBase,
  166. PVOID RawTableEntries,
  167. ULONG EntryIndex,
  168. PULONG64 Start,
  169. PULONG Size);
  170. virtual HRESULT ReadKernelProcessorId
  171. (ULONG Processor, PDEBUG_PROCESSOR_IDENTIFICATION_ALL Id);
  172. virtual HRESULT GetAlternateTriageDumpDataRanges(ULONG64 PrcbBase,
  173. ULONG64 ThreadBase,
  174. PADDR_RANGE Ranges);
  175. virtual void PrintStackFrameAddressesTitle(ULONG Flags);
  176. virtual void PrintStackFrameAddresses(ULONG Flags,
  177. PDEBUG_STACK_FRAME StackFrame);
  178. virtual void PrintStackArgumentsTitle(ULONG Flags);
  179. virtual void PrintStackArguments(ULONG Flags,
  180. PDEBUG_STACK_FRAME StackFrame);
  181. virtual void PrintStackNonvolatileRegisters(ULONG Flags,
  182. PDEBUG_STACK_FRAME StackFrame,
  183. PCROSS_PLATFORM_CONTEXT Context,
  184. ULONG FrameNum);
  185. virtual void PrintStackFrameMemoryUsage(PDEBUG_STACK_FRAME CurFrame,
  186. PDEBUG_STACK_FRAME PrevFrame);
  187. // Ia64MachineInfo.
  188. BOOL IsIA32InstructionSet(VOID);
  189. void SetKernelPageDirectory(ULONG64 PageDir)
  190. {
  191. m_KernPageDir = PageDir;
  192. }
  193. protected:
  194. ULONG64 m_KernPageDir;
  195. ULONG64 m_IfsOverride;
  196. ULONG64 m_BspOverride;
  197. HRESULT GetRotatingRegVal(ULONG Reg,
  198. ULONG64 Bsp,
  199. ULONG64 FrameMarker,
  200. REGVAL* Val);
  201. HRESULT SetRotatingRegVal(ULONG Reg,
  202. ULONG64 Bsp,
  203. ULONG64 FrameMarker,
  204. REGVAL* Val);
  205. HRESULT GetStackedRegVal(IN ProcessInfo* Process,
  206. IN ULONG64 RsBSP,
  207. IN ULONG64 FrameMarker,
  208. IN ULONG64 RsRNAT,
  209. IN ULONG Reg,
  210. OUT REGVAL* Val);
  211. HRESULT SetStackedRegVal(IN ProcessInfo* Process,
  212. IN ULONG64 RsBSP,
  213. IN ULONG64 FrameMarker,
  214. IN ULONG64 *RsRNAT,
  215. IN ULONG Reg,
  216. IN REGVAL* Val);
  217. friend class X86OnIa64MachineInfo;
  218. };
  219. #endif // #ifndef __IA64_MACH_HPP__