LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
EmulateInstructionARM64 Class Reference

#include <EmulateInstructionARM64.h>

Inheritance diagram for EmulateInstructionARM64:
Inheritance graph
[legend]

Classes

struct  Opcode
 
struct  ProcState
 

Public Types

enum  AddrMode { AddrMode_OFF , AddrMode_PRE , AddrMode_POST }
 
enum  BranchType {
  BranchType_CALL , BranchType_ERET , BranchType_DRET , BranchType_RET ,
  BranchType_JMP
}
 
enum  CountOp { CountOp_CLZ , CountOp_CLS , CountOp_CNT }
 
enum  RevOp { RevOp_RBIT , RevOp_REV16 , RevOp_REV32 , RevOp_REV64 }
 
enum  BitwiseOp { BitwiseOp_NOT , BitwiseOp_RBIT }
 
enum  ExceptionLevel { EL0 = 0 , EL1 = 1 , EL2 = 2 , EL3 = 3 }
 
enum  ExtendType {
  ExtendType_SXTB , ExtendType_SXTH , ExtendType_SXTW , ExtendType_SXTX ,
  ExtendType_UXTB , ExtendType_UXTH , ExtendType_UXTW , ExtendType_UXTX
}
 
enum  ExtractType { ExtractType_LEFT , ExtractType_RIGHT }
 
enum  LogicalOp { LogicalOp_AND , LogicalOp_EOR , LogicalOp_ORR }
 
enum  MemOp { MemOp_LOAD , MemOp_STORE , MemOp_PREFETCH , MemOp_NOP }
 
enum  MoveWideOp { MoveWideOp_N , MoveWideOp_Z , MoveWideOp_K }
 
enum  ShiftType { ShiftType_LSL , ShiftType_LSR , ShiftType_ASR , ShiftType_ROR }
 
enum  StackPointerSelection { SP0 = 0 , SPx = 1 }
 
enum  Unpredictable { Unpredictable_WBOVERLAP , Unpredictable_LDPOVERLAP }
 
enum  ConstraintType { Constraint_NONE , Constraint_UNKNOWN , Constraint_SUPPRESSWB , Constraint_NOP }
 
enum  AccType {
  AccType_NORMAL , AccType_UNPRIV , AccType_STREAM , AccType_ALIGNED ,
  AccType_ORDERED
}
 
- Public Types inherited from lldb_private::EmulateInstruction
enum  ContextType {
  eContextInvalid = 0 , eContextReadOpcode , eContextImmediate , eContextPushRegisterOnStack ,
  eContextPopRegisterOffStack , eContextAdjustStackPointer , eContextSetFramePointer , eContextRestoreStackPointer ,
  eContextAdjustBaseRegister , eContextAdjustPC , eContextRegisterPlusOffset , eContextRegisterStore ,
  eContextRegisterLoad , eContextRelativeBranchImmediate , eContextAbsoluteBranchRegister , eContextSupervisorCall ,
  eContextTableBranchReadMemory , eContextWriteRegisterRandomBits , eContextWriteMemoryRandomBits , eContextArithmetic ,
  eContextAdvancePC , eContextReturnFromException
}
 
enum  InfoType {
  eInfoTypeRegisterPlusOffset , eInfoTypeRegisterPlusIndirectOffset , eInfoTypeRegisterToRegisterPlusOffset , eInfoTypeRegisterToRegisterPlusIndirectOffset ,
  eInfoTypeRegisterRegisterOperands , eInfoTypeOffset , eInfoTypeRegister , eInfoTypeImmediate ,
  eInfoTypeImmediateSigned , eInfoTypeAddress , eInfoTypeISAAndImmediate , eInfoTypeISAAndImmediateSigned ,
  eInfoTypeISA , eInfoTypeNoArgs
}
 
