decompiler  1.0.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
MemoryImage Class Reference

A kind of MemoryBank which retrieves its data from an underlying LoadImage. More...

#include <memstate.hh>

Inheritance diagram for MemoryImage:
MemoryBank

Public Member Functions

 MemoryImage (AddrSpace *spc, int4 ws, int4 ps, LoadImage *ld)
 Constructor for a loadimage memorybank. More...
 
- Public Member Functions inherited from MemoryBank
 MemoryBank (AddrSpace *spc, int4 ws, int4 ps)
 Generic constructor for a memory bank. More...
 
int4 getWordSize (void) const
 Get the number of bytes in a word for this memory bank. More...
 
int4 getPageSize (void) const
 Get the number of bytes in a page for this memory bank. More...
 
AddrSpacegetSpace (void) const
 Get the address space associated with this memory bank. More...
 
void setValue (uintb offset, int4 size, uintb val)
 Set the value of a (small) range of bytes. More...
 
uintb getValue (uintb offset, int4 size) const
 Retrieve the value encoded in a (small) range of bytes. More...
 
void setChunk (uintb offset, int4 size, const uint1 *val)
 Set values of an arbitrary sequence of bytes. More...
 
void getChunk (uintb offset, int4 size, uint1 *res) const
 Retrieve an arbitrary sequence of bytes. More...
 

Protected Member Functions

virtual void insert (uintb addr, uintb val)
 Exception is thrown for write attempts.
 
virtual uintb find (uintb addr) const
 Overridden find method. More...
 
virtual void getPage (uintb addr, uint1 *res, int4 skip, int4 size) const
 Overridded getPage method. More...
 
- Protected Member Functions inherited from MemoryBank
virtual void setPage (uintb addr, const uint1 *val, int4 skip, int4 size)
 Write data into a memory page. More...
 

Private Attributes

LoadImageloader
 The underlying LoadImage.
 

Additional Inherited Members

- Static Public Member Functions inherited from MemoryBank
static uintb constructValue (const uint1 *ptr, int4 size, bool bigendian)
 Decode bytes to value. More...
 
static void deconstructValue (uint1 *ptr, uintb val, int4 size, bool bigendian)
 Encode value to bytes. More...
 

Detailed Description

A kind of MemoryBank which retrieves its data from an underlying LoadImage.

Any bytes requested on the bank which lie in the LoadImage are retrieved from the LoadImage. Other addresses in the space are filled in with zero. This bank cannot be written to.

Constructor & Destructor Documentation

MemoryImage::MemoryImage ( AddrSpace spc,
int4  ws,
int4  ps,
LoadImage ld 
)

Constructor for a loadimage memorybank.

A MemoryImage needs everything a basic memory bank needs and is needs to know the underlying LoadImage object to forward read reqests to.

Parameters
spcis the address space associated with the memory bank
wsis the number of bytes in the preferred wordsize (must be power of 2)
psis the number of bytes in a page (must be power of 2)
ldis the underlying LoadImage

References loader.

Member Function Documentation

uintb MemoryImage::find ( uintb  addr) const
protectedvirtual

Overridden find method.

Find an aligned word from the bank. First an attempt is made to fetch the data from the LoadImage. If this fails, the value is returned as 0.

Parameters
addris the address of the word to fetch
Returns
the fetched value

Implements MemoryBank.

References byte_swap(), MemoryBank::getSpace(), MemoryBank::getWordSize(), and AddrSpace::isBigEndian().

void MemoryImage::getPage ( uintb  addr,
uint1 *  res,
int4  skip,
int4  size 
) const
protectedvirtual

Overridded getPage method.

Retrieve an aligned page from the bank. First an attempt is made to retrieve the page from the LoadImage, which may do its own zero filling. If the attempt fails, the page is entirely filled in with zeros.

Reimplemented from MemoryBank.

References MemoryBank::getSpace().


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