8#ifndef TRITON_CPUINTERFACE_HPP
9#define TRITON_CPUINTERFACE_HPP
13#include <unordered_map>
48 TRITON_EXPORT
virtual void clear(
void) = 0;
63 TRITON_EXPORT
virtual bool isThumb(
void)
const = 0;
66 TRITON_EXPORT
virtual void setThumb(
bool state) = 0;
84 TRITON_EXPORT
virtual std::set<const triton::arch::Register*>
getParentRegisters(
void)
const = 0;
87 TRITON_EXPORT
virtual const std::unordered_map<triton::arch::register_e, const triton::arch::Register>&
getAllRegisters(
void)
const = 0;
90 TRITON_EXPORT
virtual const std::unordered_map<triton::uint64, triton::uint8, IdentityHash<triton::uint64>>&
getConcreteMemory(
void)
const = 0;
This interface is used as abstract CPU interface. All CPU must use this interface.
virtual TRITON_EXPORT triton::uint32 gprBitSize(void) const =0
Returns the bit in bit of the General Purpose Registers.
virtual TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const void *area, triton::usize size, bool execCallbacks=true)=0
[architecture api] - Sets the concrete value of a memory area.
virtual TRITON_EXPORT void clearConcreteMemoryValue(const triton::arch::MemoryAccess &mem)=0
Clears concrete values assigned to the memory cells.
virtual TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector< triton::uint8 > &values, bool execCallbacks=true)=0
[architecture api] - Sets the concrete value of a memory area.
virtual TRITON_EXPORT void setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value, bool execCallbacks=true)=0
[architecture api] - Sets the concrete value of a memory cell.
virtual TRITON_EXPORT void setThumb(bool state)=0
Sets CPU state to Thumb mode.
virtual TRITON_EXPORT triton::uint512 getConcreteMemoryValue(const triton::arch::MemoryAccess &mem, bool execCallbacks=true) const =0
Returns the concrete value of memory cells.
virtual TRITON_EXPORT const triton::arch::Register & getParentRegister(const triton::arch::Register ®) const =0
Returns parent register from a given one.
virtual TRITON_EXPORT bool isRegisterValid(triton::arch::register_e regId) const =0
Returns true if the register ID is valid.
virtual TRITON_EXPORT const triton::arch::Register & getProgramCounter(void) const =0
Returns the program counter register.
virtual TRITON_EXPORT void setConcreteMemoryValue(const triton::arch::MemoryAccess &mem, const triton::uint512 &value, bool execCallbacks=true)=0
[architecture api] - Sets the concrete value of memory cells.
virtual TRITON_EXPORT void setConcreteRegisterValue(const triton::arch::Register ®, const triton::uint512 &value, bool execCallbacks=true)=0
[architecture api] - Sets the concrete value of a register.
virtual TRITON_EXPORT const triton::arch::Register & getRegister(triton::arch::register_e id) const =0
Returns register from id.
virtual TRITON_EXPORT bool isConcreteMemoryValueDefined(triton::uint64 baseAddr, triton::usize size=1) const =0
Returns true if memory cells have a defined concrete value.
virtual TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters(void) const =0
Returns all parent registers.
virtual TRITON_EXPORT bool isFlag(triton::arch::register_e regId) const =0
Returns true if the register ID is a flag.
virtual TRITON_EXPORT void clear(void)=0
Clears the architecture states (registers and memory).
virtual TRITON_EXPORT bool isConcreteMemoryValueDefined(const triton::arch::MemoryAccess &mem) const =0
Returns true if memory cells have a defined concrete value.
virtual TRITON_EXPORT triton::uint32 gprSize(void) const =0
Returns the bit in byte of the General Purpose Registers.
virtual TRITON_EXPORT triton::arch::endianness_e getEndianness(void) const =0
Returns the kind of endianness as triton::arch::endianness_e.
virtual TRITON_EXPORT bool isMemoryExclusive(const triton::arch::MemoryAccess &mem) const =0
Returns true if the given memory access is tagged as exclusive. Only valid for Arm32 and AArch64.
virtual TRITON_EXPORT void clearConcreteMemoryValue(triton::uint64 baseAddr, triton::usize size=1)=0
Clears concrete values assigned to the memory cells.
virtual TRITON_EXPORT const std::unordered_map< triton::uint64, triton::uint8, IdentityHash< triton::uint64 > > & getConcreteMemory(void) const =0
Return all memory.
virtual TRITON_EXPORT ~CpuInterface()
Destructor.
virtual TRITON_EXPORT void setMemoryExclusiveTag(const triton::arch::MemoryAccess &mem, bool tag)=0
Sets exclusive memory access tag. Only valid for Arm32 and AArch64.
virtual TRITON_EXPORT void disassembly(triton::arch::Instruction &inst)=0
Disassembles the instruction according to the architecture.
virtual TRITON_EXPORT bool isThumb(void) const =0
Returns true if the execution mode is Thumb. Only useful for Arm32.
virtual TRITON_EXPORT bool isRegister(triton::arch::register_e regId) const =0
Returns true if the register ID is a register.
virtual TRITON_EXPORT const triton::arch::Register & getParentRegister(triton::arch::register_e id) const =0
Returns parent register from a given one.
virtual TRITON_EXPORT std::vector< triton::uint8 > getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks=true) const =0
Returns the concrete value of a memory area.
virtual TRITON_EXPORT const triton::arch::Register & getStackPointer(void) const =0
Returns the stack pointer register.
virtual TRITON_EXPORT triton::uint8 getConcreteMemoryValue(triton::uint64 addr, bool execCallbacks=true) const =0
Returns the concrete value of a memory cell.
virtual TRITON_EXPORT triton::uint32 numberOfRegisters(void) const =0
Returns the number of registers according to the CPU architecture.
virtual TRITON_EXPORT const triton::arch::Register & getRegister(const std::string &name) const =0
Returns register from name.
virtual TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register ®, bool execCallbacks=true) const =0
Returns the concrete value of a register.
virtual TRITON_EXPORT const std::unordered_map< triton::arch::register_e, const triton::arch::Register > & getAllRegisters(void) const =0
Returns all registers.
This class is used to represent an instruction.
This class is used to represent a memory access.
This class is used when an instruction has a register operand.
register_e
Types of register.
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
std::uint64_t uint64
unisgned 64-bits
std::uint32_t uint32
unisgned 32-bits
std::uint8_t uint8
unisgned 8-bits