typedef size_t(* ReadMemoryCallback) (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
 
typedef size_t(* WriteMemoryCallback) (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
 
typedef bool(* ReadRegisterCallback) (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
 
typedef bool(* WriteRegisterCallback) (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
 
typedef uint32_t InstructionCondition
 

Public Member Functions

 EmulateInstructionARM64 (const lldb_private::ArchSpec &arch)
 
llvm::StringRef GetPluginName () override
 
bool SetTargetTriple (const lldb_private::ArchSpec &arch) override
 
bool SupportsEmulatingInstructionsOfType (lldb_private::InstructionType inst_type) override
 
bool ReadInstruction () override
 
bool EvaluateInstruction (uint32_t evaluate_options) override
 
bool TestEmulation (lldb_private::Stream &out_stream, lldb_private::ArchSpec &arch, lldb_private::OptionValueDictionary *test_data) override
 
std::optional< lldb_private::RegisterInfoGetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num) override
 
bool CreateFunctionEntryUnwind (lldb_private::UnwindPlan &unwind_plan) override
 
- Public Member Functions inherited from lldb_private::EmulateInstruction
 EmulateInstruction (const ArchSpec &arch)
 
 ~EmulateInstruction () override=default
 
virtual bool SupportsEmulatingInstructionsOfType (InstructionType inst_type)=0
 
virtual bool SetTargetTriple (const ArchSpec &arch)=0
 
virtual bool ReadInstruction ()=0
 
virtual std::optional< uint32_t > GetLastInstrSize ()
 
virtual bool EvaluateInstruction (uint32_t evaluate_options)=0
 
virtual InstructionCondition GetInstructionCondition ()
 
virtual bool TestEmulation (Stream &out_stream, ArchSpec &arch, OptionValueDictionary *test_data)=0
 
virtual std::optional< RegisterInfoGetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num)=0
 
virtual bool SetInstruction (const Opcode &insn_opcode, const Address &inst_addr, Target *target)
 
virtual bool CreateFunctionEntryUnwind (UnwindPlan &unwind_plan)
 
std::optional< RegisterValueReadRegister (const RegisterInfo &reg_info)
 
uint64_t ReadRegisterUnsigned (const RegisterInfo &reg_info, uint64_t fail_value, bool *success_ptr)
 
bool WriteRegister (const Context &context, const RegisterInfo &ref_info, const RegisterValue &reg_value)
 
bool WriteRegisterUnsigned (const Context &context, const RegisterInfo &reg_info, uint64_t reg_value)
 
bool ReadRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterValue &reg_value)
 
bool WriteRegister (const Context &context, lldb::RegisterKind reg_kind, uint32_t reg_num, const RegisterValue &reg_value)
 
uint64_t ReadRegisterUnsigned (lldb::RegisterKind reg_kind, uint32_t reg_num, uint64_t fail_value, bool *success_ptr)
 
bool WriteRegisterUnsigned (const Context &context, lldb::RegisterKind reg_kind, uint32_t reg_num, uint64_t reg_value)
 
size_t ReadMemory (const Context &context, lldb::addr_t addr, void *dst, size_t dst_len)
 
uint64_t ReadMemoryUnsigned (const Context &context, lldb::addr_t addr, size_t byte_size, uint64_t fail_value, bool *success_ptr)
 
bool WriteMemory (const Context &context, lldb::addr_t addr, const void *src, size_t src_len)
 
bool WriteMemoryUnsigned (const Context &context, lldb::addr_t addr, uint64_t uval, size_t uval_byte_size)
 
uint32_t GetAddressByteSize () const
 
lldb::ByteOrder GetByteOrder () const
 
const OpcodeGetOpcode () const
 
lldb::addr_t GetAddress () const
 
const ArchSpecGetArchitecture () const
 
void SetBaton (void *baton)
 
void SetCallbacks (ReadMemoryCallback read_mem_callback, WriteMemoryCallback write_mem_callback, ReadRegisterCallback read_reg_callback, WriteRegisterCallback write_reg_callback)
 
void SetReadMemCallback (ReadMemoryCallback read_mem_callback)
 
void SetWriteMemCallback (WriteMemoryCallback write_mem_callback)
 
void SetReadRegCallback (ReadRegisterCallback read_reg_callback)
 
void SetWriteRegCallback (WriteRegisterCallback write_reg_callback)
 
- Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
 
virtual ~PluginInterface ()=default
 
virtual llvm::StringRef GetPluginName ()=0
 
 PluginInterface (const PluginInterface &)=delete
 
PluginInterfaceoperator= (const PluginInterface &)=delete
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static llvm::StringRef GetPluginNameStatic ()
 
static llvm::StringRef GetPluginDescriptionStatic ()
 
static lldb_private::EmulateInstructionCreateInstance (const lldb_private::ArchSpec &arch, lldb_private::InstructionType inst_type)
 
static bool SupportsEmulatingInstructionsOfTypeStatic (lldb_private::InstructionType inst_type)
 
- Static Public Member Functions inherited from lldb_private::EmulateInstruction
static EmulateInstructionFindPlugin (const ArchSpec &arch, InstructionType supported_inst_type, const char *plugin_name)
 
static const char * TranslateRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, std::string &reg_name)
 
