ROSE 0.11.145.192
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/InstructionEnumsM68k.h>
8#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
9
10#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
11#include <boost/serialization/access.hpp>
12#include <boost/serialization/base_object.hpp>
13#include <boost/serialization/export.hpp>
14#include <boost/serialization/nvp.hpp>
15#include <boost/serialization/split_member.hpp>
16#endif
17
18namespace Rose {
19namespace BinaryAnalysis {
20namespace InstructionSemantics {
21
23typedef boost::shared_ptr<class DispatcherM68k> DispatcherM68kPtr;
24
29public:
32
35
36public:
46 // Floating-point condition code bits
48 // Floating-point status register exception bits
51 // Floating-point status register accrued exception bits
55#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
56private:
57 friend class boost::serialization::access;
58
59 template<class S>
60 void save(S &s, const unsigned /*version*/) const {
61 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
62 };
63
64 template<class S>
65 void load(S &s, const unsigned /*version*/) {
66 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
68 iproc_init();
70 }
71
72 BOOST_SERIALIZATION_SPLIT_MEMBER();
73#endif
74
75private:
76 DispatcherM68k(); // used only by boost::serialization
77
78protected:
79 explicit DispatcherM68k(const Architecture::BaseConstPtr&); // prototypical constructor
80
82
86 void iproc_init();
87
92
97
98public:
100
105
108
111
114
116 virtual RegisterDescriptor stackPointerRegister() const override;
117 virtual int iprocKey(SgAsmInstruction *insn_) const override;
118 virtual BaseSemantics::SValuePtr read(SgAsmExpression*, size_t value_nbits, size_t addr_nbits=0) override;
119
122 const BaseSemantics::SValuePtr &b, SgAsmType *bType);
123
126 const BaseSemantics::SValuePtr &b, SgAsmType *bType);
127
133 void updateFpsrExcOvfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType,
134 SgAsmType *rounding, SgAsmType *dstType);
135
143 void updateFpsrExcUnfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType,
144 SgAsmType *rounding, SgAsmType *dstType);
145
148
151
154
157};
158
159} // namespace
160} // namespace
161} // namespace
162
163#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
165#endif
166
167#endif
168#endif
Dispatches instructions through the RISC layer.
Definition Dispatcher.h:43
Base class for most instruction semantics RISC operators.
Dispatches Motorola 68k instructions through the semantics layer.
void iproc_init()
Loads the iproc table with instruction processing functors.
void adjustFpConditionCodes(const BaseSemantics::SValuePtr &result, SgAsmFloatType *)
Set floating point condition codes according to result.
void updateFpsrExcInex()
Set or clear FPSR EXC INEX bit.
void updateFpsrExcIde(const BaseSemantics::SValuePtr &a, SgAsmType *aType, const BaseSemantics::SValuePtr &b, SgAsmType *bType)
Set or clear FPSR EXC IDE bit.
virtual RegisterDescriptor stackPointerRegister() const override
Returns the stack pointer register.
static DispatcherM68kPtr promote(const BaseSemantics::DispatcherPtr &)
Dynamic cast to DispatcherM68kPtr with assertion.
virtual RegisterDescriptor instructionPointerRegister() const override
Returns the instruction pointer register.
void updateFpsrExcOvfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType, SgAsmType *rounding, SgAsmType *dstType)
Set or clear FPSR EXC OVFL bit.
static DispatcherM68kPtr instance(const Architecture::BaseConstPtr &, const BaseSemantics::RiscOperatorsPtr &)
Constructor.
virtual BaseSemantics::SValuePtr read(SgAsmExpression *, size_t value_nbits, size_t addr_nbits=0) override
Reads an R-value expression.
static DispatcherM68kPtr instance(const Architecture::BaseConstPtr &)
Construct a prototypical dispatcher.
DispatcherM68kPtr Ptr
Shared-ownership pointer.
void memory_init()
Make sure memory is set up correctly.
void updateFpsrExcInan(const BaseSemantics::SValuePtr &a, SgAsmType *aType, const BaseSemantics::SValuePtr &b, SgAsmType *bType)
Set or clear FPSR EXC INAN bit.
void accumulateFpExceptions()
Update accrued floating-point exceptions.
void updateFpsrExcUnfl(const BaseSemantics::SValuePtr &intermediate, SgAsmType *valueType, SgAsmType *rounding, SgAsmType *dstType)
Set or clear FPSR EXC UVFL bit.
virtual BaseSemantics::DispatcherPtr create(const BaseSemantics::RiscOperatorsPtr &) const override
Virtual constructor.
BaseSemantics::SValuePtr condition(M68kInstructionKind, BaseSemantics::RiscOperators *)
Determines if an instruction should branch.
void regcache_init()
Load the cached register descriptors.
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.
Describes (part of) a physical CPU register.
Base class for expressions.
Floating point types.
Base class for machine instructions.
Base class for binary types.
std::shared_ptr< const Base > BaseConstPtr
Reference counted pointer for Architecture::Base.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
boost::shared_ptr< class DispatcherM68k > DispatcherM68kPtr
Shared-ownership pointer to an M68k instruction dispatcher.
The ROSE library.