ROSE 0.11.145.147
RiscOperators.h
1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_RiscOperators_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_RiscOperators_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
7#include <Rose/BinaryAnalysis/InstructionSemantics/Utility.h>
8#include <Rose/BinaryAnalysis/HotPatch.h>
9#include <Rose/BinaryAnalysis/SmtSolver.h>
10#include <Combinatorics.h>
11
12#include <boost/enable_shared_from_this.hpp>
13#include <boost/serialization/access.hpp>
14#include <boost/serialization/export.hpp>
15#include <boost/serialization/nvp.hpp>
16#include <boost/serialization/shared_ptr.hpp>
17#include <boost/serialization/version.hpp>
18
19namespace Rose {
20namespace BinaryAnalysis {
21namespace InstructionSemantics {
22namespace BaseSemantics {
23
25// RISC Operators
27
49class RiscOperators: public boost::enable_shared_from_this<RiscOperators> {
50public:
53
54private:
55 SValuePtr protoval_; // Prototypical value used for its virtual constructors
56 StatePtr currentState_; // State upon which RISC operators operate
57 StatePtr initialState_; // Lazily updated initial state; see readMemory
58 SmtSolverPtr solver_; // Optional SMT solver
59 SgAsmInstruction *currentInsn_ = nullptr; // Current instruction, as set by latest startInstruction call
60 size_t nInsns_ = 0; // Number of instructions processed
61 std::string name_; // Name to use for debugging
62 HotPatch hotPatch_; // Adjustments to the semantic state after each instruction.
63 bool isNoopRead_ = false; // Read is part of a possible no-op read-then-write sequence
64
66 // Serialization
67#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
68private:
69 friend class boost::serialization::access;
70
71 template<class S>
72 void serialize(S &s, const unsigned version) {
73 s & BOOST_SERIALIZATION_NVP(protoval_);
74 s & BOOST_SERIALIZATION_NVP(currentState_);
75 s & BOOST_SERIALIZATION_NVP(initialState_);
76 s & BOOST_SERIALIZATION_NVP(solver_);
77 s & BOOST_SERIALIZATION_NVP(currentInsn_);
78 s & BOOST_SERIALIZATION_NVP(nInsns_);
79 s & BOOST_SERIALIZATION_NVP(name_);
80 if (version >= 1)
81 s & BOOST_SERIALIZATION_NVP(hotPatch_);
82 if (version >= 2)
83 s & BOOST_SERIALIZATION_NVP(isNoopRead_);
84 }
85#endif
86
88 // Real constructors
89protected:
90 // for serialization
92
94 explicit RiscOperators(const StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr());
95
96public:
97 virtual ~RiscOperators();
98
100 // Static allocating constructors. None needed since this class is abstract.
101
102
104 // Virtual constructors.
105public:
110
115 virtual RiscOperatorsPtr create(const StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) const = 0;
116
118 // Dynamic pointer casts. No-op since this is the base class.
119public:
120 static RiscOperatorsPtr promote(const RiscOperatorsPtr &x) {
121 ASSERT_not_null(x);
122 return x;
123 }
124
126 // Other methods part of our API
127public:
131 virtual SValuePtr protoval() const { return protoval_; }
132
141 virtual SmtSolverPtr solver() const { return solver_; }
142 virtual void solver(const SmtSolverPtr &s) { solver_ = s; }
151 const HotPatch& hotPatch() const { return hotPatch_; }
152 HotPatch& hotPatch() { return hotPatch_; }
153 void hotPatch(const HotPatch &hp) { hotPatch_ = hp; }
167 virtual StatePtr currentState() const { return currentState_; }
168 virtual void currentState(const StatePtr &s) { currentState_ = s; }
208 virtual StatePtr initialState() const { return initialState_; }
209 virtual void initialState(const StatePtr &s) { initialState_ = s; }
217 virtual const std::string& name() const { return name_; }
218 virtual void name(const std::string &s) { name_ = s; }
225
228 void print(std::ostream &stream, const std::string prefix="") const;
229 virtual void print(std::ostream &stream, Formatter &fmt) const;
235 Formatter &fmt;
236 public:
237 WithFormatter(const RiscOperatorsPtr &obj, Formatter &fmt): obj(obj), fmt(fmt) {}
238 void print(std::ostream &stream) const { obj->print(stream, fmt); }
239 };
240
256 WithFormatter with_format(Formatter &fmt) { return WithFormatter(shared_from_this(), fmt); }
258 WithFormatter operator+(const std::string &linePrefix);
266 virtual size_t nInsns() const { return nInsns_; }
267 virtual void nInsns(size_t n) { nInsns_ = n; }
277 return currentInsn_;
278 }
280 currentInsn_ = insn;
281 }
297 virtual bool isNoopRead() const { return isNoopRead_; }
298 virtual void isNoopRead(bool b) { isNoopRead_ = b; }
304
308
312 virtual void comment(const std::string&);
313
314
316 // Value Construction Operations
318 // The trailing underscores are necessary for for undefined_() on some machines, so we just add one to the end of all the
319 // virtual constructors for consistency.
320
324 virtual SValuePtr undefined_(size_t nbits);
325 virtual SValuePtr unspecified_(size_t nbits);
329 virtual SValuePtr number_(size_t nbits, uint64_t value);
330
332 virtual SValuePtr boolean_(bool value);
333
335 virtual SValuePtr bottom_(size_t nbits);
336
337
339 // x86-specific Operations (FIXME)
341
345
350
355
357 virtual void hlt() {}
358
360 virtual void cpuid() {}
361
363 virtual SValuePtr rdtsc() { return unspecified_(64); }
364
365
367 // Boolean Operations
369
372 virtual SValuePtr and_(const SValuePtr &a, const SValuePtr &b) = 0;
373
376 virtual SValuePtr or_(const SValuePtr &a, const SValuePtr &b) = 0;
377
380 virtual SValuePtr xor_(const SValuePtr &a, const SValuePtr &b) = 0;
381
383 virtual SValuePtr invert(const SValuePtr &a) = 0;
384
388 virtual SValuePtr extract(const SValuePtr &a, size_t begin_bit, size_t end_bit) = 0;
389
396 virtual SValuePtr concat(const SValuePtr &lowBits, const SValuePtr &highBits) = 0;
397
405 virtual SValuePtr concatLoHi(const SValuePtr &lowBits, const SValuePtr &highBits) {
406 return concat(lowBits, highBits);
407 }
408 virtual SValuePtr concatHiLo(const SValuePtr &highBits, const SValuePtr &lowBits) {
409 return concat(lowBits, highBits);
410 }
418 virtual std::pair<SValuePtr /*low*/, SValuePtr /*high*/> split(const SValuePtr &a, size_t splitPoint);
419
423
427
433
439
443 virtual SValuePtr rotateLeft(const SValuePtr &a, const SValuePtr &nbits) = 0;
444
448 virtual SValuePtr rotateRight(const SValuePtr &a, const SValuePtr &nbits) = 0;
449
453 virtual SValuePtr shiftLeft(const SValuePtr &a, const SValuePtr &nbits) = 0;
454
458 virtual SValuePtr shiftRight(const SValuePtr &a, const SValuePtr &nbits) = 0;
459
464 virtual SValuePtr shiftRightArithmetic(const SValuePtr &a, const SValuePtr &nbits) = 0;
465
471 virtual SValuePtr reverseElmts(const SValuePtr &a, size_t elmtNBits);
472
473
475 // Comparison Operations
477
480 virtual SValuePtr equalToZero(const SValuePtr &a) = 0;
481
483 enum class IteStatus {
484 NEITHER,
485 A,
486 B,
487 BOTH
488 };
489
497 virtual SValuePtr iteWithStatus(const SValuePtr &cond, const SValuePtr &a, const SValuePtr &b, IteStatus &status /*out*/) = 0;
498
507 virtual SValuePtr ite(const SValuePtr &cond, const SValuePtr &a, const SValuePtr &b) final {
509 return iteWithStatus(cond, a, b, status);
510 }
511
518 virtual SValuePtr isEqual(const SValuePtr &a, const SValuePtr &b);
519 virtual SValuePtr isNotEqual(const SValuePtr &a, const SValuePtr &b);
529 virtual SValuePtr isUnsignedLessThan(const SValuePtr &a, const SValuePtr &b);
542 virtual SValuePtr isSignedLessThan(const SValuePtr &a, const SValuePtr &b);
549 // Integer Arithmetic Operations
551
554 virtual SValuePtr unsignedExtend(const SValuePtr &a, size_t new_width);
555
558 virtual SValuePtr signExtend(const SValuePtr &a, size_t new_width) = 0;
559
562 virtual SValuePtr add(const SValuePtr &a, const SValuePtr &b) = 0;
563
568 virtual SValuePtr addCarry(const SValuePtr &a, const SValuePtr &b,
569 SValuePtr &carryOut /*out*/, SValuePtr &overflowed /*out*/);
570
576 virtual SValuePtr subtract(const SValuePtr &minuend, const SValuePtr &subtrahend);
577
586 virtual SValuePtr subtractCarry(const SValuePtr &minuend, const SValuePtr &subtrahend,
587 SValuePtr &carryOut /*out*/, SValuePtr &overflowed /*out*/);
588
605 virtual SValuePtr addWithCarries(const SValuePtr &a, const SValuePtr &b, const SValuePtr &c,
606 SValuePtr &carry_out/*output*/) = 0;
607
609 virtual SValuePtr negate(const SValuePtr &a) = 0;
610
612 virtual SValuePtr signedDivide(const SValuePtr &dividend, const SValuePtr &divisor) = 0;
613
615 virtual SValuePtr signedModulo(const SValuePtr &a, const SValuePtr &b) = 0;
616
618 virtual SValuePtr signedMultiply(const SValuePtr &a, const SValuePtr &b) = 0;
619
621 virtual SValuePtr unsignedDivide(const SValuePtr &dividend, const SValuePtr &divisor) = 0;
622
624 virtual SValuePtr unsignedModulo(const SValuePtr &a, const SValuePtr &b) = 0;
625
627 virtual SValuePtr unsignedMultiply(const SValuePtr &a, const SValuePtr &b) = 0;
628
629
631 // Interrupt and system calls
633
642 virtual void interrupt(int majorNumber, int minorNumber);
643
651 virtual void interrupt(const SValuePtr &majr, const SValuePtr &minr, const SValuePtr &raise);
652
664 virtual void raiseInterrupt(unsigned majorNumber, unsigned minorNumber, const SValuePtr &raise);
665
666
668 // Floating-point operations
669 //
670 // For now these all have default implementations that throw NotImplemented, but we might change them to pure virtual
671 // sometime in the future so they're consistent with most other RISC operators. [Robb P. Matzke 2015-08-03]
673
675 virtual SValuePtr fpFromInteger(const SValuePtr &intValue, SgAsmFloatType *fpType);
676
682 virtual SValuePtr fpToInteger(const SValuePtr &fpValue, SgAsmFloatType *fpType, const SValuePtr &dflt);
683
687 virtual SValuePtr fpConvert(const SValuePtr &a, SgAsmFloatType *aType, SgAsmFloatType *retType);
688
690 virtual SValuePtr fpIsNan(const SValuePtr &fpValue, SgAsmFloatType *fpType);
691
693 virtual SValuePtr fpIsDenormalized(const SValuePtr &fpValue, SgAsmFloatType *fpType);
694
696 virtual SValuePtr fpIsZero(const SValuePtr &fpValue, SgAsmFloatType *fpType);
697
702 virtual SValuePtr fpIsInfinity(const SValuePtr &fpValue, SgAsmFloatType *fpType);
703
707 virtual SValuePtr fpSign(const SValuePtr &fpValue, SgAsmFloatType *fpType);
708
714 virtual SValuePtr fpEffectiveExponent(const SValuePtr &fpValue, SgAsmFloatType *fpType);
715
719 virtual SValuePtr fpAdd(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType);
720
725 virtual SValuePtr fpSubtract(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType);
726
730 virtual SValuePtr fpMultiply(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType);
731
735 virtual SValuePtr fpDivide(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType);
736
740 virtual SValuePtr fpSquareRoot(const SValuePtr &a, SgAsmFloatType *fpType);
741
746
748 // Conversion operations
750
756 virtual SValuePtr reinterpret(const SValuePtr &a, SgAsmType *retType);
757
768 virtual SValuePtr convert(const SValuePtr &a, SgAsmType *srcType, SgAsmType *dstType);
769
770
772 // State Accessing Operations
774
799 virtual SValuePtr readRegister(RegisterDescriptor reg) { // old subclasses can still override this if they want,
800 return readRegister(reg, undefined_(reg.nBits())); // but new subclasses should not override this method.
801 }
802 virtual SValuePtr readRegister(RegisterDescriptor reg, const SValuePtr &dflt); // new subclasses override this
814 virtual void writeRegister(RegisterDescriptor reg, const SValuePtr &a);
815
850 virtual SValuePtr readMemory(RegisterDescriptor segreg, const SValuePtr &addr, const SValuePtr &dflt,
851 const SValuePtr &cond) = 0;
852
863 virtual void writeMemory(RegisterDescriptor segreg, const SValuePtr &addr, const SValuePtr &data,
864 const SValuePtr &cond) = 0;
865
870 virtual SValuePtr peekMemory(RegisterDescriptor segreg, const SValuePtr &addr, const SValuePtr &dflt) = 0;
871};
872
873std::ostream& operator<<(std::ostream&, const RiscOperators&);
874std::ostream& operator<<(std::ostream&, const RiscOperators::WithFormatter&);
875
876} // namespace
877} // namespace
878} // namespace
879} // namespace
880
883
884#endif
885#endif
Describes how to modify machine state after each instruction.
Definition HotPatch.h:22
Base class for most instruction semantics RISC operators.
virtual SValuePtr extract(const SValuePtr &a, size_t begin_bit, size_t end_bit)=0
Extracts bits from a value.
virtual SValuePtr readRegister(RegisterDescriptor reg, const SValuePtr &dflt)
Reads a value from a register.
virtual SValuePtr subtract(const SValuePtr &minuend, const SValuePtr &subtrahend)
Subtract one value from another.
virtual SValuePtr isUnsignedLessThanOrEqual(const SValuePtr &a, const SValuePtr &b)
Comparison for unsigned values.
virtual SValuePtr unsignedModulo(const SValuePtr &a, const SValuePtr &b)=0
Calculates modulo with unsigned values.
virtual SValuePtr shiftLeft(const SValuePtr &a, const SValuePtr &nbits)=0
Returns arg shifted left.
virtual void comment(const std::string &)
Inject a line comment into debugging streams.
virtual SValuePtr negate(const SValuePtr &a)=0
Two's complement.
WithFormatter operator+(const std::string &linePrefix)
Used for printing RISC operators with formatting.
virtual void cpuid()
Invoked for the x86 CPUID instruction.
virtual SValuePtr countLeadingZeros(const SValuePtr &a)
Count leading zero bits.
virtual RiscOperatorsPtr create(const StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const =0
Virtual allocating constructor.
virtual SValuePtr reinterpret(const SValuePtr &a, SgAsmType *retType)
Reinterpret an expression as a different type.
virtual void writeMemory(RegisterDescriptor segreg, const SValuePtr &addr, const SValuePtr &data, const SValuePtr &cond)=0
Writes a value to memory.
virtual SValuePtr signedDivide(const SValuePtr &dividend, const SValuePtr &divisor)=0
Divides two signed values.
virtual SValuePtr bottom_(size_t nbits)
Returns a data-flow bottom value.
virtual SValuePtr subtractCarry(const SValuePtr &minuend, const SValuePtr &subtrahend, SValuePtr &carryOut, SValuePtr &overflowed)
Subtract one value from another and carry.
virtual SValuePtr shiftRightArithmetic(const SValuePtr &a, const SValuePtr &nbits)=0
Returns arg shifted right arithmetically (with sign bit).
virtual SValuePtr fpToInteger(const SValuePtr &fpValue, SgAsmFloatType *fpType, const SValuePtr &dflt)
Construct an integer value from a floating-point value.
virtual SValuePtr isUnsignedLessThan(const SValuePtr &a, const SValuePtr &b)
Comparison for unsigned values.
virtual StatePtr initialState() const
Property: Optional lazily updated initial state.
virtual SValuePtr boolean_(bool value)
Returns a Boolean value.
virtual SValuePtr invert(const SValuePtr &a)=0
One's complement.
virtual SValuePtr fpIsDenormalized(const SValuePtr &fpValue, SgAsmFloatType *fpType)
Whether a floating-point value is denormalized.
virtual SValuePtr fpIsInfinity(const SValuePtr &fpValue, SgAsmFloatType *fpType)
Whether a floating-point value is infinity.
WithFormatter with_format(Formatter &fmt)
Used for printing RISC operators with formatting.
virtual size_t nInsns() const
Property: Number of instructions processed.
void hotPatch(const HotPatch &hp)
Property: Post-instruction hot patches.
virtual SValuePtr fpDivide(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType)
Divide one floating-point value by another.
virtual SValuePtr fpRoundTowardZero(const SValuePtr &a, SgAsmFloatType *fpType)
Round toward zero.
virtual SValuePtr add(const SValuePtr &a, const SValuePtr &b)=0
Adds two integers of equal size.
virtual SValuePtr fpIsNan(const SValuePtr &fpValue, SgAsmFloatType *fpType)
Whether a floating-point value is a special not-a-number bit pattern.
virtual SValuePtr fpSign(const SValuePtr &fpValue, SgAsmFloatType *fpType)
Sign of floating-point value.
virtual SValuePtr isSignedLessThanOrEqual(const SValuePtr &a, const SValuePtr &b)
Comparison for signed values.
virtual void interrupt(int majorNumber, int minorNumber)
Unconditionally raise an interrupt.
virtual SValuePtr and_(const SValuePtr &a, const SValuePtr &b)=0
Computes bit-wise AND of two values.
virtual SValuePtr fpConvert(const SValuePtr &a, SgAsmFloatType *aType, SgAsmFloatType *retType)
Convert from one floating-point type to another.
virtual SValuePtr addWithCarries(const SValuePtr &a, const SValuePtr &b, const SValuePtr &c, SValuePtr &carry_out)=0
Add two values of equal size and a carry bit.
void print(std::ostream &stream, const std::string prefix="") const
Print multi-line output for this object.
virtual SValuePtr unsignedExtend(const SValuePtr &a, size_t new_width)
Extend (or shrink) operand a so it is nbits wide by adding or removing high-order bits.
virtual SValuePtr number_(size_t nbits, uint64_t value)
Returns a number of the specified bit width.
virtual SValuePtr unspecified_(size_t nbits)
Returns a new undefined value.
virtual SValuePtr undefined_(size_t nbits)
Returns a new undefined value.
virtual SValuePtr signExtend(const SValuePtr &a, size_t new_width)=0
Sign extends a value.
virtual SValuePtr isSignedLessThan(const SValuePtr &a, const SValuePtr &b)
Comparison for signed values.
virtual SValuePtr concat(const SValuePtr &lowBits, const SValuePtr &highBits)=0
Concatenates the bits of two values.
virtual SValuePtr iteWithStatus(const SValuePtr &cond, const SValuePtr &a, const SValuePtr &b, IteStatus &status)=0
If-then-else with status.
virtual SValuePtr reverseElmts(const SValuePtr &a, size_t elmtNBits)
Reverse parts of a value.
virtual SValuePtr leastSignificantSetBit(const SValuePtr &a)=0
Returns position of least significant set bit; zero when no bits are set.
virtual void finishInstruction(SgAsmInstruction *insn)
Called at the end of every instruction.
virtual SValuePtr isSignedGreaterThanOrEqual(const SValuePtr &a, const SValuePtr &b)
Comparison for signed values.
virtual SValuePtr filterCallTarget(const SValuePtr &a)
Invoked to filter call targets.
virtual SmtSolverPtr solver() const
Property: Satisfiability module theory (SMT) solver.
virtual void currentInstruction(SgAsmInstruction *insn)
Property: Current instruction.
virtual SValuePtr ite(const SValuePtr &cond, const SValuePtr &a, const SValuePtr &b) final
If-then-else.
virtual void interrupt(const SValuePtr &majr, const SValuePtr &minr, const SValuePtr &raise)
Invoked for instructions that cause an interrupt.
virtual SValuePtr protoval() const
Property: Prototypical semantic value.
virtual SValuePtr mostSignificantSetBit(const SValuePtr &a)=0
Returns position of most significant set bit; zero when no bits are set.
virtual SValuePtr unsignedMultiply(const SValuePtr &a, const SValuePtr &b)=0
Multiply two unsigned values.
virtual SValuePtr addCarry(const SValuePtr &a, const SValuePtr &b, SValuePtr &carryOut, SValuePtr &overflowed)
Adds two integers of equal size and carry.
virtual SValuePtr concatLoHi(const SValuePtr &lowBits, const SValuePtr &highBits)
Aliases for concatenation.
virtual SValuePtr filterReturnTarget(const SValuePtr &a)
Invoked to filter return targets.
virtual void hash(Combinatorics::Hasher &)
Compute hash of current state.
virtual SValuePtr shiftRight(const SValuePtr &a, const SValuePtr &nbits)=0
Returns arg shifted right logically (no sign bit).
virtual SValuePtr signedModulo(const SValuePtr &a, const SValuePtr &b)=0
Calculates modulo with signed values.
virtual void print(std::ostream &stream, Formatter &fmt) const
Print multi-line output for this object.
virtual SgAsmInstruction * currentInstruction() const
Property: Current instruction.
virtual void startInstruction(SgAsmInstruction *insn)
Called at the beginning of every instruction.
virtual SValuePtr rdtsc()
Invoked for the x86 RDTSC instruction.
virtual const std::string & name() const
Property: Name used for debugging.
virtual SValuePtr isSignedGreaterThan(const SValuePtr &a, const SValuePtr &b)
Comparison for signed values.
virtual SValuePtr equalToZero(const SValuePtr &a)=0
Determines whether a value is equal to zero.
virtual SValuePtr fpAdd(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType)
Add two floating-point values.
virtual void writeRegister(RegisterDescriptor reg, const SValuePtr &a)
Writes a value to a register.
virtual SValuePtr or_(const SValuePtr &a, const SValuePtr &b)=0
Computes bit-wise OR of two values.
virtual SValuePtr readMemory(RegisterDescriptor segreg, const SValuePtr &addr, const SValuePtr &dflt, const SValuePtr &cond)=0
Reads a value from memory.
virtual SValuePtr xor_(const SValuePtr &a, const SValuePtr &b)=0
Computes bit-wise XOR of two values.
virtual SValuePtr convert(const SValuePtr &a, SgAsmType *srcType, SgAsmType *dstType)
Convert value from one type to another.
virtual RiscOperatorsPtr create(const SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const =0
Virtual allocating constructor.
virtual void nInsns(size_t n)
Property: Number of instructions processed.
virtual SValuePtr unsignedDivide(const SValuePtr &dividend, const SValuePtr &divisor)=0
Divides two unsigned values.
virtual SValuePtr fpFromInteger(const SValuePtr &intValue, SgAsmFloatType *fpType)
Construct a floating-point value from an integer value.
virtual SValuePtr fpMultiply(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType)
Multiply two floating-point values.
virtual SValuePtr fpSubtract(const SValuePtr &a, const SValuePtr &b, SgAsmFloatType *fpType)
Subtract one floating-point value from another.
virtual void currentState(const StatePtr &s)
Property: Current semantic state.
virtual StatePtr currentState() const
Property: Current semantic state.
virtual SValuePtr isEqual(const SValuePtr &a, const SValuePtr &b)
Equality comparison.
virtual void raiseInterrupt(unsigned majorNumber, unsigned minorNumber, const SValuePtr &raise)
Conditionally raise an interrupt.
virtual void hlt()
Invoked for the x86 HLT instruction.
const HotPatch & hotPatch() const
Property: Post-instruction hot patches.
WithFormatter operator+(Formatter &fmt)
Used for printing RISC operators with formatting.
@ A
Return value is formed from A since condition was true.
@ B
Return value is formed from B since condition was false.
virtual SValuePtr rotateRight(const SValuePtr &a, const SValuePtr &nbits)=0
Rotate bits to the right.
virtual std::pair< SValuePtr, SValuePtr > split(const SValuePtr &a, size_t splitPoint)
Split a value into two narrower values.
virtual SValuePtr peekRegister(RegisterDescriptor, const SValuePtr &dflt)
Obtain a register value without side effects.
virtual SValuePtr concatHiLo(const SValuePtr &highBits, const SValuePtr &lowBits)
Aliases for concatenation.
virtual SValuePtr rotateLeft(const SValuePtr &a, const SValuePtr &nbits)=0
Rotate bits to the left.
HotPatch & hotPatch()
Property: Post-instruction hot patches.
virtual void solver(const SmtSolverPtr &s)
Property: Satisfiability module theory (SMT) solver.
virtual SValuePtr isUnsignedGreaterThanOrEqual(const SValuePtr &a, const SValuePtr &b)
Comparison for unsigned values.
virtual SValuePtr isUnsignedGreaterThan(const SValuePtr &a, const SValuePtr &b)
Comparison for unsigned values.
virtual SValuePtr isNotEqual(const SValuePtr &a, const SValuePtr &b)
Equality comparison.
virtual SValuePtr fpEffectiveExponent(const SValuePtr &fpValue, SgAsmFloatType *fpType)
Exponent of floating-point value.
virtual void name(const std::string &s)
Property: Name used for debugging.
virtual SValuePtr fpSquareRoot(const SValuePtr &a, SgAsmFloatType *fpType)
Square root.
virtual SValuePtr fpIsZero(const SValuePtr &fpValue, SgAsmFloatType *fpType)
Whether a floating-point value is equal to zero.
SValuePtr peekRegister(RegisterDescriptor reg)
Obtain a register value without side effects.
virtual SValuePtr readRegister(RegisterDescriptor reg)
Reads a value from a register.
virtual SValuePtr peekMemory(RegisterDescriptor segreg, const SValuePtr &addr, const SValuePtr &dflt)=0
Read memory without side effects.
virtual SValuePtr countLeadingOnes(const SValuePtr &a)
Count leading one bits.
virtual void initialState(const StatePtr &s)
Property: Optional lazily updated initial state.
virtual SValuePtr signedMultiply(const SValuePtr &a, const SValuePtr &b)=0
Multiplies two signed values.
virtual SValuePtr filterIndirectJumpTarget(const SValuePtr &a)
Invoked to filter indirect jumps.
Describes (part of) a physical CPU register.
size_t nBits() const
Property: Size in bits.
Floating point types.
Base class for machine instructions.
Base class for binary types.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
std::shared_ptr< SmtSolver > SmtSolverPtr
Reference counting pointer.
The ROSE library.