ROSE 0.11.145.247
DispatcherPowerpc.h
1// Semantics for 32-bit Motorola-IBM PowerPC microprocessors using ROSE instruction semantics API2
2// This code was derived from $ROSE/projects/assemblyToSourceAst/powerpcInstructionSemantics.h,
3// which is mostly a copy of $ROSE/projects/SemanticSignatureVectors/powerpcInstructionSemantics.h
4//
5// The ROSE style guide indicates that PowerPC, when used as part of a symbol in ROSE source code,
6// should be capitalized as "Powerpc" (e.g., "DispatcherPowerpc", the same rule that consistently
7// capitializes x86 as "DispatcherX86").
8#ifndef ROSE_BinaryAnalysis_InstructionSemantics_DispatcherPowerpc_H
9#define ROSE_BinaryAnalysis_InstructionSemantics_DispatcherPowerpc_H
10#include <featureTests.h>
11#ifdef ROSE_ENABLE_BINARY_ANALYSIS
12
13#include <Rose/BinaryAnalysis/BasicTypes.h>
14#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
15
16#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
17#include <boost/serialization/access.hpp>
18#include <boost/serialization/base_object.hpp>
19#include <boost/serialization/export.hpp>
20#include <boost/serialization/split_member.hpp>
21#endif
22
23namespace Rose {
24namespace BinaryAnalysis {
25namespace InstructionSemantics {
26
28typedef boost::shared_ptr<class DispatcherPowerpc> DispatcherPowerpcPtr;
29
31public:
34
37
48#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
49private:
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
68private:
69 DispatcherPowerpc(); // used only by boost::serialization
70
71protected:
72 DispatcherPowerpc(const Architecture::BaseConstPtr&); // Prototypical constructor
73
74 DispatcherPowerpc(const Architecture::BaseConstPtr&, const BaseSemantics::RiscOperatorsPtr&);
75
76public:
77 ~DispatcherPowerpc();
78
79private:
83 void iproc_init();
84
88 void regcache_init();
89
93 void memory_init();
94
95public:
100
103
106
109
111 virtual RegisterDescriptor callReturnRegister() const override;
112
113 virtual int iprocKey(SgAsmInstruction *insn_) const override;
114
119 void setXerOverflow(const BaseSemantics::SValuePtr &hadOverflow);
120
122 virtual void updateCr0(const BaseSemantics::SValuePtr &result);
123
127
132};
133
134} // namespace
135} // namespace
136} // namespace
137
138#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
140#endif
141
142#endif
143#endif
Dispatches instructions through the RISC layer.
Definition Dispatcher.h:46
Base class for most instruction semantics RISC operators.
static DispatcherPowerpcPtr instance(const Architecture::BaseConstPtr &, const BaseSemantics::RiscOperatorsPtr &)
Constructor.
void setXerOverflow(const BaseSemantics::SValuePtr &hadOverflow)
Set the XER OV and SO bits as specified.
void writeAndUpdate(BaseSemantics::RiscOperators *, SgAsmExpression *destination, const BaseSemantics::SValuePtr &value)
Writes a value to a memory address and updates a register with the effective address to which the val...
virtual RegisterDescriptor instructionPointerRegister() const override
Returns the instruction pointer register.
virtual void updateCr0(const BaseSemantics::SValuePtr &result)
Write status flags for result.
virtual RegisterDescriptor callReturnRegister() const override
Returns the function call return address register.
DispatcherPowerpcPtr Ptr
Shared-ownership pointer.
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.
static DispatcherPowerpcPtr promote(const BaseSemantics::DispatcherPtr &)
Dynamic cast to a DispatcherPowerpcPtr with assertion.
BaseSemantics::SValuePtr readAndUpdate(BaseSemantics::RiscOperators *, SgAsmExpression *, size_t valueNBits)
Reads from a memory address and updates a register with the effective address that was read.
static DispatcherPowerpcPtr instance(const Architecture::BaseConstPtr &)
Construct a prototypical dispatcher.
virtual BaseSemantics::DispatcherPtr create(const BaseSemantics::RiscOperatorsPtr &) const override
Virtual constructor.
Describes (part of) a physical CPU register.
Base class for expressions.
Base class for machine instructions.
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 DispatcherPowerpc > DispatcherPowerpcPtr
Shared-ownership pointer to a PowerPC instruction dispatcher.
The ROSE library.