gem5 v24.0.0.0
|
#include <vma.hh>
Classes | |
class | MappedFileBuffer |
MappedFileBuffer is a wrapper around a region of host memory backed by a file. More... | |
Public Member Functions | |
VMA (AddrRange r, Addr page_bytes, const std::string &vma_name="anon", int fd=-1, off_t off=0) | |
void | remap (Addr new_start) |
Remap the virtual memory area starting at new_start. | |
bool | hasHostBuf () const |
Check if the virtual memory area has an equivalent buffer on the host machine. | |
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. | |
bool | isStrictSuperset (const AddrRange &range) const |
Returns true if desired range exists within this virtual memory area and does not include the start and end addresses. | |
void | sliceRegionRight (Addr slice_addr) |
Remove the address range to the right of slice_addr. | |
void | sliceRegionLeft (Addr slice_addr) |
Remove the address range to the left of slice_addr. | |
const std::string & | getName () |
off_t | getFileMappingOffset () const |
Addr | size () |
Defer AddrRange related calls to the AddrRange. | |
Addr | start () |
Addr | end () |
bool | mergesWith (const AddrRange &r) const |
bool | intersects (const AddrRange &r) const |
bool | isSubset (const AddrRange &r) const |
bool | contains (const Addr &a) const |
Private Member Functions | |
void | sanityCheck () |
Private Attributes | |
AddrRange | _addrRange |
Address range for this virtual memory area. | |
Addr | _pageBytes |
Number of bytes in an OS page. | |
std::shared_ptr< MappedFileBuffer > | _origHostBuf |
The host file backing will be chopped up and reassigned as pages are mapped, remapped, and unmapped. | |
void * | _hostBuf |
Host buffer ptr for this virtual memory area. | |
uint64_t | _hostBufLen |
Length of host buffer for this virtual memory area. | |
std::string | _vmaName |
Human-readable name associated with the virtual memory area. | |
|
inline |
Definition at line 48 of file vma.hh.
References _hostBuf, _hostBufLen, _origHostBuf, DPRINTF, gem5::ArmISA::fd, gem5::MipsISA::r, and sanityCheck().
|
inline |
Definition at line 139 of file vma.hh.
References _addrRange, gem5::ArmISA::a, and gem5::AddrRange::contains().
|
inline |
Definition at line 118 of file vma.hh.
References _addrRange, and gem5::AddrRange::end().
Copy memory from a buffer which resides on the host machine into a section of memory on the target.
Try to copy a full page, but don't overrun the size of the file.
Definition at line 40 of file vma.cc.
References _addrRange, _hostBuf, _hostBufLen, _pageBytes, gem5::ArmISA::offset, size(), gem5::AddrRange::start(), start(), and gem5::PortProxy::writeBlob().
|
inline |
Definition at line 108 of file vma.hh.
References _origHostBuf, and hasHostBuf().
|
inline |
|
inline |
Check if the virtual memory area has an equivalent buffer on the host machine.
Definition at line 83 of file vma.hh.
References _origHostBuf.
Referenced by getFileMappingOffset(), sliceRegionLeft(), and sliceRegionRight().
|
inline |
Definition at line 127 of file vma.hh.
References _addrRange, gem5::AddrRange::intersects(), and gem5::MipsISA::r.
bool gem5::VMA::isStrictSuperset | ( | const AddrRange & | range | ) | const |
Returns true if desired range exists within this virtual memory area and does not include the start and end addresses.
Definition at line 54 of file vma.cc.
References _addrRange, gem5::AddrRange::end(), gem5::MipsISA::r, and gem5::AddrRange::start().
|
inline |
Definition at line 133 of file vma.hh.
References _addrRange, gem5::AddrRange::isSubset(), and gem5::MipsISA::r.
|
inline |
Definition at line 121 of file vma.hh.
References _addrRange, gem5::AddrRange::mergesWith(), and gem5::MipsISA::r.
|
inline |
Remap the virtual memory area starting at new_start.
Definition at line 69 of file vma.hh.
References _addrRange, DPRINTF, gem5::AddrRange::end(), sanityCheck(), gem5::AddrRange::size(), and gem5::AddrRange::start().
|
private |
Avoid regions without a length.
Avoid regions with an end point before the start point
Avoid non-aligned regions; we assume in the code that the regions are page aligned so consider this to be a bug.
Definition at line 101 of file vma.cc.
References _addrRange, _pageBytes, gem5::AddrRange::end(), and gem5::AddrRange::start().
Referenced by remap(), sliceRegionLeft(), sliceRegionRight(), and VMA().
|
inline |
Defer AddrRange related calls to the AddrRange.
Definition at line 116 of file vma.hh.
References _addrRange, and gem5::AddrRange::size().
Referenced by fillMemPages().
void gem5::VMA::sliceRegionLeft | ( | Addr | slice_addr | ) |
Remove the address range to the left of slice_addr.
Definition at line 76 of file vma.cc.
References _addrRange, _hostBuf, _hostBufLen, _origHostBuf, DPRINTF, gem5::AddrRange::end(), hasHostBuf(), sanityCheck(), and gem5::AddrRange::start().
void gem5::VMA::sliceRegionRight | ( | Addr | slice_addr | ) |
Remove the address range to the right of slice_addr.
Definition at line 60 of file vma.cc.
References _addrRange, _hostBufLen, DPRINTF, gem5::AddrRange::end(), hasHostBuf(), sanityCheck(), and gem5::AddrRange::start().
|
inline |
Definition at line 117 of file vma.hh.
References _addrRange, and gem5::AddrRange::start().
Referenced by fillMemPages().
|
private |
Address range for this virtual memory area.
Definition at line 150 of file vma.hh.
Referenced by contains(), end(), fillMemPages(), intersects(), isStrictSuperset(), isSubset(), mergesWith(), remap(), sanityCheck(), size(), sliceRegionLeft(), sliceRegionRight(), and start().
|
private |
Host buffer ptr for this virtual memory area.
Definition at line 169 of file vma.hh.
Referenced by fillMemPages(), sliceRegionLeft(), and VMA().
|
private |
Length of host buffer for this virtual memory area.
Definition at line 174 of file vma.hh.
Referenced by fillMemPages(), sliceRegionLeft(), sliceRegionRight(), and VMA().
|
private |
The host file backing will be chopped up and reassigned as pages are mapped, remapped, and unmapped.
In addition to the current host pointer and length, each virtual memory area will also keep a reference-counted handle to the original host memory. The last virtual memory area to die cleans up the host memory it handles.
Definition at line 164 of file vma.hh.
Referenced by getFileMappingOffset(), hasHostBuf(), sliceRegionLeft(), and VMA().
|
private |
Number of bytes in an OS page.
Definition at line 155 of file vma.hh.
Referenced by fillMemPages(), and sanityCheck().
|
private |