29 #ifndef __BASE_LOADER_MEMORY_IMAGE_HH__ 30 #define __BASE_LOADER_MEMORY_IMAGE_HH__ 34 #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 &
170 #endif // __BASE_LOADER_MEMORY_IMAGE_HH__ void ccprintf(cp::Print &print)
Segment(const std::string &_name, Addr _base, const ImageFileDataPtr &_ifd, Addr offset, size_t _size)
Segment(const std::string &_name, Addr _base, size_t _size)
Segment(const std::string &_name, Addr _base, const uint8_t *_data, size_t _size)
MemoryImage & mask(Addr m)
void addSegments(std::initializer_list< Segment > segs)
MemoryImage & move(std::function< Addr(Addr)> mapper)
std::shared_ptr< ImageFileData > ImageFileDataPtr
bool write(const PortProxy &proxy) const
MemoryImage & offset(Addr by)
std::vector< Segment > _segments
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, const ImageFileDataPtr &_ifd)
MemoryImage(std::initializer_list< Segment > segs)
const std::vector< Segment > & segments() const
bool writeSegment(const Segment &seg, const PortProxy &proxy) const
void addSegment(const Segment &seg)
This object is a proxy for a port or other object which implements the functional response protocol...
static std::ostream & operator<<(std::ostream &os, const MemoryImage::Segment &seg)
bool contains(Addr addr) const
MemoryImage(const Segment &seg)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...