gem5
v20.1.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. More... | |
bool | hasHostBuf () const |
Check if the virtual memory area has an equivalent buffer on the host machine. More... | |
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. More... | |
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. More... | |
void | sliceRegionRight (Addr slice_addr) |
Remove the address range to the right of slice_addr. More... | |
void | sliceRegionLeft (Addr slice_addr) |
Remove the address range to the left of slice_addr. More... | |
const std::string & | getName () |
Addr | size () |
Defer AddrRange related calls to the AddrRange. More... | |
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. More... | |
Addr | _pageBytes |
Number of bytes in an OS page. More... | |
std::shared_ptr< MappedFileBuffer > | _origHostBuf |
The host file backing will be chopped up and reassigned as pages are mapped, remapped, and unmapped. More... | |
void * | _hostBuf |
Host buffer ptr for this virtual memory area. More... | |
uint64_t | _hostBufLen |
Length of host buffer for this virtual memory area. More... | |
std::string | _vmaName |
Human-readable name associated with the virtual memory area. More... | |
|
inline |
Definition at line 45 of file vma.hh.
References _hostBuf, _hostBufLen, _origHostBuf, DPRINTF, ArmISA::fd, MipsISA::r, and sanityCheck().
|
inline |
Definition at line 132 of file vma.hh.
References _addrRange, ArmISA::a, and AddrRange::contains().
|
inline |
Definition at line 111 of file vma.hh.
References _addrRange, and 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 38 of file vma.cc.
References _addrRange, _hostBuf, _hostBufLen, _pageBytes, ArmISA::offset, size(), start(), AddrRange::start(), and PortProxy::writeBlob().
|
inline |
|
inline |
Check if the virtual memory area has an equivalent buffer on the host machine.
Definition at line 80 of file vma.hh.
References _origHostBuf.
Referenced by sliceRegionLeft(), and sliceRegionRight().
|
inline |
Definition at line 120 of file vma.hh.
References _addrRange, AddrRange::intersects(), and MipsISA::r.
bool 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 52 of file vma.cc.
References _addrRange, AddrRange::end(), MipsISA::r, and AddrRange::start().
|
inline |
Definition at line 126 of file vma.hh.
References _addrRange, AddrRange::isSubset(), and MipsISA::r.
|
inline |
Definition at line 114 of file vma.hh.
References _addrRange, AddrRange::mergesWith(), and MipsISA::r.
|
inline |
Remap the virtual memory area starting at new_start.
Definition at line 66 of file vma.hh.
References _addrRange, DPRINTF, AddrRange::end(), sanityCheck(), AddrRange::size(), and 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 99 of file vma.cc.
References _addrRange, _pageBytes, AddrRange::end(), and AddrRange::start().
Referenced by remap(), sliceRegionLeft(), sliceRegionRight(), and VMA().
|
inline |
Defer AddrRange related calls to the AddrRange.
Definition at line 109 of file vma.hh.
References _addrRange, and AddrRange::size().
Referenced by fillMemPages().
void VMA::sliceRegionLeft | ( | Addr | slice_addr | ) |
Remove the address range to the left of slice_addr.
Definition at line 74 of file vma.cc.
References _addrRange, _hostBuf, _hostBufLen, _origHostBuf, DPRINTF, AddrRange::end(), hasHostBuf(), sanityCheck(), and AddrRange::start().
void VMA::sliceRegionRight | ( | Addr | slice_addr | ) |
Remove the address range to the right of slice_addr.
Definition at line 58 of file vma.cc.
References _addrRange, _hostBufLen, DPRINTF, AddrRange::end(), hasHostBuf(), sanityCheck(), and AddrRange::start().
|
inline |
Definition at line 110 of file vma.hh.
References _addrRange, and AddrRange::start().
Referenced by fillMemPages().
|
private |
Address range for this virtual memory area.
Definition at line 143 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 162 of file vma.hh.
Referenced by fillMemPages(), sliceRegionLeft(), and VMA().
|
private |
Length of host buffer for this virtual memory area.
Definition at line 167 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 157 of file vma.hh.
Referenced by hasHostBuf(), sliceRegionLeft(), and VMA().
|
private |
Number of bytes in an OS page.
Definition at line 148 of file vma.hh.
Referenced by fillMemPages(), and sanityCheck().
|
private |