1#ifndef ROSE_BinaryAnalysis_Partitioner2_MemoryTable_H
2#define ROSE_BinaryAnalysis_Partitioner2_MemoryTable_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
7#include <Rose/BinaryAnalysis/MemoryMap.h>
8#include <Rose/Constants.h>
11namespace BinaryAnalysis {
12namespace Partitioner2 {
33 using Ptr = std::shared_ptr<Entries>;
42 virtual size_t size()
const = 0;
61 using Ptr = std::shared_ptr<Storage>;
68 virtual std::vector<uint8_t>
read(
Address,
size_t nBytes) = 0;
73 size_t bytesPerEntry_ = 4;
74 size_t maxSkippable_ = 0;
80 size_t nPreEntries_ = 0;
Represents the entries in the table.
virtual bool maybePrepend(const MemoryTable *, Address entryAddr, const std::vector< uint8_t > &bytes)=0
Parse a table entry and prepend to this list if the entry is valid.
virtual bool maybeAppend(const MemoryTable *, Address entryAddr, const std::vector< uint8_t > &bytes)=0
Parse a table entry and append to this list if the entry is valid.
virtual size_t size() const =0
Number of entries stored.
std::shared_ptr< Entries > Ptr
Shared-ownership pointer.
bool empty() const
True if there are no entries.
Represents the storage for the table.
std::shared_ptr< Storage > Ptr
Shared-ownership pointer.
virtual std::vector< uint8_t > read(Address, size_t nBytes)=0
Read some bytes of storage.
Utilities for working with tables.
bool empty() const
Result: True if the table has no valid entries.
static Ptr instance(const AddressInterval &tableLimits, size_t bytesPerEntry, const Entries::Ptr &entries)
Allocating constructor.
size_t nEntries() const
Result: Total number of valid entries scanned into the table.
void maxPreEntries(size_t)
Property: Max number of entries to prepend before the original start of the table.
AddressInterval scan(const MemoryMap::Constraints &, Address probableTableAddr)
Scan the table and return its location.
void tableLimits(const AddressInterval &)
Property: Limits for table location.
size_t bytesPerEntry() const
Property: Bytes per entry.
AddressInterval tableLimits() const
Property: Limits for table location.
size_t maxPreEntries() const
Property: Max number of entries to prepend before the original start of the table.
Entries::Ptr entries() const
Property: Table entries.
MemoryTableConstPtr ConstPtr
Shared ownership pointer.
AddressInterval location() const
Result: Table location in memory.
AddressInterval scan(const PartitionerConstPtr &, const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &, Address probableTableAddr)
Scan the table and return its location.
AddressInterval scan(const Storage::Ptr &, Address probableTableAddr)
Scan the table and return its location.
size_t nPreEntries() const
Result: Number of entries detected before the start of table.
size_t maxInitialSkip() const
Property: Max initial invalid entries.
void maxInitialSkip(size_t)
Property: Max initial invalid entries.
MemoryTablePtr Ptr
Shared ownership pointer.
Constraints are used to select addresses from a memory map.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
std::shared_ptr< MemoryTable > MemoryTablePtr
Shared-ownership pointer for MemoryTable.
std::shared_ptr< const MemoryTable > MemoryTableConstPtr
Shared-ownership pointer for MemoryTable.
std::uint64_t Address
Address.
const size_t UNLIMITED
Effectively unlimited size.