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.

193 lines
8.8 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // ARM machine implementation.
  4. //
  5. // Copyright (C) Microsoft Corporation, 2001-2002.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __ARM_MACH_HPP__
  9. #define __ARM_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. typedef union _ARMI* PARMI;
  19. struct ArmDecode;
  20. class ArmMachineInfo : public MachineInfo
  21. {
  22. public:
  23. ArmMachineInfo(TargetInfo* Target);
  24. // MachineInfo.
  25. virtual HRESULT Initialize(void);
  26. virtual void GetSystemTypeInfo(PSYSTEM_TYPE_INFO Info);
  27. virtual void GetDefaultKdData(PKDDEBUGGER_DATA64 KdData);
  28. virtual void InitializeContext
  29. (ULONG64 Pc, PDBGKD_ANY_CONTROL_REPORT ControlReport);
  30. virtual HRESULT KdGetContextState(ULONG State);
  31. virtual HRESULT KdSetContext(void);
  32. virtual HRESULT ConvertContextFrom(PCROSS_PLATFORM_CONTEXT Context,
  33. ULONG FromSver,
  34. ULONG FromSize, PVOID From);
  35. virtual HRESULT ConvertContextTo(PCROSS_PLATFORM_CONTEXT Context,
  36. ULONG ToSver, ULONG ToSize, PVOID To);
  37. virtual void InitializeContextFlags(PCROSS_PLATFORM_CONTEXT Context,
  38. ULONG Version);
  39. virtual HRESULT GetContextFromThreadStack(ULONG64 ThreadBase,
  40. PCROSS_PLATFORM_CONTEXT Context,
  41. ULONG64 Stack);
  42. virtual HRESULT GetContextFromFiber(ProcessInfo* Process,
  43. ULONG64 FiberBase,
  44. PCROSS_PLATFORM_CONTEXT Context,
  45. BOOL Verbose);
  46. virtual HRESULT GetContextFromTrapFrame(ULONG64 TrapBase,
  47. PCROSS_PLATFORM_CONTEXT Context,
  48. BOOL Verbose);
  49. virtual void GetScopeFrameFromContext(PCROSS_PLATFORM_CONTEXT Context,
  50. PDEBUG_STACK_FRAME ScopeFrame);
  51. virtual HRESULT GetScopeFrameRegister(ULONG Reg,
  52. PDEBUG_STACK_FRAME ScopeFrame,
  53. PULONG64 Value);
  54. virtual HRESULT SetScopeFrameRegister(ULONG Reg,
  55. PDEBUG_STACK_FRAME ScopeFrame,
  56. ULONG64 Value);
  57. virtual int GetType(ULONG Reg);
  58. virtual HRESULT GetVal(ULONG Reg, REGVAL* Val);
  59. virtual HRESULT SetVal(ULONG Reg, REGVAL* Val);
  60. virtual void GetPC(PADDR Address);
  61. virtual void SetPC(PADDR Address);
  62. virtual void GetFP(PADDR Address);
  63. virtual void GetSP(PADDR Address);
  64. virtual ULONG64 GetArgReg(void);
  65. virtual ULONG64 GetRetReg(void);
  66. virtual void OutputAll(ULONG Mask, ULONG OutMask);
  67. virtual HRESULT SetAndOutputTrapFrame(ULONG64 TrapBase,
  68. PCROSS_PLATFORM_CONTEXT Context);
  69. virtual TRACEMODE GetTraceMode(void);
  70. virtual void SetTraceMode(TRACEMODE Mode);
  71. virtual BOOL IsStepStatusSupported(ULONG Status);
  72. virtual ULONG ExecutingMachine(void);
  73. virtual HRESULT SetPageDirectory(ThreadInfo* Thread,
  74. ULONG Idx, ULONG64 PageDir,
  75. PULONG NextIdx);
  76. virtual HRESULT GetVirtualTranslationPhysicalOffsets
  77. (ThreadInfo* Thread, ULONG64 Virt, PULONG64 Offsets, ULONG OffsetsSize,
  78. PULONG Levels, PULONG PfIndex, PULONG64 LastPhys);
  79. virtual HRESULT GetBaseTranslationVirtualOffset(PULONG64 Offset);
  80. virtual void DecodePte(ULONG64 Pte, PULONG64 PageFrameNumber,
  81. PULONG Flags);
  82. virtual void Assemble(ProcessInfo* Process,
  83. PADDR Addr, PSTR Input);
  84. virtual BOOL Disassemble(ProcessInfo* Process,
  85. PADDR Addr, PSTR Buffer, BOOL EffAddr);
  86. virtual BOOL IsBreakpointInstruction(ProcessInfo* Process, PADDR Addr);
  87. virtual HRESULT InsertBreakpointInstruction(PUSER_DEBUG_SERVICES Services,
  88. ULONG64 Process,
  89. ULONG64 Offset,
  90. ULONG Flags,
  91. PUCHAR SaveInstr,
  92. PULONG64 ChangeStart,
  93. PULONG ChangeLen);
  94. virtual HRESULT RemoveBreakpointInstruction(PUSER_DEBUG_SERVICES Services,
  95. ULONG64 Process,
  96. ULONG64 Offset,
  97. PUCHAR SaveInstr,
  98. PULONG64 ChangeStart,
  99. PULONG ChangeLen);
  100. virtual void AdjustPCPastBreakpointInstruction(PADDR Addr,
  101. ULONG BreakType);
  102. virtual BOOL IsCallDisasm(PCSTR Disasm);
  103. virtual BOOL IsReturnDisasm(PCSTR Disasm);
  104. virtual BOOL IsSystemCallDisasm(PCSTR Disasm);
  105. virtual BOOL IsDelayInstruction(PADDR Addr);
  106. virtual void GetEffectiveAddr(PADDR Addr, PULONG Size);
  107. virtual void GetNextOffset(ProcessInfo* Process, BOOL StepOver,
  108. PADDR NextAddr, PULONG NextMachine);
  109. virtual void IncrementBySmallestInstruction(PADDR Addr);
  110. virtual void DecrementBySmallestInstruction(PADDR Addr);
  111. virtual void OutputFunctionEntry(PVOID RawEntry);
  112. virtual HRESULT ReadDynamicFunctionTable(ProcessInfo* Process,
  113. ULONG64 Table,
  114. PULONG64 NextTable,
  115. PULONG64 MinAddress,
  116. PULONG64 MaxAddress,
  117. PULONG64 BaseAddress,
  118. PULONG64 TableData,
  119. PULONG TableSize,
  120. PWSTR OutOfProcessDll,
  121. PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE RawTable);
  122. virtual PVOID FindDynamicFunctionEntry(PCROSS_PLATFORM_DYNAMIC_FUNCTION_TABLE Table,
  123. ULONG64 Address,
  124. PVOID TableData,
  125. ULONG TableSize);
  126. virtual HRESULT ReadKernelProcessorId
  127. (ULONG Processor, PDEBUG_PROCESSOR_IDENTIFICATION_ALL Id);
  128. // ArmMachineInfo.
  129. protected:
  130. void DisArmArth(ArmDecode* Decode, PARMI Instr);
  131. void DisArmBi(ArmDecode* Decode, PARMI Instr);
  132. void DisArmBkpt(ArmDecode* Decode, PARMI Instr);
  133. void DisArmBxi(ArmDecode* Decode, PARMI Instr);
  134. void DisArmBxr(ArmDecode* Decode, PARMI Instr);
  135. void DisArmCdp(ArmDecode* Decode, PARMI Instr);
  136. void DisArmClz(ArmDecode* Decode, PARMI Instr);
  137. void DisArmCmp(ArmDecode* Decode, PARMI Instr);
  138. void DisArmLdc(ArmDecode* Decode, PARMI Instr);
  139. void DisArmLdm(ArmDecode* Decode, PARMI Instr);
  140. void DisArmLdr(ArmDecode* Decode, PARMI Instr);
  141. void DisArmLdrh(ArmDecode* Decode, PARMI Instr);
  142. void DisArmMcr(ArmDecode* Decode, PARMI Instr);
  143. void DisArmMcrr(ArmDecode* Decode, PARMI Instr);
  144. void DisArmMov(ArmDecode* Decode, PARMI Instr);
  145. void DisArmMrs(ArmDecode* Decode, PARMI Instr);
  146. void DisArmMsr(ArmDecode* Decode, PARMI Instr);
  147. void DisArmMul(ArmDecode* Decode, PARMI Instr);
  148. void DisArmQadd(ArmDecode* Decode, PARMI Instr);
  149. void DisArmSmla(ArmDecode* Decode, PARMI Instr);
  150. void DisArmSmlal(ArmDecode* Decode, PARMI Instr);
  151. void DisArmSmul(ArmDecode* Decode, PARMI Instr);
  152. void DisArmSwi(ArmDecode* Decode, PARMI Instr);
  153. void DisArmSwp(ArmDecode* Decode, PARMI Instr);
  154. void BufferEffectiveAddress(ULONG64 Offset, ULONG Size);
  155. void BufferArmDpArg(PARMI Instr);
  156. void BufferArmShift(ULONG Shift);
  157. void BufferRegName(ULONG Reg);
  158. void BufferCond(ULONG Cond);
  159. ADDR m_DisStart;
  160. ULONG m_ArgCol;
  161. ADDR m_EffAddr;
  162. ULONG m_EaSize;
  163. };
  164. #endif // #ifndef __ARM_MACH_HPP__