Arion 1.0.2-alpha
A high-performance C++ framework for emulating executable binaries.
 
Loading...
Searching...
No Matches
arion_arm::ArchManagerARM Class Reference

A class responsible for performing architecture specific operations in case of an ARM chip emulation. More...

#include <arch_arm.hpp>

Inheritance diagram for arion_arm::ArchManagerARM:
arion::ArchManager arion_lnx_arm::ArchManagerLinuxARM

Public Member Functions

 ArchManagerARM ()
 
ks_engine * curr_ks () override
 
csh * curr_cs () override
 
arion::ADDR dump_tls () override
 
void load_tls (arion::ADDR new_tls) override
 
void prerun_hook (arion::ADDR &start) override
 
- Public Member Functions inherited from arion::ArchManager
virtual ~ArchManager ()=default
 
std::shared_ptr< ARCH_ATTRIBUTESget_attrs ()
 
bool does_hook_intr ()
 
std::string get_name_by_syscall_no (uint64_t syscall_no)
 
bool has_syscall_with_name (std::string name)
 
uint64_t get_syscall_no_by_name (std::string name)
 
std::vector< REGget_context_regs ()
 
std::unique_ptr< std::map< REG, RVAL > > dump_regs ()
 
void load_regs (std::unique_ptr< std::map< REG, RVAL > > regs)
 
bool has_idt_entry (uint64_t intno)
 
CPU_INTR get_idt_entry (uint64_t intno)
 
std::unique_ptr< std::map< REG, RVAL > > init_thread_regs (ADDR pc, ADDR sp)
 
template<typename T >
read_reg (REG reg)
 
template<typename T >
read_reg (std::string reg_name)
 
uint64_t read_arch_reg (REG reg)
 
template<typename T >
void write_reg (REG reg, T val)
 
template<typename T >
void write_reg (std::string reg_name, T val)
 
void write_arch_reg (REG reg, uint64_t val)
 

Private Member Functions

bool is_thumb ()
 
void enable_vfp ()
 
void setup () override
 

Static Private Member Functions

static void int_hook (std::shared_ptr< arion::Arion > arion, uint32_t intno, void *user_data)
 

Additional Inherited Members

- Static Public Member Functions inherited from arion::ArchManager
static std::unique_ptr< ArchManagerinitialize (std::weak_ptr< Arion > arion, CPU_ARCH arch, PLATFORM platform=PLATFORM::UNKNOWN_PLATFORM)
 
static int get_signal_from_intr (CPU_INTR intr)
 
- Protected Member Functions inherited from arion::ArchManager
 ArchManager (std::shared_ptr< ARCH_ATTRIBUTES > attrs, std::map< std::string, REG > arch_regs, std::map< REG, uint8_t > arch_regs_sz, std::vector< REG > ctxt_regs, std::map< uint64_t, CPU_INTR > cpu_idt, bool hooks_intr)
 
- Protected Attributes inherited from arion::ArchManager
std::weak_ptr< Arionarion
 The Arion instanced associated to this instance.
 
uc_engine * uc
 The Unicorn engine associated with this instance.
 
std::vector< ks_engine * > ks
 The Keystone engine associated with this instance.
 
std::vector< csh * > cs
 The Capstone engine associated with this instance.
 
std::shared_ptr< ARCH_ATTRIBUTESattrs
 Multiple architecture specific attributes, grouped in a structure for genericity purpose.
 
std::map< std::string, REGarch_regs
 Unicorn registers by their name.
 
std::map< REG, uint8_t > arch_regs_sz
 Unicorn registers sizes.
 
std::vector< REGctxt_regs
 Unicorn registers making up the context to save and restore.
 
std::map< uint64_t, CPU_INTRcpu_idt
 Interrupt Descriptor Table for the CPU.
 
bool hooks_intr
 True if the ArchManager subclass uses hook_intr to intercept syscalls.
 

Detailed Description

A class responsible for performing architecture specific operations in case of an ARM chip emulation.

Constructor & Destructor Documentation

◆ ArchManagerARM()

arion_arm::ArchManagerARM::ArchManagerARM ( )
inline

Builder for ArchManagerARM instances.

Member Function Documentation

◆ curr_cs()

csh * arion_arm::ArchManagerARM::curr_cs ( )
overridevirtual

Retrieves a Capstone engine associated with this instance, based on the current mode of the ARM CPU (ARM or THUMB).

Returns
The Capstone engine.

Implements arion::ArchManager.

◆ curr_ks()

ks_engine * arion_arm::ArchManagerARM::curr_ks ( )
overridevirtual

Retrieves a Keystone engine associated with this instance, based on the current mode of the ARM CPU (ARM or THUMB).

Returns
The Keystone engine.

Implements arion::ArchManager.

◆ dump_tls()

arion::ADDR arion_arm::ArchManagerARM::dump_tls ( )
overridevirtual

Retrieves the current Thread Local Storage (TLS) address from the emulation context.

Returns
The TLS address.

Implements arion::ArchManager.

◆ enable_vfp()

void arion_arm::ArchManagerARM::enable_vfp ( )
private

Enables the Vector Floating Point (VFP) unit of the ARM emulated chip.

◆ int_hook()

static void arion_arm::ArchManagerARM::int_hook ( std::shared_ptr< arion::Arion arion,
uint32_t  intno,
void *  user_data 
)
staticprivate

Interrupt hook used to detect syscalls.

Parameters
[in]arionThe Arion instance responsible for the interrupt.
[in]intnoThe interrupt number.
[in]user_dataAdditional user data.

◆ is_thumb()

bool arion_arm::ArchManagerARM::is_thumb ( )
private

Checks whether the ARM CPU is in ARM or THUMB mode.

Returns
True if the ARM CPU is in THUMB mode.

◆ load_tls()

void arion_arm::ArchManagerARM::load_tls ( arion::ADDR  new_tls)
overridevirtual

Defines a Thread Local Storage (TLS) address to apply to the emulation.

Parameters
[in]new_tlsThe new TLS address.

Implements arion::ArchManager.

◆ prerun_hook()

void arion_arm::ArchManagerARM::prerun_hook ( arion::ADDR start)
overridevirtual

Performs ARM specific operations each time emulation starts.

Parameters
[in,out]startThe emulation start address.

Reimplemented from arion::ArchManager.

◆ setup()

void arion_arm::ArchManagerARM::setup ( )
overrideprivatevirtual

Prepares the ArchManagerARM for emulation.

Implements arion::ArchManager.


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