32 #ifndef __BASE_LOADER_MEMORY_IMAGE_HH__ 33 #define __BASE_LOADER_MEMORY_IMAGE_HH__ 37 #include <initializer_list> 54 const uint8_t *_data,
size_t _size) :
67 "Segment outside the bounds of the image data");
78 const uint8_t *
data =
nullptr;
108 _segments.emplace_back(seg);
114 for (
auto &
seg: segs)
134 for (
auto &
seg: _segments)
135 max = std::max(max,
seg.base +
seg.size);
143 for (
auto &
seg: _segments)
144 min = std::min(min,
seg.base);
151 for (
auto &
seg: _segments) {
154 if (addr >= start && addr < end)
161 static inline std::ostream &
169 #endif // __BASE_LOADER_MEMORY_IMAGE_HH__ void ccprintf(cp::Print &print)
MemoryImage & move(std::function< Addr(Addr)> mapper)
Segment(const std::string &_name, Addr _base, const uint8_t *_data, size_t _size)
bool write(const PortProxy &proxy) const
MemoryImage(std::initializer_list< Segment > segs)
std::vector< Segment > _segments
MemoryImage(const Segment &seg)
Segment(const std::string &_name, const ImageFileDataPtr &_ifd)
static std::ostream & operator<<(std::ostream &os, const MemoryImage::Segment &seg)
const std::vector< Segment > & segments() const
void addSegments(std::initializer_list< Segment > segs)
bool contains(Addr addr) const
MemoryImage & offset(Addr by)
Segment(const std::string &_name, Addr _base, size_t _size)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Segment(const std::string &_name, Addr _base, const ImageFileDataPtr &_ifd, Addr offset, size_t _size)
This object is a proxy for a port or other object which implements the functional response protocol...
MemoryImage & mask(Addr m)
void addSegment(const Segment &seg)
std::shared_ptr< ImageFileData > ImageFileDataPtr
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
bool writeSegment(const Segment &seg, const PortProxy &proxy) const