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.

190 lines
8.2 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Alpha machine implementation.
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000-2001.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __ALPHA_MACH_HPP__
  9. #define __ALPHA_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 AlphaMachineInfo : public MachineInfo
  19. {
  20. public:
  21. // MachineInfo.
  22. virtual HRESULT InitializeConstants(void);
  23. virtual void InitializeContext
  24. (ULONG64 Pc, PDBGKD_ANY_CONTROL_REPORT ControlReport);
  25. virtual HRESULT KdGetContextState(ULONG State);
  26. virtual HRESULT KdSetContext(void);
  27. virtual HRESULT ConvertContextFrom(PCROSS_PLATFORM_CONTEXT Context,
  28. ULONG FromSver,
  29. ULONG FromSize, PVOID From);
  30. virtual HRESULT ConvertContextTo(PCROSS_PLATFORM_CONTEXT Context,
  31. ULONG ToSver, ULONG ToSize, PVOID To);
  32. virtual void InitializeContextFlags(PCROSS_PLATFORM_CONTEXT Context,
  33. ULONG Version);
  34. virtual int GetType(ULONG index);
  35. virtual BOOL GetVal(ULONG index, REGVAL *val);
  36. virtual BOOL SetVal(ULONG index, REGVAL *val);
  37. virtual void OutputAll(ULONG Mask, ULONG OutMask);
  38. virtual TRACEMODE GetTraceMode(void);
  39. virtual void SetTraceMode(TRACEMODE Mode);
  40. virtual BOOL IsStepStatusSupported(ULONG Status);
  41. virtual ULONG ExecutingMachine(void);
  42. virtual void Assemble(PADDR Addr, PSTR Input);
  43. virtual BOOL Disassemble(PADDR Addr, PSTR Buffer, BOOL EffAddr);
  44. virtual BOOL IsBreakpointInstruction(PADDR Addr);
  45. virtual HRESULT InsertBreakpointInstruction(PUSER_DEBUG_SERVICES Services,
  46. ULONG64 Process,
  47. ULONG64 Offset,
  48. PUCHAR SaveInstr,
  49. PULONG64 ChangeStart,
  50. PULONG ChangeLen);
  51. virtual HRESULT RemoveBreakpointInstruction(PUSER_DEBUG_SERVICES Services,
  52. ULONG64 Process,
  53. ULONG64 Offset,
  54. PUCHAR SaveInstr,
  55. PULONG64 ChangeStart,
  56. PULONG ChangeLen);
  57. virtual void AdjustPCPastBreakpointInstruction(PADDR Addr,
  58. ULONG BreakType);
  59. virtual BOOL IsCallDisasm(PCSTR Disasm);
  60. virtual BOOL IsReturnDisasm(PCSTR Disasm);
  61. virtual BOOL IsSystemCallDisasm(PCSTR Disasm);
  62. virtual BOOL IsDelayInstruction(PADDR Addr);
  63. virtual void GetEffectiveAddr(PADDR Addr);
  64. virtual void GetNextOffset(BOOL StepOver,
  65. PADDR NextAddr, PULONG NextMachine);
  66. virtual void IncrementBySmallestInstruction(PADDR Addr);
  67. virtual void DecrementBySmallestInstruction(PADDR Addr);
  68. virtual BOOL DisplayTrapFrame(ULONG64 FrameAddress,
  69. OUT PCROSS_PLATFORM_CONTEXT Context);
  70. virtual void ValidateCxr(PCROSS_PLATFORM_CONTEXT Context);
  71. virtual void PrintStackFrameAddresses(ULONG Flags,
  72. PDEBUG_STACK_FRAME StackFrame);
  73. virtual HRESULT ReadKernelProcessorId
  74. (ULONG Processor, PDEBUG_PROCESSOR_IDENTIFICATION_ALL Id);
  75. // AlphaMachineInfo.
  76. void OutputFunctionEntry64(PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY Entry);
  77. ULONG GetIntRegNumber(ULONG Index)
  78. {
  79. return ALPHA_INT64_BASE + Index;
  80. }
  81. void BufferEffectiveAddress(ULONG64);
  82. void BufferReg(ULONG);
  83. void BufferFReg(ULONG);
  84. };
  85. class Axp32MachineInfo : public AlphaMachineInfo
  86. {
  87. public:
  88. virtual HRESULT InitializeConstants(void);
  89. virtual HRESULT InitializeForTarget(void);
  90. virtual HRESULT GetContextFromThreadStack(ULONG64 ThreadBase,
  91. PCROSS_PLATFORM_THREAD Thread,
  92. PCROSS_PLATFORM_CONTEXT Context,
  93. PDEBUG_STACK_FRAME Frame,
  94. PULONG RunningOnProc);
  95. virtual void GetPC(PADDR Address);
  96. virtual void SetPC(PADDR Address);
  97. virtual void GetFP(PADDR Address);
  98. virtual void GetSP(PADDR Address);
  99. virtual ULONG64 GetArgReg(void);
  100. virtual HRESULT SetPageDirectory(ULONG Idx, ULONG64 PageDir,
  101. PULONG NextIdx);
  102. virtual HRESULT GetVirtualTranslationPhysicalOffsets
  103. (ULONG64 Virt, PULONG64 Offsets, ULONG OffsetsSize,
  104. PULONG Levels, PULONG PfIndex, PULONG64 LastPhys);
  105. virtual HRESULT GetBaseTranslationVirtualOffset(PULONG64 Offset);
  106. virtual void OutputFunctionEntry(PVOID RawEntry);
  107. virtual HRESULT ReadDynamicFunctionTable(ULONG64 Table,
  108. PULONG64 NextTable,
  109. PULONG64 MinAddress,
  110. PULONG64 MaxAddress,
  111. PULONG64 BaseAddress,
  112. PULONG64 TableData,
  113. PULONG TableSize,
  114. PWSTR OutOfProcessDll,
  115. PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE RawTable);
  116. virtual PVOID FindDynamicFunctionEntry(PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE Table,
  117. ULONG64 Address,
  118. PVOID TableData,
  119. ULONG TableSize);
  120. };
  121. class Axp64MachineInfo : public AlphaMachineInfo
  122. {
  123. public:
  124. virtual HRESULT InitializeConstants(void);
  125. virtual HRESULT InitializeForTarget(void);
  126. virtual HRESULT GetContextFromThreadStack(ULONG64 ThreadBase,
  127. PCROSS_PLATFORM_THREAD Thread,
  128. PCROSS_PLATFORM_CONTEXT Context,
  129. PDEBUG_STACK_FRAME Frame,
  130. PULONG RunningOnProc);
  131. virtual void GetPC(PADDR Address);
  132. virtual void SetPC(PADDR Address);
  133. virtual void GetFP(PADDR Address);
  134. virtual void GetSP(PADDR Address);
  135. virtual ULONG64 GetArgReg(void);
  136. virtual HRESULT SetPageDirectory(ULONG Idx, ULONG64 PageDir,
  137. PULONG NextIdx);
  138. virtual HRESULT GetVirtualTranslationPhysicalOffsets
  139. (ULONG64 Virt, PULONG64 Offsets, ULONG OffsetsSize,
  140. PULONG Levels, PULONG PfIndex, PULONG64 LastVal);
  141. virtual HRESULT GetBaseTranslationVirtualOffset(PULONG64 Offset);
  142. virtual void OutputFunctionEntry(PVOID RawEntry);
  143. virtual HRESULT ReadDynamicFunctionTable(ULONG64 Table,
  144. PULONG64 NextTable,
  145. PULONG64 MinAddress,
  146. PULONG64 MaxAddress,
  147. PULONG64 BaseAddress,
  148. PULONG64 TableData,
  149. PULONG TableSize,
  150. PWSTR OutOfProcessDll,
  151. PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE RawTable);
  152. virtual PVOID FindDynamicFunctionEntry(PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE Table,
  153. ULONG64 Address,
  154. PVOID TableData,
  155. ULONG TableSize);
  156. };
  157. extern Axp32MachineInfo g_Axp32Machine;
  158. extern Axp64MachineInfo g_Axp64Machine;
  159. #endif // #ifndef __ALPHA_MACH_HPP__