1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics2_DispatcherAarch64_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics2_DispatcherAarch64_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_ASM_AARCH64
6 #include <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics.h>
8 #include <boost/serialization/access.hpp>
9 #include <boost/serialization/base_object.hpp>
10 #include <boost/serialization/export.hpp>
11 #include <boost/serialization/split_member.hpp>
14 namespace BinaryAnalysis {
15 namespace InstructionSemantics2 {
18 using DispatcherAarch64Ptr = boost::shared_ptr<class DispatcherAarch64>;
26 using Ptr = DispatcherAarch64Ptr;
35 RegisterDescriptor REG_PC, REG_SP, REG_LR;
36 RegisterDescriptor REG_CPSR_N, REG_CPSR_Z, REG_CPSR_C, REG_CPSR_V;
39 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
41 friend class boost::serialization::access;
44 void save(S &s,
const unsigned )
const {
45 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
49 void load(S &s,
const unsigned ) {
50 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
51 initializeRegisterDescriptors();
52 initializeInsnDispatchTable();
56 BOOST_SERIALIZATION_SPLIT_MEMBER();
62 :
BaseSemantics::Dispatcher(64, RegisterDictionary::dictionary_aarch64()) {}
65 :
BaseSemantics::Dispatcher(ops, 64, regs ? regs : RegisterDictionary::dictionary_aarch64()) {
66 initializeRegisterDescriptors();
67 initializeInsnDispatchTable();
69 initializeState(ops->currentState());
76 static DispatcherAarch64Ptr instance() {
77 return DispatcherAarch64Ptr(
new DispatcherAarch64);
82 return DispatcherAarch64Ptr(
new DispatcherAarch64(ops, regs));
87 const RegisterDictionary *regs =
nullptr)
const override {
88 ASSERT_require(0 == addrWidth || 64 == addrWidth);
89 return instance(ops, regs);
94 DispatcherAarch64Ptr retval = boost::dynamic_pointer_cast<DispatcherAarch64>(d);
95 ASSERT_not_null(retval);
101 void initializeRegisterDescriptors();
106 void initializeInsnDispatchTable();
109 void initializeMemory();
128 : n(n), z(z), c(c), v(v) {}
141 std::pair<uint64_t, uint64_t> decodeBitMasks(
size_t m,
bool immN, uint64_t imms, uint64_t immr,
bool immediate);
145 uint64_t immR, uint64_t immS);
149 uint64_t immR, uint64_t immS);
153 uint64_t immR, uint64_t immS);
157 RegisterDescriptor instructionPointerRegister()
const override;
158 RegisterDescriptor stackPointerRegister()
const override;
159 RegisterDescriptor stackFrameRegister()
const override;
160 RegisterDescriptor callReturnRegister()
const override;
161 void set_register_dictionary(
const RegisterDictionary*)
override;
168 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
169 BOOST_CLASS_EXPORT_KEY(Rose::BinaryAnalysis::InstructionSemantics2::DispatcherAarch64);
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
Sawyer::SharedPointer< Node > Ptr
Shared-ownership pointer to an expression Node.
Sum< T >::Ptr sum()
Factory for value agumenter.
Base class for machine instructions.
Main namespace for the ROSE library.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
Base classes for instruction semantics.
ROSE_DLL_API void load(SgProject *project, std::list< std::string > const &filepaths)
Load ASTs that have been saved to files.
Base class for most instruction semantics RISC operators.
Base class for expressions.
Dispatches instructions through the RISC layer.
Base class for binary types.