static size_t ReadMemoryFrame (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
 
static size_t WriteMemoryFrame (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
 
static bool ReadRegisterFrame (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
 
static bool WriteRegisterFrame (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
 
static size_t ReadMemoryDefault (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
 
static size_t WriteMemoryDefault (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
 
static bool ReadRegisterDefault (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
 
static bool WriteRegisterDefault (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
 
static bool GetBestRegisterKindAndNumber (const RegisterInfo *reg_info, lldb::RegisterKind &reg_kind, uint32_t &reg_num)
 
static uint32_t GetInternalRegisterNumber (RegisterContext *reg_ctx, const RegisterInfo &reg_info)
 

Protected Member Functions

uint32_t GetFramePointerRegisterNumber () const
 
bool BranchTo (const Context &context, uint32_t N, lldb::addr_t target)
 
bool ConditionHolds (const uint32_t cond)
 
bool UsingAArch32 ()
 
bool EmulateADDSUBImm (const uint32_t opcode)
 
template<AddrMode a_mode>
bool EmulateLDPSTP (const uint32_t opcode)
 
template<AddrMode a_mode>
bool EmulateLDRSTRImm (const uint32_t opcode)
 
bool EmulateB (const uint32_t opcode)
 
bool EmulateBcond (const uint32_t opcode)
 
bool EmulateCBZ (const uint32_t opcode)
 
bool EmulateTBZ (const uint32_t opcode)
 

Static Protected Member Functions

static uint64_t AddWithCarry (uint32_t N, uint64_t x, uint64_t y, bool carry_in, EmulateInstructionARM64::ProcState &proc_state)
 
static OpcodeGetOpcodeForInstruction (const uint32_t opcode)
 

Protected Attributes

ProcState m_opcode_pstate
 
ProcState m_emulated_pstate
 
bool m_ignore_conditions
 
- Protected Attributes inherited from lldb_private::EmulateInstruction
ArchSpec m_arch
 
void * m_baton = nullptr
 
ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault
 
WriteMemoryCallback m_write_mem_callback = &WriteMemoryDefault
 
ReadRegisterCallback m_read_reg_callback = &ReadRegisterDefault
 
WriteRegisterCallback m_write_reg_callback = &WriteRegisterDefault
 
lldb::addr_t m_addr = LLDB_INVALID_ADDRESS
 
Opcode m_opcode
 

Additional Inherited Members

- Static Public Attributes inherited from lldb_private::EmulateInstruction
static const InstructionCondition UnconditionalCondition = UINT32_MAX
 

Detailed Description

Definition at line 18 of file EmulateInstructionARM64.h.

Member Enumeration Documentation

◆ AccType

Enumerator
AccType_NORMAL 
AccType_UNPRIV 
AccType_STREAM 
AccType_ALIGNED 
AccType_ORDERED 

Definition at line 125 of file EmulateInstructionARM64.h.

◆ AddrMode

Enumerator
AddrMode_OFF 
AddrMode_PRE 
AddrMode_POST 

Definition at line 75 of file EmulateInstructionARM64.h.

◆ BitwiseOp

Enumerator
BitwiseOp_NOT 
BitwiseOp_RBIT 

Definition at line 89 of file EmulateInstructionARM64.h.

◆ BranchType

Enumerator
BranchType_CALL 
BranchType_ERET 
BranchType_DRET 
BranchType_RET 
BranchType_JMP 

Definition at line 77 of file EmulateInstructionARM64.h.

◆ ConstraintType

Enumerator
Constraint_NONE 
Constraint_UNKNOWN 
Constraint_SUPPRESSWB 
Constraint_NOP 

Definition at line 118 of file EmulateInstructionARM64.h.

◆ CountOp

Enumerator
CountOp_CLZ 
CountOp_CLS 
CountOp_CNT 

Definition at line 85 of file EmulateInstructionARM64.h.

◆ ExceptionLevel

Enumerator
EL0 
EL1 
EL2 
EL3 

Definition at line 91 of file EmulateInstructionARM64.h.

◆ ExtendType

Enumerator
ExtendType_SXTB 
ExtendType_SXTH 
ExtendType_SXTW 
ExtendType_SXTX 
ExtendType_UXTB 
ExtendType_UXTH 
ExtendType_UXTW 
ExtendType_UXTX 

Definition at line 93 of file EmulateInstructionARM64.h.

◆ ExtractType

Enumerator
ExtractType_LEFT 
ExtractType_RIGHT 

Definition at line 104 of file EmulateInstructionARM64.h.

◆ LogicalOp

Enumerator
LogicalOp_AND 
LogicalOp_EOR 
LogicalOp_ORR 

Definition at line 106 of file EmulateInstructionARM64.h.

◆ MemOp

Enumerator
MemOp_LOAD 
MemOp_STORE 
MemOp_PREFETCH 
MemOp_NOP 

Definition at line 108 of file EmulateInstructionARM64.h.

◆ MoveWideOp

Enumerator
MoveWideOp_N 
MoveWideOp_Z 
MoveWideOp_K 

Definition at line 110 of file EmulateInstructionARM64.h.

◆ RevOp

Enumerator
RevOp_RBIT 
RevOp_REV16 
RevOp_REV32 
RevOp_REV64 

Definition at line 87 of file EmulateInstructionARM64.h.

◆ ShiftType

Enumerator
ShiftType_LSL 
ShiftType_LSR 
ShiftType_ASR 
ShiftType_ROR 

Definition at line 112 of file EmulateInstructionARM64.h.

◆ StackPointerSelection

Enumerator
SP0 
SPx 

Definition at line 114 of file EmulateInstructionARM64.h.

◆ Unpredictable

Enumerator
Unpredictable_WBOVERLAP 
Unpredictable_LDPOVERLAP 

Definition at line 116 of file EmulateInstructionARM64.h.

Constructor & Destructor Documentation

◆ EmulateInstructionARM64()

EmulateInstructionARM64::EmulateInstructionARM64 ( const lldb_private::ArchSpec arch)
inline

Definition at line 20 of file EmulateInstructionARM64.h.

Member Function Documentation

◆ AddWithCarry()

uint64_t EmulateInstructionARM64::AddWithCarry ( uint32_t  N,
uint64_t  x,
uint64_t  y,
bool  carry_in,
EmulateInstructionARM64::ProcState proc_state 
)
staticprotected

◆ BranchTo()

bool EmulateInstructionARM64::BranchTo ( const Context context,
uint32_t  N,
lldb::addr_t  target 
)
protected

◆ ConditionHolds()

bool EmulateInstructionARM64::ConditionHolds ( const uint32_t  cond)
protected

◆ CreateFunctionEntryUnwind()

bool EmulateInstructionARM64::CreateFunctionEntryUnwind ( lldb_private::UnwindPlan unwind_plan)
overridevirtual

◆ CreateInstance()

EmulateInstruction * EmulateInstructionARM64::CreateInstance ( const lldb_private::ArchSpec arch,
lldb_private::InstructionType  inst_type 
)
static

◆ EmulateADDSUBImm()

bool EmulateInstructionARM64::EmulateADDSUBImm ( const uint32_t  opcode)
protected

◆ EmulateB()

bool EmulateInstructionARM64::EmulateB ( const uint32_t  opcode)
protected

◆ EmulateBcond()

bool EmulateInstructionARM64::EmulateBcond ( const uint32_t  opcode)
protected

◆ EmulateCBZ()

bool EmulateInstructionARM64::EmulateCBZ ( const uint32_t  opcode)
protected

◆ EmulateLDPSTP()

bool EmulateInstructionARM64::EmulateLDPSTP ( const uint32_t  opcode)
protected

Definition at line 696 of file EmulateInstructionARM64.cpp.

References AddrMode_OFF, AddrMode_POST, lldb_private::Bit32(), lldb_private::Bits32(), Constraint_NONE, Constraint_NOP, Constraint_SUPPRESSWB, Constraint_UNKNOWN, ConstrainUnpredictable(), lldb::eByteOrderLittle, lldb_private::EmulateInstruction::eContextAdjustBaseRegister, lldb_private::EmulateInstruction::eContextAdjustStackPointer, lldb_private::EmulateInstruction::eContextPopRegisterOffStack, lldb_private::EmulateInstruction::eContextPushRegisterOnStack, lldb_private::EmulateInstruction::eContextRegisterLoad, lldb_private::EmulateInstruction::eContextRegisterStore, lldb::eRegisterKindLLDB, error(), lldb_private::fpu_d0_arm64, GetFramePointerRegisterNumber(), GetRegisterInfo(), lldb_private::gpr_sp_arm64, lldb_private::gpr_x0_arm64, integer, LLDB_INVALID_ADDRESS, LSL(), MemOp_LOAD, MemOp_NOP, MemOp_STORE, lldb_private::EmulateInstruction::ReadMemory(), lldb_private::EmulateInstruction::ReadRegister(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), lldb_private::EmulateInstruction::Context::SetAddress(), lldb_private::RegisterValue::SetFromMemoryData(), lldb_private::EmulateInstruction::Context::SetImmediateSigned(), lldb_private::EmulateInstruction::Context::SetRegisterToRegisterPlusOffset(), lldb_private::RegisterValue::SignExtend(), lldb_private::EmulateInstruction::Context::type, UInt, Unpredictable_LDPOVERLAP, Unpredictable_WBOVERLAP, lldb_private::EmulateInstruction::WriteMemory(), lldb_private::EmulateInstruction::WriteRegister(), and lldb_private::EmulateInstruction::WriteRegisterUnsigned().

◆ EmulateLDRSTRImm()

bool EmulateInstructionARM64::EmulateLDRSTRImm ( const uint32_t  opcode)
protected

◆ EmulateTBZ()

bool EmulateInstructionARM64::EmulateTBZ ( const uint32_t  opcode)
protected

◆ EvaluateInstruction()

bool EmulateInstructionARM64::EvaluateInstruction ( uint32_t  evaluate_options)
overridevirtual

◆ GetFramePointerRegisterNumber()

uint32_t EmulateInstructionARM64::GetFramePointerRegisterNumber ( ) const
protected

◆ GetOpcodeForInstruction()

EmulateInstructionARM64::Opcode * EmulateInstructionARM64::GetOpcodeForInstruction ( const uint32_t  opcode)
staticprotected

◆ GetPluginDescriptionStatic()

llvm::StringRef EmulateInstructionARM64::GetPluginDescriptionStatic ( )
static

Definition at line 120 of file EmulateInstructionARM64.cpp.

Referenced by Initialize().

◆ GetPluginName()

llvm::StringRef EmulateInstructionARM64::GetPluginName ( )
inlineoverridevirtual

Implements lldb_private::PluginInterface.

Definition at line 50 of file EmulateInstructionARM64.h.

References GetPluginNameStatic().

◆ GetPluginNameStatic()

static llvm::StringRef EmulateInstructionARM64::GetPluginNameStatic ( )
inlinestatic

Definition at line 28 of file EmulateInstructionARM64.h.

Referenced by GetPluginName(), and Initialize().

◆ GetRegisterInfo()

std::optional< RegisterInfo > EmulateInstructionARM64::GetRegisterInfo ( lldb::RegisterKind  reg_kind,
uint32_t  reg_num 
)
overridevirtual

◆ Initialize()

void EmulateInstructionARM64::Initialize ( )
static

◆ ReadInstruction()

bool EmulateInstructionARM64::ReadInstruction ( )
overridevirtual

◆ SetTargetTriple()

bool EmulateInstructionARM64::SetTargetTriple ( const lldb_private::ArchSpec arch)
overridevirtual

◆ SupportsEmulatingInstructionsOfType()

bool EmulateInstructionARM64::SupportsEmulatingInstructionsOfType ( lldb_private::InstructionType  inst_type)
inlineoverridevirtual

◆ SupportsEmulatingInstructionsOfTypeStatic()

static bool EmulateInstructionARM64::SupportsEmulatingInstructionsOfTypeStatic ( lldb_private::InstructionType  inst_type)
inlinestatic

◆ Terminate()

void EmulateInstructionARM64::Terminate ( )
static

◆ TestEmulation()

bool EmulateInstructionARM64::TestEmulation ( lldb_private::Stream out_stream,
lldb_private::ArchSpec arch,
lldb_private::OptionValueDictionary test_data 
)
inlineoverridevirtual

Implements lldb_private::EmulateInstruction.

Definition at line 63 of file EmulateInstructionARM64.h.

◆ UsingAArch32()

bool EmulateInstructionARM64::UsingAArch32 ( )
protected

Definition at line 466 of file EmulateInstructionARM64.cpp.

References m_opcode_pstate, and EmulateInstructionARM64::ProcState::RW.

Referenced by BranchTo().

Member Data Documentation

◆ m_emulated_pstate

ProcState EmulateInstructionARM64::m_emulated_pstate
protected

Definition at line 190 of file EmulateInstructionARM64.h.

Referenced by EmulateADDSUBImm().

◆ m_ignore_conditions

bool EmulateInstructionARM64::m_ignore_conditions
protected

◆ m_opcode_pstate

ProcState EmulateInstructionARM64::m_opcode_pstate
protected

Definition at line 189 of file EmulateInstructionARM64.h.

Referenced by ConditionHolds(), and UsingAArch32().


The documentation for this class was generated from the following files: