ROSE  0.11.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState Class Reference

Description

Byte-addressable memory.

This class represents an entire state of memory via MemoryMap, allocating new memory in units of pages (the size of a page is configurable.

Definition at line 169 of file ConcreteSemantics2.h.

#include <ConcreteSemantics2.h>

Inheritance diagram for Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState:
Collaboration graph
[legend]

Public Member Functions

virtual BaseSemantics::MemoryStatePtr create (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval) const ROSE_OVERRIDE
 Virtual constructor. More...
 
virtual BaseSemantics::MemoryStatePtr clone () const ROSE_OVERRIDE
 Virtual copy constructor. More...
 
virtual void clear () ROSE_OVERRIDE
 
virtual void print (std::ostream &, Formatter &) const ROSE_OVERRIDE
 
virtual BaseSemantics::SValuePtr readMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
 
virtual BaseSemantics::SValuePtr peekMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
 
virtual void writeMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &value, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
 
virtual bool merge (const BaseSemantics::MemoryStatePtr &other, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps) ROSE_OVERRIDE
 
const MemoryMap::Ptr memoryMap () const
 Returns the memory map. More...
 
void memoryMap (const MemoryMap::Ptr &, Sawyer::Optional< unsigned > padAccess=Sawyer::Nothing())
 Set memory map. More...
 
void allocatePage (rose_addr_t va)
 Allocate a page of memory. More...
 
rose_addr_t pageSize () const
 Size of each page of memory. More...
 
void pageSize (rose_addr_t nBytes)
 Size of each page of memory. More...
 

Static Public Member Functions

static MemoryStatePtr instance (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 Instantiates a new memory state having specified prototypical value. More...
 
static MemoryStatePtr instance (const MemoryStatePtr &other)
 Instantiates a new deep copy of an existing state. More...
 
static MemoryStatePtr promote (const BaseSemantics::MemoryStatePtr &x)
 Recasts a base pointer to a concrete memory state. More...
 

Protected Member Functions

 MemoryState (const BaseSemantics::SValuePtr &addrProtoval, const BaseSemantics::SValuePtr &valProtoval)
 
 MemoryState (const MemoryState &other)
 
BaseSemantics::SValuePtr readOrPeekMemory (const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, BaseSemantics::RiscOperators *addrOps, BaseSemantics::RiscOperators *valOps, bool allowSideEffects)
 

Member Function Documentation

static MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::instance ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
)
inlinestatic

Instantiates a new memory state having specified prototypical value.

The addrProtoval and valProtoval must both be of ConcreteSemantics::SValue type or derived classes.

Definition at line 196 of file ConcreteSemantics2.h.

Referenced by create(), and Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::RiscOperators::instance().

static MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::instance ( const MemoryStatePtr other)
inlinestatic

Instantiates a new deep copy of an existing state.

For efficiency purposes, the data buffers are not copied immediately but rather marked as copy-on-write. However, the newly constructed memory map will have its own segments, which hold the segment names, access permissions, etc.

Definition at line 204 of file ConcreteSemantics2.h.

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::create ( const BaseSemantics::SValuePtr addrProtoval,
const BaseSemantics::SValuePtr valProtoval 
) const
inlinevirtual

Virtual constructor.

Creates a memory state having specified prototypical value, which should be of type ConcreteSemantics::SValue or subclasses.

Definition at line 215 of file ConcreteSemantics2.h.

References instance().

virtual BaseSemantics::MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::clone ( ) const
inlinevirtual

Virtual copy constructor.

Creates a new deep copy of this memory state. For efficiency purposes, the data buffers are not copied immediately but rather marked as copy-on-write. However, the newly constructed memory map will have its own segments, which hold the segment names, access permissions, etc.

Definition at line 225 of file ConcreteSemantics2.h.

static MemoryStatePtr Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::promote ( const BaseSemantics::MemoryStatePtr x)
inlinestatic

Recasts a base pointer to a concrete memory state.

This is a checked cast that will fail if the specified pointer does not have a run-time type that is a ConcreteSemantics::MemoryState or subclass thereof.

Definition at line 234 of file ConcreteSemantics2.h.

const MemoryMap::Ptr Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::memoryMap ( ) const
inline

Returns the memory map.

Definition at line 274 of file ConcreteSemantics2.h.

void Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::memoryMap ( const MemoryMap::Ptr ,
Sawyer::Optional< unsigned >  padAccess = Sawyer::Nothing() 
)

Set memory map.

If the specified map's areas are not in units of pages then padding segments will be added to this memory state. The padding segments will either have the accessibility specified by padAccess, or will have the same accessibility as the memory region being padded. All padding segments will be named "padding".

rose_addr_t Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::pageSize ( ) const
inline

Size of each page of memory.

Memory is allocated in units of the page size and aligned on page-size boundaries. The page size cannot be changed once the map contains data.

Definition at line 289 of file ConcreteSemantics2.h.

void Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::pageSize ( rose_addr_t  nBytes)

Size of each page of memory.

Memory is allocated in units of the page size and aligned on page-size boundaries. The page size cannot be changed once the map contains data.

void Rose::BinaryAnalysis::InstructionSemantics2::ConcreteSemantics::MemoryState::allocatePage ( rose_addr_t  va)

Allocate a page of memory.

The specified address will be contained in the page, which is aligned on a page boundary. Do not call this if the page is already allocated unless: it will replace the allocated page with a new one containing all zeros.


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