|
Ghidra 11.4.2
Ghidra internal decompiler documentation.
|
A memory bank that implements reads and writes using a hash table. More...
#include <memstate.hh>
Public Member Functions | |
| MemoryHashOverlay (AddrSpace *spc, int4 ws, int4 ps, int4 hashsize, MemoryBank *ul) | |
| Constructor for hash overlay. | |
Public Member Functions inherited from ghidra::MemoryBank | |
| MemoryBank (AddrSpace *spc, int4 ws, int4 ps) | |
| Generic constructor for a memory bank. | |
| int4 | getWordSize (void) const |
| Get the number of bytes in a word for this memory bank. | |
| int4 | getPageSize (void) const |
| Get the number of bytes in a page for this memory bank. | |
| AddrSpace * | getSpace (void) const |
| Get the address space associated with this memory bank. | |
| void | setValue (uintb offset, int4 size, uintb val) |
| Set the value of a (small) range of bytes. | |
| uintb | getValue (uintb offset, int4 size) const |
| Retrieve the value encoded in a (small) range of bytes. | |
| void | setChunk (uintb offset, int4 size, const uint1 *val) |
| Set values of an arbitrary sequence of bytes. | |
| void | getChunk (uintb offset, int4 size, uint1 *res) const |
| Retrieve an arbitrary sequence of bytes. | |
Protected Member Functions | |
| virtual void | insert (uintb addr, uintb val) |
| Overridden aligned word insert. | |
| virtual uintb | find (uintb addr) const |
| Overridden aligned word find. | |
Protected Member Functions inherited from ghidra::MemoryBank | |
| virtual void | getPage (uintb addr, uint1 *res, int4 skip, int4 size) const |
| Retrieve data from a memory page. | |
| virtual void | setPage (uintb addr, const uint1 *val, int4 skip, int4 size) |
| Write data into a memory page. | |
Private Attributes | |
| MemoryBank * | underlie |
| Underlying memory bank. | |
| int4 | alignshift |
| How many LSBs are thrown away from address when doing hash table lookup. | |
| uintb | collideskip |
| How many slots to skip after a hashtable collision. | |
| vector< uintb > | address |
| The hashtable addresses. | |
| vector< uintb > | value |
| The hashtable values. | |
Additional Inherited Members | |
Static Public Member Functions inherited from ghidra::MemoryBank | |
| static uintb | constructValue (const uint1 *ptr, int4 size, bool bigendian) |
| Decode bytes to value. | |
| static void | deconstructValue (uint1 *ptr, uintb val, int4 size, bool bigendian) |
| Encode value to bytes. | |
A memory bank that implements reads and writes using a hash table.
The initial state of the bank is taken from an underlying memory bank or is all zero, if this bank is initialized with a null pointer. This implementation will not be very efficient for accessing entire pages.
| ghidra::MemoryHashOverlay::MemoryHashOverlay | ( | AddrSpace * | spc, |
| int4 | ws, | ||
| int4 | ps, | ||
| int4 | hashsize, | ||
| MemoryBank * | ul | ||
| ) |
Constructor for hash overlay.
A MemoryBank implemented as a hash table needs everything associated with a generic memory bank, but the constructor also needs to know the size of the hashtable and the underlying memorybank to forward reads and writes to.
| spc | is the address space associated with the memory bank |
| ws | is the number of bytes in the preferred wordsize (must be power of 2) |
| ps | is the number of bytes in a page (must be a power of 2) |
| hashsize | is the maximum number of entries in the hashtable |
| ul | is the underlying memory bank being overlayed |
References alignshift, collideskip, and underlie.
|
protectedvirtual |
Overridden aligned word find.
First search for an entry in the hashtable using addr as a key. If there is no entry, forward the query to the underlying memory bank, or return 0 if there is no underlying bank
| addr | is the aligned address of the word to retrieve |
Implements ghidra::MemoryBank.
References address, alignshift, collideskip, ghidra::MemoryBank::find(), underlie, and value.
|
protectedvirtual |
Overridden aligned word insert.
Write the value into the hashtable, using addr as a key.
| addr | is the aligned address of the word being written |
| val | is the value of the word to write |
Implements ghidra::MemoryBank.
References address, alignshift, collideskip, and value.