ROSE  0.11.101.0
DispatcherM68k.h
1 #ifndef ROSE_BinaryAnalysis_InstructionSemantics_DispatcherM68k_H
2 #define ROSE_BinaryAnalysis_InstructionSemantics_DispatcherM68k_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/BasicTypes.h>
7 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
8 
9 #include <boost/serialization/access.hpp>
10 #include <boost/serialization/base_object.hpp>
11 #include <boost/serialization/export.hpp>
12 #include <boost/serialization/split_member.hpp>
13 
14 namespace Rose {
15 namespace BinaryAnalysis {
16 namespace InstructionSemantics {
17 
19 typedef boost::shared_ptr<class DispatcherM68k> DispatcherM68kPtr;
20 
22 public:
25 
28 
29 public:
39  // Floating-point condition code bits
41  // Floating-point status register exception bits
44  // Floating-point status register accrued exception bits
48 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
49 private:
50  friend class boost::serialization::access;
51 
52  template<class S>
53  void save(S &s, const unsigned /*version*/) const {
54  s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
55  };
56 
57  template<class S>
58  void load(S &s, const unsigned /*version*/) {
59  s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
60  regcache_init();
61  iproc_init();
62  memory_init();
63  }
64 
65  BOOST_SERIALIZATION_SPLIT_MEMBER();
66 #endif
67 
68 protected:
69  // prototypical constructor
70  DispatcherM68k();
71 
72  DispatcherM68k(const BaseSemantics::RiscOperatorsPtr&, size_t addrWidth, const RegisterDictionaryPtr&);
73 
75  void iproc_init();
76 
80  void regcache_init();
81 
83  void memory_init();
84 
85 public:
86  ~DispatcherM68k();
87 
90  static DispatcherM68kPtr instance();
91 
93  static DispatcherM68kPtr instance(const BaseSemantics::RiscOperatorsPtr&, size_t addrWidth, const RegisterDictionaryPtr&);
94 
97  const RegisterDictionaryPtr&) const override;
98 
100  static DispatcherM68kPtr promote(const BaseSemantics::DispatcherPtr&);
101 
102  virtual void set_register_dictionary(const RegisterDictionaryPtr &regdict) override;
103 
104  virtual RegisterDescriptor instructionPointerRegister() const override;
105  virtual RegisterDescriptor stackPointerRegister() const override;
106  virtual RegisterDescriptor stackFrameRegister() const override;
107  virtual RegisterDescriptor callReturnRegister() const override;
108 
109  virtual int iprocKey(SgAsmInstruction *insn_) const override {
110  SgAsmM68kInstruction *insn = isSgAsmM68kInstruction(insn_);
111  ASSERT_not_null(insn);
112  return insn->get_kind();
113  }
114 
115  virtual BaseSemantics::SValuePtr read(SgAsmExpression*, size_t value_nbits, size_t addr_nbits=0) override;
116 
119  const BaseSemantics::SValuePtr &b, SgAsmType *bType);
120 
123  const BaseSemantics::SValuePtr &b, SgAsmType *bType);
124 
130  void updateFpsrExcOvfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType,
131  SgAsmType *rounding, SgAsmType *dstType);
132 
140  void updateFpsrExcUnfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType,
141  SgAsmType *rounding, SgAsmType *dstType);
142 
144  void updateFpsrExcInex();
145 
148 
150  void accumulateFpExceptions();
151 
154 };
155 
156 } // namespace
157 } // namespace
158 } // namespace
159 
160 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
162 #endif
163 
164 #endif
165 #endif
DispatcherM68kPtr Ptr
Shared-ownership pointer.
virtual RegisterDescriptor stackFrameRegister() const override
Returns the stack call frame register.
virtual RegisterDescriptor callReturnRegister() const override
Returns the function call return address register.
RegisterDescriptor REG_FP[8]
Cached register.
virtual int iprocKey(SgAsmInstruction *insn_) const override
Given an instruction, return the InsnProcessor key that can be used as an index into the iproc_table...
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
Base class for machine instructions.
void updateFpsrExcInex()
Set or clear FPSR EXC INEX bit.
void updateFpsrExcOvfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType, SgAsmType *rounding, SgAsmType *dstType)
Set or clear FPSR EXC OVFL bit.
void updateFpsrExcUnfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType, SgAsmType *rounding, SgAsmType *dstType)
Set or clear FPSR EXC UVFL bit.
RegisterDescriptor REG_A[8]
Cached register.
virtual RegisterDescriptor stackPointerRegister() const override
Returns the stack pointer register.
virtual BaseSemantics::DispatcherPtr create(const BaseSemantics::RiscOperatorsPtr &, size_t addrWidth, const RegisterDictionaryPtr &) const override
Virtual constructor.
void iproc_init()
Loads the iproc table with instruction processing functors.
Main namespace for the ROSE library.
virtual RegisterDescriptor instructionPointerRegister() const override
Returns the instruction pointer register.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
BaseSemantics::SValuePtr condition(M68kInstructionKind, BaseSemantics::RiscOperators *)
Determines if an instruction should branch.
Dispatches instructions through the RISC layer.
Definition: Dispatcher.h:44
static DispatcherM68kPtr promote(const BaseSemantics::DispatcherPtr &)
Dynamic cast to DispatcherM68kPtr with assertion.
void regcache_init()
Load the cached register descriptors.
void updateFpsrExcInan(const BaseSemantics::SValuePtr &a, SgAsmType *aType, const BaseSemantics::SValuePtr &b, SgAsmType *bType)
Set or clear FPSR EXC INAN bit.
void adjustFpConditionCodes(const BaseSemantics::SValuePtr &result, SgAsmFloatType *)
Set floating point condition codes according to result.
Describes (part of) a physical CPU register.
virtual BaseSemantics::SValuePtr read(SgAsmExpression *, size_t value_nbits, size_t addr_nbits=0) override
Reads an R-value expression.
static DispatcherM68kPtr instance()
Construct a prototypical dispatcher.
Base class for expressions.
void updateFpsrExcIde(const BaseSemantics::SValuePtr &a, SgAsmType *aType, const BaseSemantics::SValuePtr &b, SgAsmType *bType)
Set or clear FPSR EXC IDE bit.
Binary analysis.
boost::shared_ptr< class DispatcherM68k > DispatcherM68kPtr
Shared-ownership pointer to an M68k instruction dispatcher.
Rose::BinaryAnalysis::M68kInstructionKind get_kind() const
Property: Instruction kind.
Base class for binary types.
RegisterDescriptor REG_D[8]
Cached register.
Base class for most instruction semantics RISC operators.
Definition: RiscOperators.h:48
void memory_init()
Make sure memory is set up correctly.
void accumulateFpExceptions()
Update accrued floating-point exceptions.
RegisterDictionaryPtr regdict
See registerDictionary property.
Definition: Dispatcher.h:53
Floating point types.