ROSE  0.11.87.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators Class Reference

Description

Dataflow RISC operators.

This is a MultiSemantics domain that contains a user-specified domain and a dataflow inner domain. The user-specified domain is used to calculate memory addresses, and the dataflow inner domain tracks dataflow across RISC operators (like the fact that if C = A + B then the definers for C are the union of the definers for A and B; or that if E = D xor D then E has no definers since it is a constant). State-accessing operations (reading and writing registers and memory) are handled above these two subdomains: read operations instantiate a value with a given set of definers, and write operations insert information into the final data flow graph.

Definition at line 64 of file DataFlowSemantics.h.

#include <Rose/BinaryAnalysis/InstructionSemantics2/DataFlowSemantics.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators:
Collaboration graph
[legend]

Public Types

using Super = MultiSemantics::RiscOperators
 Base type. More...
 
using Ptr = RiscOperatorsPtr
 Shared-ownership pointer. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators
using Super = BaseSemantics::RiscOperators
 Base type. More...
 
using Ptr = RiscOperatorsPtr
 Shared-ownership pointer. More...
 
- Public Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RiscOperators
using Ptr = RiscOperatorsPtr
 Shared-ownership pointer for a RiscOperators object. More...
 

Public Member Functions

void clearGraph ()
 Clear dataflow graph. More...
 
const DataFlowGraphgetGraph () const
 Return the dataflow graph. More...
 
virtual BaseSemantics::SValuePtr readRegister (RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) override
 Reads a value from a register. More...
 
virtual BaseSemantics::SValuePtr peekRegister (RegisterDescriptor reg, const BaseSemantics::SValuePtr &dflt) override
 Obtain a register value without side effects. More...
 
virtual void writeRegister (RegisterDescriptor reg, const BaseSemantics::SValuePtr &a_) override
 Writes a value to a register. More...
 
virtual BaseSemantics::SValuePtr readMemory (RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr_, const BaseSemantics::SValuePtr &dflt_, const BaseSemantics::SValuePtr &cond) override
 Reads a value from memory. More...
 
virtual BaseSemantics::SValuePtr peekMemory (RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr_, const BaseSemantics::SValuePtr &dflt_) override
 Read memory without side effects. More...
 
virtual void writeMemory (RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr_, const BaseSemantics::SValuePtr &data_, const BaseSemantics::SValuePtr &cond) override
 Writes a value to memory. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators
virtual size_t add_subdomain (const BaseSemantics::RiscOperatorsPtr &subdomain, const std::string &name, bool activate=true)
 Add a subdomain to this MultiSemantics domain. More...
 
virtual Formatterget_formatter ()
 Returns a formatter containing the names of the subdomains. More...
 
virtual size_t nsubdomains () const
 Returns the number of subdomains added to this MultiDomain. More...
 
virtual BaseSemantics::RiscOperatorsPtr get_subdomain (size_t idx) const
 Returns the RiscOperators for a subdomain. More...
 
virtual bool is_active (size_t idx) const
 Returns true if a subdomain is active. More...
 
virtual void clear_active (size_t idx)
 Makes a subdomain inactive. More...
 
virtual void set_active (size_t idx, bool status)
 Makes a subdomain active or inactive. More...
 
virtual void before (size_t idx)
 Called before each subdomain RISC operation. More...
 
virtual void after (size_t idx)
 Called after each subdomain RISC operation. More...
 
virtual SValuePtr svalue_empty (size_t nbits)
 Convenience function for SValue::create_empty(). More...
 
virtual void print (std::ostream &o, BaseSemantics::Formatter &) const override
 Print multi-line output for this object.
 
virtual void startInstruction (SgAsmInstruction *insn) override
 Called at the beginning of every instruction. More...
 
virtual void finishInstruction (SgAsmInstruction *insn) override
 Called at the end of every instruction. More...
 
virtual BaseSemantics::SValuePtr undefined_ (size_t nbits) override
 Returns a new undefined value. More...
 
virtual BaseSemantics::SValuePtr unspecified_ (size_t nbits) override
 Returns a new undefined value. More...
 
