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.

142 lines
6.1 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // AMD64 machine implementation.
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000-2001.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __AMD64_MACH_HPP__
  9. #define __AMD64_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. #define AMD64_MAX_INSTRUCTION_LEN 16
  19. class Amd64MachineInfo : public BaseX86MachineInfo
  20. {
  21. public:
  22. // MachineInfo.
  23. virtual HRESULT InitializeConstants(void);
  24. virtual HRESULT InitializeForTarget(void);
  25. virtual void InitializeContext
  26. (ULONG64 Pc, PDBGKD_ANY_CONTROL_REPORT ControlReport);
  27. virtual HRESULT KdGetContextState(ULONG State);
  28. virtual HRESULT KdSetContext(void);
  29. virtual HRESULT ConvertContextFrom(PCROSS_PLATFORM_CONTEXT Context,
  30. ULONG FromSver,
  31. ULONG FromSize, PVOID From);
  32. virtual HRESULT ConvertContextTo(PCROSS_PLATFORM_CONTEXT Context,
  33. ULONG ToSver, ULONG ToSize, PVOID To);
  34. virtual void InitializeContextFlags(PCROSS_PLATFORM_CONTEXT Context,
  35. ULONG Version);
  36. virtual HRESULT GetContextFromThreadStack(ULONG64 ThreadBase,
  37. PCROSS_PLATFORM_THREAD Thread,
  38. PCROSS_PLATFORM_CONTEXT Context,
  39. PDEBUG_STACK_FRAME Frame,
  40. PULONG RunningOnProc);
  41. virtual HRESULT GetExdiContext(IUnknown* Exdi, PEXDI_CONTEXT Context);
  42. virtual HRESULT SetExdiContext(IUnknown* Exdi, PEXDI_CONTEXT Context);
  43. virtual void ConvertExdiContextFromContext(PCROSS_PLATFORM_CONTEXT Context,
  44. PEXDI_CONTEXT ExdiContext);
  45. virtual void ConvertExdiContextToContext(PEXDI_CONTEXT ExdiContext,
  46. PCROSS_PLATFORM_CONTEXT Context);
  47. virtual void ConvertExdiContextToSegDescs(PEXDI_CONTEXT ExdiContext,
  48. ULONG Start, ULONG Count,
  49. PDESCRIPTOR64 Descs);
  50. virtual void ConvertExdiContextFromSpecial
  51. (PCROSS_PLATFORM_KSPECIAL_REGISTERS Special,
  52. PEXDI_CONTEXT ExdiContext);
  53. virtual void ConvertExdiContextToSpecial
  54. (PEXDI_CONTEXT ExdiContext,
  55. PCROSS_PLATFORM_KSPECIAL_REGISTERS Special);
  56. virtual int GetType(ULONG index);
  57. virtual BOOL GetVal(ULONG index, REGVAL *val);
  58. virtual BOOL SetVal(ULONG index, REGVAL *val);
  59. virtual void GetPC(PADDR Address);
  60. virtual void SetPC(PADDR Address);
  61. virtual void GetFP(PADDR Address);
  62. virtual void GetSP(PADDR Address);
  63. virtual ULONG64 GetArgReg(void);
  64. virtual ULONG GetSegRegNum(ULONG SegReg);
  65. virtual HRESULT GetSegRegDescriptor(ULONG SegReg, PDESCRIPTOR64 Desc);
  66. virtual void OutputAll(ULONG Mask, ULONG OutMask);
  67. virtual TRACEMODE GetTraceMode(void);
  68. virtual void SetTraceMode(TRACEMODE Mode);
  69. virtual BOOL IsStepStatusSupported(ULONG Status);
  70. virtual void KdUpdateControlSet
  71. (PDBGKD_ANY_CONTROL_SET ControlSet);
  72. virtual void KdSaveProcessorState(void);
  73. virtual void KdRestoreProcessorState(void);
  74. virtual ULONG ExecutingMachine(void);
  75. virtual HRESULT SetPageDirectory(ULONG Idx, ULONG64 PageDir,
  76. PULONG NextIdx);
  77. virtual HRESULT GetVirtualTranslationPhysicalOffsets
  78. (ULONG64 Virt, PULONG64 Offsets, ULONG OffsetsSize,
  79. PULONG Levels, PULONG PfIndex, PULONG64 LastVal);
  80. virtual HRESULT GetBaseTranslationVirtualOffset(PULONG64 Offset);
  81. virtual HRESULT NewBreakpoint(DebugClient* Client,
  82. ULONG Type,
  83. ULONG Id,
  84. Breakpoint** RetBp);
  85. virtual void InsertAllDataBreakpoints(void);
  86. virtual void RemoveAllDataBreakpoints(void);
  87. virtual ULONG IsBreakpointOrStepException(PEXCEPTION_RECORD64 Record,
  88. ULONG FirstChance,
  89. PADDR BpAddr,
  90. PADDR RelAddr);
  91. virtual BOOL DisplayTrapFrame(ULONG64 FrameAddress,
  92. PCROSS_PLATFORM_CONTEXT Context);
  93. virtual void ValidateCxr(PCROSS_PLATFORM_CONTEXT Context);
  94. virtual void OutputFunctionEntry(PVOID RawEntry);
  95. virtual HRESULT ReadDynamicFunctionTable(ULONG64 Table,
  96. PULONG64 NextTable,
  97. PULONG64 MinAddress,
  98. PULONG64 MaxAddress,
  99. PULONG64 BaseAddress,
  100. PULONG64 TableData,
  101. PULONG TableSize,
  102. PWSTR OutOfProcessDll,
  103. PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE RawTable);
  104. virtual PVOID FindDynamicFunctionEntry(PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE Table,
  105. ULONG64 Address,
  106. PVOID TableData,
  107. ULONG TableSize);
  108. virtual HRESULT ReadKernelProcessorId
  109. (ULONG Processor, PDEBUG_PROCESSOR_IDENTIFICATION_ALL Id);
  110. // Amd64MachineInfo.
  111. protected:
  112. AMD64_KSPECIAL_REGISTERS m_SpecialRegContext, m_SavedSpecialRegContext;
  113. void KdGetSpecialRegistersFromContext(void);
  114. void KdSetSpecialRegistersInContext(void);
  115. };
  116. extern Amd64MachineInfo g_Amd64Machine;
  117. extern BOOL g_Amd64InCode64;
  118. #endif // #ifndef __AMD64_MACH_HPP__