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]
Collaboration diagram for EmulateInstructionARM64:
Collaboration 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)
 
lldb_private::ConstString GetPluginName () override
 
uint32_t GetPluginVersion () 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
 
bool GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num, lldb_private::RegisterInfo &reg_info) 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 InstructionCondition GetInstructionCondition ()
 
virtual bool GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterInfo &reg_info)=0
 
virtual bool SetInstruction (const Opcode &insn_opcode, const Address &inst_addr, Target *target)
 
bool ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value)
 
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
 
 PluginInterface (const PluginInterface &)=delete
 
PluginInterfaceoperator= (const PluginInterface &)=delete
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static lldb_private::ConstString GetPluginNameStatic ()
 
static const char * 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

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

Detailed Description

Definition at line 17 of file EmulateInstructionARM64.h.

Member Enumeration Documentation

◆ AccType

Enumerator
AccType_NORMAL 
AccType_UNPRIV 
AccType_STREAM 
AccType_ALIGNED 
AccType_ORDERED 

Definition at line 126 of file EmulateInstructionARM64.h.

◆ AddrMode

Enumerator
AddrMode_OFF 
AddrMode_PRE 
AddrMode_POST 

Definition at line 76 of file EmulateInstructionARM64.h.

◆ BitwiseOp

Enumerator
BitwiseOp_NOT 
BitwiseOp_RBIT 

Definition at line 90 of file EmulateInstructionARM64.h.

◆ BranchType

Enumerator
BranchType_CALL 
BranchType_ERET 
BranchType_DRET 
BranchType_RET 
BranchType_JMP 

Definition at line 78 of file EmulateInstructionARM64.h.

◆ ConstraintType

Enumerator
Constraint_NONE 
Constraint_UNKNOWN 
Constraint_SUPPRESSWB 
Constraint_NOP 

Definition at line 119 of file EmulateInstructionARM64.h.

◆ CountOp

Enumerator
CountOp_CLZ 
CountOp_CLS 
CountOp_CNT 

Definition at line 86 of file EmulateInstructionARM64.h.

◆ ExceptionLevel

Enumerator
EL0 
EL1 
EL2 
EL3 

Definition at line 92 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 94 of file EmulateInstructionARM64.h.

◆ ExtractType

Enumerator
ExtractType_LEFT 
ExtractType_RIGHT 

Definition at line 105 of file EmulateInstructionARM64.h.

◆ LogicalOp

Enumerator
LogicalOp_AND 
LogicalOp_EOR 
LogicalOp_ORR 

Definition at line 107 of file EmulateInstructionARM64.h.

◆ MemOp

Enumerator
MemOp_LOAD 
MemOp_STORE 
MemOp_PREFETCH 
MemOp_NOP 

Definition at line 109 of file EmulateInstructionARM64.h.

◆ MoveWideOp

Enumerator
MoveWideOp_N 
MoveWideOp_Z 
MoveWideOp_K 

Definition at line 111 of file EmulateInstructionARM64.h.

◆ RevOp

Enumerator
RevOp_RBIT 
RevOp_REV16 
RevOp_REV32 
RevOp_REV64 

Definition at line 88 of file EmulateInstructionARM64.h.

◆ ShiftType

Enumerator
ShiftType_LSL 
ShiftType_LSR 
ShiftType_ASR 
ShiftType_ROR 

Definition at line 113 of file EmulateInstructionARM64.h.

◆ StackPointerSelection

Enumerator
SP0 
SPx 

Definition at line 115 of file EmulateInstructionARM64.h.

◆ Unpredictable

Enumerator
Unpredictable_WBOVERLAP 
Unpredictable_LDPOVERLAP 

Definition at line 117 of file EmulateInstructionARM64.h.

Constructor & Destructor Documentation

◆ EmulateInstructionARM64()

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

Definition at line 19 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

Definition at line 529 of file EmulateInstructionARM64.cpp.

References lldb_private::UnsignedBits().

◆ 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()

template<EmulateInstructionARM64::AddrMode a_mode>
bool EmulateInstructionARM64::EmulateLDPSTP ( const uint32_t  opcode)
protected

◆ EmulateLDRSTRImm()

template<EmulateInstructionARM64::AddrMode a_mode>
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

Definition at line 467 of file EmulateInstructionARM64.cpp.

References lldb_private::gpr_fp_arm64, and LLDB_INVALID_REGNUM.

◆ GetOpcodeForInstruction()

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

◆ GetPluginDescriptionStatic()

const char * EmulateInstructionARM64::GetPluginDescriptionStatic ( )
static

Definition at line 130 of file EmulateInstructionARM64.cpp.

◆ GetPluginName()

lldb_private::ConstString EmulateInstructionARM64::GetPluginName ( )
overridevirtual

Implements lldb_private::PluginInterface.

Definition at line 125 of file EmulateInstructionARM64.cpp.

◆ GetPluginNameStatic()

ConstString EmulateInstructionARM64::GetPluginNameStatic ( )
static

Definition at line 120 of file EmulateInstructionARM64.cpp.

◆ GetPluginVersion()

uint32_t EmulateInstructionARM64::GetPluginVersion ( )
inlineoverridevirtual

Implements lldb_private::PluginInterface.

Definition at line 51 of file EmulateInstructionARM64.h.

◆ GetRegisterInfo()

bool EmulateInstructionARM64::GetRegisterInfo ( lldb::RegisterKind  reg_kind,
uint32_t  reg_num,
lldb_private::RegisterInfo &  reg_info 
)
override

◆ Initialize()

void EmulateInstructionARM64::Initialize ( )
static

Definition at line 111 of file EmulateInstructionARM64.cpp.

◆ 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

Definition at line 116 of file EmulateInstructionARM64.cpp.

◆ 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 64 of file EmulateInstructionARM64.h.

◆ UsingAArch32()

bool EmulateInstructionARM64::UsingAArch32 ( )
protected

Definition at line 474 of file EmulateInstructionARM64.cpp.

Member Data Documentation

◆ m_emulated_pstate

ProcState EmulateInstructionARM64::m_emulated_pstate
protected

Definition at line 191 of file EmulateInstructionARM64.h.

◆ m_ignore_conditions

bool EmulateInstructionARM64::m_ignore_conditions
protected

Definition at line 192 of file EmulateInstructionARM64.h.

◆ m_opcode_pstate

ProcState EmulateInstructionARM64::m_opcode_pstate
protected

Definition at line 190 of file EmulateInstructionARM64.h.


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