virtual BaseSemantics::SValuePtr number_ (size_t nbits, uint64_t value) override
 Returns a number of the specified bit width. More...
 
virtual BaseSemantics::SValuePtr boolean_ (bool) override
 Returns a Boolean value. More...
 
virtual BaseSemantics::SValuePtr bottom_ (size_t nbits) override
 Returns a data-flow bottom value. More...
 
virtual BaseSemantics::SValuePtr filterCallTarget (const BaseSemantics::SValuePtr &) override
 Invoked to filter call targets. More...
 
virtual BaseSemantics::SValuePtr filterReturnTarget (const BaseSemantics::SValuePtr &) override
 Invoked to filter return targets. More...
 
virtual BaseSemantics::SValuePtr filterIndirectJumpTarget (const BaseSemantics::SValuePtr &) override
 Invoked to filter indirect jumps. More...
 
virtual BaseSemantics::SValuePtr and_ (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Computes bit-wise AND of two values. More...
 
virtual BaseSemantics::SValuePtr or_ (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Computes bit-wise OR of two values. More...
 
virtual BaseSemantics::SValuePtr xor_ (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Computes bit-wise XOR of two values. More...
 
virtual BaseSemantics::SValuePtr invert (const BaseSemantics::SValuePtr &a) override
 One's complement. More...
 
virtual BaseSemantics::SValuePtr extract (const BaseSemantics::SValuePtr &a, size_t begin_bit, size_t end_bit) override
 Extracts bits from a value. More...
 
virtual BaseSemantics::SValuePtr concat (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Concatenates the bits of two values. More...
 
virtual BaseSemantics::SValuePtr leastSignificantSetBit (const BaseSemantics::SValuePtr &a) override
 Returns position of least significant set bit; zero when no bits are set. More...
 
virtual BaseSemantics::SValuePtr mostSignificantSetBit (const BaseSemantics::SValuePtr &a) override
 Returns position of most significant set bit; zero when no bits are set. More...
 
virtual BaseSemantics::SValuePtr rotateLeft (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
 Rotate bits to the left. More...
 
virtual BaseSemantics::SValuePtr rotateRight (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
 Rotate bits to the right. More...
 
virtual BaseSemantics::SValuePtr shiftLeft (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
 Returns arg shifted left. More...
 
virtual BaseSemantics::SValuePtr shiftRight (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
 Returns arg shifted right logically (no sign bit). More...
 
virtual BaseSemantics::SValuePtr shiftRightArithmetic (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &nbits) override
 Returns arg shifted right arithmetically (with sign bit). More...
 
virtual BaseSemantics::SValuePtr equalToZero (const BaseSemantics::SValuePtr &a) override
 Determines whether a value is equal to zero. More...
 
virtual BaseSemantics::SValuePtr ite (const BaseSemantics::SValuePtr &cond, const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 If-then-else. More...
 
virtual BaseSemantics::SValuePtr unsignedExtend (const BaseSemantics::SValuePtr &a, size_t new_width) override
 Extend (or shrink) operand a so it is nbits wide by adding or removing high-order bits. More...
 
virtual BaseSemantics::SValuePtr signExtend (const BaseSemantics::SValuePtr &a, size_t new_width) override
 Sign extends a value. More...
 
virtual BaseSemantics::SValuePtr add (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Adds two integers of equal size. More...
 
virtual BaseSemantics::SValuePtr addWithCarries (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b, const BaseSemantics::SValuePtr &c, BaseSemantics::SValuePtr &carry_out) override
 Add two values of equal size and a carry bit. More...
 
virtual BaseSemantics::SValuePtr negate (const BaseSemantics::SValuePtr &a) override
 Two's complement. More...
 
virtual BaseSemantics::SValuePtr signedDivide (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Divides two signed values. More...
 
virtual BaseSemantics::SValuePtr signedModulo (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Calculates modulo with signed values. More...
 
virtual BaseSemantics::SValuePtr signedMultiply (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Multiplies two signed values. More...
 
virtual BaseSemantics::SValuePtr unsignedDivide (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Divides two unsigned values. More...
 
virtual BaseSemantics::SValuePtr unsignedModulo (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Calculates modulo with unsigned values. More...
 
virtual BaseSemantics::SValuePtr unsignedMultiply (const BaseSemantics::SValuePtr &a, const BaseSemantics::SValuePtr &b) override
 Multiply two unsigned values. More...
 
virtual BaseSemantics::SValuePtr fpFromInteger (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Construct a floating-point value from an integer value. More...
 
virtual BaseSemantics::SValuePtr fpToInteger (const BaseSemantics::SValuePtr &, SgAsmFloatType *, const BaseSemantics::SValuePtr &) override
 Construct an integer value from a floating-point value. More...
 
virtual BaseSemantics::SValuePtr fpConvert (const BaseSemantics::SValuePtr &, SgAsmFloatType *, SgAsmFloatType *) override
 Convert from one floating-point type to another. More...
 
virtual BaseSemantics::SValuePtr fpIsNan (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Whether a floating-point value is a special not-a-number bit pattern. More...
 
virtual BaseSemantics::SValuePtr fpIsDenormalized (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Whether a floating-point value is denormalized. More...
 
virtual BaseSemantics::SValuePtr fpIsZero (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Whether a floating-point value is equal to zero. More...
 
virtual BaseSemantics::SValuePtr fpIsInfinity (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Whether a floating-point value is infinity. More...
 
virtual BaseSemantics::SValuePtr fpSign (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Sign of floating-point value. More...
 
virtual BaseSemantics::SValuePtr fpEffectiveExponent (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Exponent of floating-point value. More...
 
virtual BaseSemantics::SValuePtr fpAdd (const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Add two floating-point values. More...
 
virtual BaseSemantics::SValuePtr fpSubtract (const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Subtract one floating-point value from another. More...
 
virtual BaseSemantics::SValuePtr fpMultiply (const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Multiply two floating-point values. More...
 
virtual BaseSemantics::SValuePtr fpDivide (const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Divide one floating-point value by another. More...
 
virtual BaseSemantics::SValuePtr fpSquareRoot (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Square root. More...
 
virtual BaseSemantics::SValuePtr fpRoundTowardZero (const BaseSemantics::SValuePtr &, SgAsmFloatType *) override
 Round toward zero. More...
 
virtual BaseSemantics::SValuePtr reinterpret (const BaseSemantics::SValuePtr &, SgAsmType *) override
 Reinterpret an expression as a different type. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RiscOperators
virtual SValuePtr protoval () const
 Property: Prototypical semantic value. More...
 
virtual void hash (Combinatorics::Hasher &)
 Compute hash of current state. More...
 
virtual void hlt ()
 Invoked for the x86 HLT instruction. More...
 
virtual void cpuid ()
 Invoked for the x86 CPUID instruction. More...
 
virtual SValuePtr rdtsc ()
 Invoked for the x86 RDTSC instruction. More...
 
virtual std::pair< SValuePtr, SValuePtrsplit (const SValuePtr &a, size_t splitPoint)
 Split a value into two narrower values. More...
 
virtual SValuePtr countLeadingZeros (const SValuePtr &a)
 Count leading zero bits. More...
 
virtual SValuePtr countLeadingOnes (const SValuePtr &a)
 Count leading one bits. More...
 
virtual SValuePtr reverseElmts (const SValuePtr &a, size_t elmtNBits)
 Reverse parts of a value. More...
 
virtual SValuePtr addCarry (const SValuePtr &a, const SValuePtr &b, SValuePtr &carryOut, SValuePtr &overflowed)
 Adds two integers of equal size and carry. More...
 
virtual SValuePtr subtract (const SValuePtr &minuend, const SValuePtr &subtrahend)
 Subtract one value from another. More...
 
virtual SValuePtr subtractCarry (const SValuePtr &minuend, const SValuePtr &subtrahend, SValuePtr &carryOut, SValuePtr &overflowed)
 Subtract one value from another and carry. More...
 
virtual void interrupt (int majr, int minr)
 Invoked for instructions that cause an interrupt. More...
 
virtual void interrupt (const SValuePtr &majr, const SValuePtr &minr, const SValuePtr &enabled)
 Invoked for instructions that cause an interrupt. More...
 
virtual SValuePtr convert (const SValuePtr &a, SgAsmType *srcType, SgAsmType *dstType)
 Convert value from one type to another. More...
 
virtual SmtSolverPtr solver () const
 Property: Satisfiability module theory (SMT) solver. More...
 
virtual void solver (const SmtSolverPtr &s)
 Property: Satisfiability module theory (SMT) solver. More...
 
const HotPatchhotPatch () const
 Property: Post-instruction hot patches. More...
 
HotPatchhotPatch ()
 Property: Post-instruction hot patches. More...
 
void hotPatch (const HotPatch &hp)
 Property: Post-instruction hot patches. More...
 
virtual StatePtr currentState () const
 Property: Current semantic state. More...
 
virtual void currentState (const StatePtr &s)
 Property: Current semantic state. More...
 
virtual StatePtr initialState () const
 Property: Optional lazily updated initial state. More...
 
virtual void initialState (const StatePtr &s)
 Property: Optional lazily updated initial state. More...
 
virtual const std::string & name () const
 Property: Name used for debugging. More...
 
virtual void name (const std::string &s)
 Property: Name used for debugging. More...
 
void print (std::ostream &stream, const std::string prefix="") const
 Print multi-line output for this object.
 
WithFormatter with_format (Formatter &fmt)
 Used for printing RISC operators with formatting. More...
 
WithFormatter operator+ (Formatter &fmt)
 Used for printing RISC operators with formatting. More...
 
WithFormatter operator+ (const std::string &linePrefix)
 Used for printing RISC operators with formatting. More...
 
virtual size_t nInsns () const
 Property: Number of instructions processed. More...
 
virtual void nInsns (size_t n)
 Property: Number of instructions processed. More...
 
virtual SgAsmInstructioncurrentInstruction () const
 Property: Current instruction. More...
 
virtual void currentInstruction (SgAsmInstruction *insn)
 Property: Current instruction. More...
 
virtual bool isNoopRead () const
 Property: No-op read. More...
 
virtual void isNoopRead (bool b)
 Property: No-op read. More...
 
virtual SValuePtr concatLoHi (const SValuePtr &lowBits, const SValuePtr &highBits)
 Aliases for concatenation. More...
 
virtual SValuePtr concatHiLo (const SValuePtr &highBits, const SValuePtr &lowBits)
 Aliases for concatenation. More...
 
virtual SValuePtr isEqual (const SValuePtr &a, const SValuePtr &b)
 Equality comparison. More...
 
virtual SValuePtr isNotEqual (const SValuePtr &a, const SValuePtr &b)
 Equality comparison. More...
 
virtual SValuePtr isUnsignedLessThan (const SValuePtr &a, const SValuePtr &b)
 Comparison for unsigned values. More...
 
virtual SValuePtr isUnsignedLessThanOrEqual (const SValuePtr &a, const SValuePtr &b)
 Comparison for unsigned values. More...
 
virtual SValuePtr isUnsignedGreaterThan (const SValuePtr &a, const SValuePtr &b)
 Comparison for unsigned values. More...
 
virtual SValuePtr isUnsignedGreaterThanOrEqual (const SValuePtr &a, const SValuePtr &b)
 Comparison for unsigned values. More...
 
virtual SValuePtr isSignedLessThan (const SValuePtr &a, const SValuePtr &b)
 Comparison for signed values. More...
 
virtual SValuePtr isSignedLessThanOrEqual (const SValuePtr &a, const SValuePtr &b)
 Comparison for signed values. More...
 
virtual SValuePtr isSignedGreaterThan (const SValuePtr &a, const SValuePtr &b)
 Comparison for signed values. More...
 
virtual SValuePtr isSignedGreaterThanOrEqual (const SValuePtr &a, const SValuePtr &b)
 Comparison for signed values. More...
 
virtual SValuePtr readRegister (RegisterDescriptor reg)
 Reads a value from a register. More...
 
SValuePtr peekRegister (RegisterDescriptor reg)
 Obtain a register value without side effects. More...
 

Static Public Member Functions

static RiscOperatorsPtr instance (const BaseSemantics::RiscOperatorsPtr &childOps)
 Static allocating constructor. More...
 
static RiscOperatorsPtr promote (const BaseSemantics::RiscOperatorsPtr &x)
 Run-time promotion of a base RiscOperators pointer to operators for this domain. More...
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators
static RiscOperatorsPtr instance (const RegisterDictionary *regdict)
 Static allocating constructor. More...
 
static RiscOperatorsPtr instance (const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
 
static RiscOperatorsPtr instance (const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
 
static RiscOperatorsPtr promote (const BaseSemantics::RiscOperatorsPtr &ops)
 
- Static Public Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RiscOperators
static RiscOperatorsPtr promote (const RiscOperatorsPtr &x)
 

Protected Member Functions

 RiscOperators (const BaseSemantics::RiscOperatorsPtr &userDomain)
 
BaseSemantics::SValuePtr readOrPeekMemory (RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, const BaseSemantics::SValuePtr &cond, bool allowSideEffects)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators
 RiscOperators (const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
 
 RiscOperators (const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::InstructionSemantics2::BaseSemantics::RiscOperators
 RiscOperators (const SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
 
 RiscOperators (const StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
 

Additional Inherited Members

- Protected Types inherited from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators
typedef std::vector< BaseSemantics::RiscOperatorsPtrSubdomains
 
- Protected Attributes inherited from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators
Subdomains subdomains
 
std::vector< bool > active
 
Formatter formatter
 

Member Typedef Documentation

Base type.

Definition at line 67 of file DataFlowSemantics.h.

Shared-ownership pointer.

Definition at line 70 of file DataFlowSemantics.h.

Member Function Documentation

static RiscOperatorsPtr Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::instance ( const BaseSemantics::RiscOperatorsPtr childOps)
inlinestatic

Static allocating constructor.

Constructs a semantic framework for discovering data flow. The caller provides a semantic domain that is used to identify memory locations. Any domain can be used, but usually a SymbolicSemantics domain works best.

Definition at line 92 of file DataFlowSemantics.h.

static RiscOperatorsPtr Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::promote ( const BaseSemantics::RiscOperatorsPtr x)
inlinestatic

Run-time promotion of a base RiscOperators pointer to operators for this domain.

This is a checked conversion–it will fail if x does not point to an object with appropriate dynamic type.

Definition at line 119 of file DataFlowSemantics.h.

void Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::clearGraph ( )
inline

Clear dataflow graph.

Clears the dataflow graph without affecting the user-supplied virtual machine state.

Definition at line 129 of file DataFlowSemantics.h.

References Sawyer::Container::Graph< V, E, VKey, EKey, Alloc >::clear().

const DataFlowGraph& Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::getGraph ( ) const
inline

Return the dataflow graph.

Definition at line 132 of file DataFlowSemantics.h.

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::readRegister ( RegisterDescriptor  reg,
const BaseSemantics::SValuePtr dflt 
)
overridevirtual

Reads a value from a register.

The base implementation simply delegates to the current semantic State, which probably delegates to a register state, but subclasses are welcome to override this behavior at any level.

A register state will typically implement storage for hardware registers, but higher layers (the State, RiscOperators, Dispatcher, ...) should not be concerned about the size of the register they're trying to read. For example, a register state for a 32-bit x86 architecture will likely have a storage location for the 32-bit EAX register, but it should be possible to ask readRegister to return the value of AX (the low-order 16-bits). In order to accomplish this, some level of the readRegister delegations needs to invoke extract to obtain the low 16 bits. The RiscOperators object is passed along the delegation path for this purpose. The inverse concat operation will be needed at some level when we ask readRegister to return a value that comes from multiple storage locations in the register state (such as can happen if an x86 register state holds individual status flags and we ask for the 32-bit EFLAGS register).

If the register state can distinguish between a register that has never been accessed and a register that has only been read, then the dflt value is stored into the register the first time it's read. This ensures that reading the register a second time with no intervening write will return the same value as the first read. If a dflt is not provided then one is constructed by invoking undefined_.

There needs to be a certain level of cooperation between the RiscOperators, State, and register state classes to decide which layer should invoke the extract or concat (or whatever other RISC operations might be necessary).

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators.

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::peekRegister ( RegisterDescriptor  ,
const BaseSemantics::SValuePtr dflt 
)
overridevirtual

Obtain a register value without side effects.

This is a lower-level operation than readRegister in that it doesn't cause the register to be marked as having been read. It is typically used in situations where the register is being accessed for analysis purposes rather than as part of an instruction emulation.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::writeRegister ( RegisterDescriptor  reg,
const BaseSemantics::SValuePtr a 
)
overridevirtual

Writes a value to a register.

The base implementation simply delegates to the current semantic State, which probably delegates to a register state, but subclasses are welcome to override this behavior at any level.

As with readRegister, writeRegister may need to perform various RISC operations in order to accomplish the task of writing a value to the specified register when the underlying register state doesn't actually store a value for that specific register. The RiscOperations object is passed along for that purpose. See readRegister for more details.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators.

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::readMemory ( RegisterDescriptor  segreg,
const BaseSemantics::SValuePtr addr,
const BaseSemantics::SValuePtr dflt,
const BaseSemantics::SValuePtr cond 
)
overridevirtual

Reads a value from memory.

The implementation (in subclasses) will typically delegate much of the work to the current state's readMemory method.

A MemoryState will implement storage for memory locations and might impose certain restrictions, such as "all memory values must be eight bits". However, the readMemory should not have these constraints so that it can be called from a variety of Dispatcher subclass (e.g., the DispatcherX86 class assumes that readMemory is capable of reading 32-bit values from little-endian memory). The designers of the MemoryState, State, and RiscOperators should collaborate to decide which layer (RiscOperators, State, or MemoryState) is reponsible for combining individual memory locations into larger values. A RiscOperators object is passed along the chain of delegations for this purpose. The RiscOperators might also contain other data that's important during the process, such as an SMT solver.

The segreg argument is an optional segment register. Most architectures have a flat virtual address space and will pass a default-constructed register descriptor whose is_valid() method returns false.

The cond argument is a Boolean value that indicates whether this is a true read operation. If cond can be proven to be false then the read is a no-op and returns an arbitrary value.

The dflt argument determines the size of the value to be read. This argument is also passed along to the lower layers so that they can, if they desire, use it to initialize memory that has never been read or written before.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators.

virtual BaseSemantics::SValuePtr Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::peekMemory ( RegisterDescriptor  segreg,
const BaseSemantics::SValuePtr addr,
const BaseSemantics::SValuePtr dflt 
)
overridevirtual

Read memory without side effects.

This is a lower-level operation than readMemory in that it doesn't cause any side effects in the memory state. In all other respects, it's similar to readMemory.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators.

virtual void Rose::BinaryAnalysis::InstructionSemantics2::DataFlowSemantics::RiscOperators::writeMemory ( RegisterDescriptor  segreg,
const BaseSemantics::SValuePtr addr,
const BaseSemantics::SValuePtr data,
const BaseSemantics::SValuePtr cond 
)
overridevirtual

Writes a value to memory.

The implementation (in subclasses) will typically delegate much of the work to the current state's writeMemory method.

The segreg argument is an optional segment register. Most architectures have a flat virtual address space and will pass a default-constructed register descriptor whose is_valid() method returns false.

The cond argument is a Boolean value that indicates whether this is a true write operation. If cond can be proved to be false then writeMemory is a no-op.

Reimplemented from Rose::BinaryAnalysis::InstructionSemantics2::MultiSemantics::RiscOperators.


The documentation for this class was generated from the following file: