123 : _buffer(nullptr), _length(length), _offset(
offset)
127 struct stat file_stat;
128 if (fstat(
fd, &file_stat) > 0) {
129 panic(
"Cannot stat file: %s\n", strerror(errno));
134 "Tried to mmap with offset greater than file size");
142 panic(
"Failed to map file into host address space: %s",
146 panic(
"Tried to mmap 0 bytes");
153 panic_if(munmap(_buffer, _length) == -1,
154 "mmap: failed to unmap file-backed host memory: %s",
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
This object is a proxy for a port or other object which implements the functional response protocol,...
void writeBlob(Addr addr, const void *p, uint64_t size) const
Same as tryWriteBlob, but insists on success.
MappedFileBuffer(int fd, size_t length, off_t offset)
Addr size()
Defer AddrRange related calls to the AddrRange.
Addr _pageBytes
Number of bytes in an OS page.
void sliceRegionLeft(Addr slice_addr)
Remove the address range to the left of slice_addr.
void fillMemPages(Addr start, Addr size, PortProxy &port) const
Copy memory from a buffer which resides on the host machine into a section of memory on the target.
uint64_t _hostBufLen
Length of host buffer for this virtual memory area.
bool isStrictSuperset(const AddrRange &range) const
Returns true if desired range exists within this virtual memory area and does not include the start a...
AddrRange _addrRange
Address range for this virtual memory area.
void * _hostBuf
Host buffer ptr for this virtual memory area.
std::shared_ptr< MappedFileBuffer > _origHostBuf
The host file backing will be chopped up and reassigned as pages are mapped, remapped,...
bool hasHostBuf() const
Check if the virtual memory area has an equivalent buffer on the host machine.
void sliceRegionRight(Addr slice_addr)
Remove the address range to the right of slice_addr.
Addr end() const
Get the end address of the range.
Addr start() const
Get the start address of the range.
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.