ROSE  0.9.11.10
TraceSemantics2.h
1 #ifndef Rose_TraceSemantics2_H
2 #define Rose_TraceSemantics2_H
3 
4 #include "BaseSemantics2.h"
5 #include "Diagnostics.h"
6 
7 namespace Rose {
8 namespace BinaryAnalysis { // documented elsewhere
9 namespace InstructionSemantics2 { // documented elsewhere
10 
50 namespace TraceSemantics {
51 
52 
54 // Semantic values
56 
57 typedef void SValue;
58 
60 typedef boost::shared_ptr<void> SValuePtr;
61 
62 
64 // Register state
66 
67 typedef void RegisterState;
68 
70 typedef boost::shared_ptr<void> RegisterStatePtr;
71 
72 
74 // Memory state
76 
77 typedef void MemoryState;
78 
80 typedef boost::shared_ptr<void> MemoryStatePtr;
81 
82 
84 // RISC operators
86 
88 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
89 
92  BaseSemantics::RiscOperatorsPtr subdomain_; // Domain to which all our RISC operators chain
93  Sawyer::Message::Stream stream_; // stream to which output is emitted
94  std::string indentation_; // string to print at start of each line
95  bool showingSubdomain_; // show subdomain name and address on each line of output?
96  bool showingInstructionVa_; // show instruction VA on each line of output?
97 
99  // Real constructors.
100 protected:
101  // use the version that takes a subdomain instead of this c'tor
103  : BaseSemantics::RiscOperators(protoval, solver), stream_(mlog[Diagnostics::INFO]), showingSubdomain_(true),
104  showingInstructionVa_(true) {
105  name("Trace");
106  }
107 
108  // use the version that takes a subdomain instead of this c'tor.
109  explicit RiscOperators(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr())
110  : BaseSemantics::RiscOperators(state, solver), stream_(mlog[Diagnostics::INFO]), showingSubdomain_(true),
111  showingInstructionVa_(true) {
112  name("Trace");
113  }
114 
116  : BaseSemantics::RiscOperators(subdomain->currentState(), subdomain->solver()),
117  subdomain_(subdomain), stream_(mlog[Diagnostics::INFO]), showingSubdomain_(true),
118  showingInstructionVa_(true) {
119  name("Trace");
120  }
121 
122 public:
123  virtual ~RiscOperators() {
124  linePrefix();
125  stream_ <<"operators destroyed\n";
126  }
127 
129  // Static allocating constructors.
130 public:
134  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
135  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
136  }
137 
141  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
142  return RiscOperatorsPtr(new RiscOperators(state, solver));
143  }
144 
147  static RiscOperatorsPtr instance(const BaseSemantics::RiscOperatorsPtr &subdomain) {
148  ASSERT_not_null(subdomain);
149  RiscOperatorsPtr self = subdomain->currentState()!=NULL ?
150  RiscOperatorsPtr(new RiscOperators(subdomain->currentState(), subdomain->solver())) :
151  RiscOperatorsPtr(new RiscOperators(subdomain->protoval(), subdomain->solver()));
152  self->subdomain_ = subdomain;
153  return self;
154  }
155 
157  // Virtual constructors
158 public:
160  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
161  return instance(protoval, solver);
162  }
163 
165  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
166  return instance(state, solver);
167  }
168 
171  return instance(subdomain);
172  }
173 
175  // Dynamic pointer casts
176 public:
179  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
180  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
181  ASSERT_not_null(retval);
182  return retval;
183  }
184 
186  // Methods first defined at this level of the class hierarchy
187 public:
191  const BaseSemantics::RiscOperatorsPtr& subdomain() const { return subdomain_; }
192  void subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain) { subdomain_ = subdomain; }
198  void checkSubdomain() const {
199  if (subdomain_==NULL)
200  throw BaseSemantics::Exception("subdomain is not set; nothing to trace", NULL);
201  }
208  Sawyer::Message::Stream& stream() { return stream_; }
209  void stream(Sawyer::Message::Stream &s) { stream_ = s; }
217  const std::string& indentation() const { return indentation_; }
218  void indentation(const std::string &s) { indentation_ = s; }
226  bool showingSubdomain() const { return showingSubdomain_; }
227  void showingSubdomain(bool b) { showingSubdomain_ = b; }
235  bool showingInstructionVa() const { return showingInstructionVa_; }
236  void showingInstructionVa(bool b) { showingInstructionVa_ = b; }
239 protected:
240  void linePrefix();
241  std::string toString(const BaseSemantics::SValuePtr&);
242  std::string toString(SgAsmFloatType*);
243  void check_equal_widths(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
244  const BaseSemantics::SValuePtr &check_width(const BaseSemantics::SValuePtr &a, size_t nbits,
245  const std::string &what="result");
246  std::string register_name(RegisterDescriptor);
247 
248  void before(const std::string&);
249  void before(const std::string&, RegisterDescriptor);
250  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&);
251  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
252  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
253  size_t);
254  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
255  const BaseSemantics::SValuePtr&);
256  void before(const std::string&, SgAsmInstruction*, bool showAddress);
257  void before(const std::string&, size_t);
258  void before(const std::string&, size_t, uint64_t);
259  void before(const std::string&, const BaseSemantics::SValuePtr&);
260  void before(const std::string&, const BaseSemantics::SValuePtr&, size_t);
261  void before(const std::string&, const BaseSemantics::SValuePtr&, size_t, size_t);
262  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
263  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
264  const BaseSemantics::SValuePtr&);
265  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*);
266  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*, const BaseSemantics::SValuePtr&);
267  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*, SgAsmFloatType*);
268  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&, SgAsmFloatType*);
269 
270  void after();
273  void after(const BaseSemantics::Exception&);
274  void after_exception();
275 
277  // Methods we override from our super class
278 public:
279  virtual BaseSemantics::SValuePtr protoval() const ROSE_OVERRIDE;
280  virtual void solver(const SmtSolverPtr&) ROSE_OVERRIDE;
281  virtual SmtSolverPtr solver() const ROSE_OVERRIDE;
282  virtual BaseSemantics::StatePtr currentState() const ROSE_OVERRIDE;
283  virtual void currentState(const BaseSemantics::StatePtr&) ROSE_OVERRIDE;
284  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
285  virtual size_t nInsns() const ROSE_OVERRIDE;
286  virtual void nInsns(size_t n) ROSE_OVERRIDE;
287  virtual SgAsmInstruction* currentInstruction() const ROSE_OVERRIDE;
288  virtual void startInstruction(SgAsmInstruction*) ROSE_OVERRIDE;
289  virtual void finishInstruction(SgAsmInstruction*) ROSE_OVERRIDE;
290 
291  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) ROSE_OVERRIDE;
292  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) ROSE_OVERRIDE;
293  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) ROSE_OVERRIDE;
294  virtual BaseSemantics::SValuePtr boolean_(bool value) ROSE_OVERRIDE;
295  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) ROSE_OVERRIDE;
296 
297  virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
298  virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
299  virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
300  virtual void hlt() ROSE_OVERRIDE;
301  virtual void cpuid() ROSE_OVERRIDE;
302  virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE;
303 
304  // The actual RISC operators. These are pure virtual in the base class
305  virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
306  virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
307  virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
308  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
309  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr&, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
310  virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
311  virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
312  virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
313  virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
314  virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
315  virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
316  virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
317  virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr&,
318  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
319  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
320  virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
321  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
322  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr&, size_t nbits) ROSE_OVERRIDE;
323  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr&, size_t nbits) ROSE_OVERRIDE;
324  virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
325  virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
326  const BaseSemantics::SValuePtr&,
327  BaseSemantics::SValuePtr&/*out*/) ROSE_OVERRIDE;
328  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
329  virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
330  virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
331  virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr&,
332  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
333  virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr&,
334  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
335  virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr&,
336  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
337  virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr&,
338  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
339 
340  virtual void interrupt(int majr, int minr) ROSE_OVERRIDE;
341 
342  virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
343  virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*,
344  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
345  virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr&, SgAsmFloatType*, SgAsmFloatType*) ROSE_OVERRIDE;
346  virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
347  virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
348  virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
349  virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
350  virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
351  virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
352  virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
353  SgAsmFloatType*) ROSE_OVERRIDE;
354  virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
355  SgAsmFloatType*) ROSE_OVERRIDE;
356  virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
357  SgAsmFloatType*) ROSE_OVERRIDE;
358  virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
359  SgAsmFloatType*) ROSE_OVERRIDE;
360  virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
361  virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
362 
363  virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor,
364  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
365  virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor,
366  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
367  virtual void writeRegister(RegisterDescriptor, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
368  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
369  const BaseSemantics::SValuePtr &dflt,
370  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
371  virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
372  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
373  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
374  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
375 };
376 
377 } // namespace
378 } // namespace
379 } // namespace
380 } // namespace
381 
382 #endif
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Multiply two floating-point values.
virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Subtract one floating-point value from another.
boost::shared_ptr< void > RegisterStatePtr
Shared-ownership pointer to trace-semantics register state.
virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Obtain a register value without side effects.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Rotate bits to the right.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::RiscOperatorsPtr &subdomain)
Wraps a subdomain's RISC operators to add tracing.
virtual SmtSolverPtr solver() const ROSE_OVERRIDE
Property: Satisfiability module theory (SMT) solver.
virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Divide one floating-point value by another.
virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE
Invoked for the x86 RDTSC instruction.
virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Sign of floating-point value.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Divides two signed values.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Rotate bits to the left.
virtual SgAsmInstruction * currentInstruction() const ROSE_OVERRIDE
Returns current instruction.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual void startInstruction(SgAsmInstruction *) ROSE_OVERRIDE
Called at the beginning of every instruction.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise XOR of two values.
void subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain)
Property: Subdomain to which operations are forwarded.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &, size_t nbits) ROSE_OVERRIDE
Sign extends a value.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE
Extracts bits from a value.
Base class for machine instructions.
virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
If-then-else.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
One's complement.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Writes a value to memory.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns position of most significant set bit; zero when no bits are set.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Add two floating-point values.
STL namespace.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Calculates modulo with signed values.
virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Exponent of floating-point value.
virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is a special not-a-number bit pattern.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Concatenates the bits of two values.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to trace-semantics RISC operations.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Divides two unsigned values.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Two's complement.
void showingInstructionVa(bool b)
Property: Show instruction in output.
void showingSubdomain(bool b)
Property: Show subdomain name in output.
virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is infinity.
Main namespace for the ROSE library.
virtual BaseSemantics::SValuePtr boolean_(bool value) ROSE_OVERRIDE
Returns a Boolean value.
virtual void interrupt(int majr, int minr) ROSE_OVERRIDE
Invoked for instructions that cause an interrupt.
virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Construct an integer value from a floating-point value.
virtual void cpuid() ROSE_OVERRIDE
Invoked for the x86 CPUID instruction.
boost::shared_ptr< void > MemoryStatePtr
Shared-ownership pointer to trace-semantics memory state.
bool showingSubdomain() const
Property: Show subdomain name in output.
void stream(Sawyer::Message::Stream &s)
Property: output stream to which tracing is emitted.
Sawyer::SharedPointer< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise AND of two values.
virtual BaseSemantics::SValuePtr protoval() const ROSE_OVERRIDE
Property: Prototypical semantic value.
Sawyer::Message::Stream & stream()
Property: output stream to which tracing is emitted.
boost::shared_ptr< class State > StatePtr
Shared-ownership pointer to a semantic state.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) ROSE_OVERRIDE
Returns a number of the specified bit width.
Base classes for instruction semantics.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Multiplies two signed values.
virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Square root.
Describes (part of) a physical CPU register.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to trace operators.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) ROSE_OVERRIDE
Returns a new undefined value.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted right arithmetically (with sign bit).
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted right logically (no sign bit).
Sawyer::Message::Facility mlog
Diagnostics logging facility for instruction semantics.
virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter call targets.
void indentation(const std::string &s)
Property: Line prefix string.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print multi-line output for this object.
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Add two values of equal size and a carry bit.
virtual void writeRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Writes a value to a register.
Base class for most instruction semantics RISC operators.
virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr &, SgAsmFloatType *, SgAsmFloatType *) ROSE_OVERRIDE
Convert from one floating-point type to another.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted left.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object.
virtual void finishInstruction(SgAsmInstruction *) ROSE_OVERRIDE
Called at the end of every instruction.
virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter indirect jumps.
virtual BaseSemantics::StatePtr currentState() const ROSE_OVERRIDE
Property: Current semantic state.
const std::string & indentation() const
Property: Line prefix string.
virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter return targets.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) ROSE_OVERRIDE
Returns a data-flow bottom value.
virtual size_t nInsns() const ROSE_OVERRIDE
Property: Number of instructions processed.
virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is equal to zero.
const BaseSemantics::RiscOperatorsPtr & subdomain() const
Property: Subdomain to which operations are forwarded.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Calculates modulo with unsigned values.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Adds two integers of equal size.
virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Reads a value from memory.
Converts text to messages.
Definition: Message.h:1394
virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &, size_t nbits) ROSE_OVERRIDE
Extend (or shrink) operand a so it is nbits wide by adding or removing high-order bits...
virtual const std::string & name() const
Property: Name used for debugging.
virtual void hlt() ROSE_OVERRIDE
Invoked for the x86 HLT instruction.
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Round toward zero.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Read memory without side effects.
Base class for exceptions thrown by instruction semantics.
void checkSubdomain() const
Check that we have a valid subdomain.
boost::shared_ptr< void > SValuePtr
Shared-ownership pointer to trace-semantics values.
static RiscOperatorsPtr instance(const BaseSemantics::RiscOperatorsPtr &subdomain)
Instantiate a new RiscOperators object.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise OR of two values.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Determines whether a value is equal to zero.
Floating point types.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Construct a floating-point value from an integer value.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Multiply two unsigned values.
bool showingInstructionVa() const
Property: Show instruction in output.
virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is denormalized.
virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Reads a value from a register.
virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns position of least significant set bit; zero when no bits are set.