gem5
v20.1.0.0
|
This object is a proxy for a port or other object which implements the functional response protocol, to be used for debug accesses. More...
#include <port_proxy.hh>
Public Types | |
typedef std::function< void(PacketPtr pkt)> | SendFunctionalFunc |
Public Member Functions | |
PortProxy (SendFunctionalFunc func, unsigned int cacheLineSize) | |
PortProxy (const RequestPort &port, unsigned int cacheLineSize) | |
virtual | ~PortProxy () |
void | readBlobPhys (Addr addr, Request::Flags flags, void *p, int size) const |
Fixed functionality for use in base classes. More... | |
void | writeBlobPhys (Addr addr, Request::Flags flags, const void *p, int size) const |
Write size bytes from p to physical address. More... | |
void | memsetBlobPhys (Addr addr, Request::Flags flags, uint8_t v, int size) const |
Fill size bytes starting at physical addr with byte value val. More... | |
virtual bool | tryReadBlob (Addr addr, void *p, int size) const |
Methods to override in base classes. More... | |
virtual bool | tryWriteBlob (Addr addr, const void *p, int size) const |
Write size bytes from p to address. More... | |
virtual bool | tryMemsetBlob (Addr addr, uint8_t val, int size) const |
Fill size bytes starting at addr with byte value val. More... | |
void | readBlob (Addr addr, void *p, int size) const |
Higher level interfaces based on the above. More... | |
void | writeBlob (Addr addr, const void *p, int size) const |
Same as tryWriteBlob, but insists on success. More... | |
void | memsetBlob (Addr addr, uint8_t v, int size) const |
Same as tryMemsetBlob, but insists on success. More... | |
template<typename T > | |
T | read (Addr address) const |
Read sizeof(T) bytes from address and return as object T. More... | |
template<typename T > | |
void | write (Addr address, const T &data) const |
Write object T to address. More... | |
template<typename T > | |
T | read (Addr address, ByteOrder guest_byte_order) const |
Read sizeof(T) bytes from address and return as object T. More... | |
template<typename T > | |
void | write (Addr address, T data, ByteOrder guest_byte_order) const |
Write object T to address. More... | |
bool | tryWriteString (Addr addr, const char *str) const |
Write the string str into guest memory at address addr. More... | |
void | writeString (Addr addr, const char *str) const |
Same as tryWriteString, but insists on success. More... | |
bool | tryReadString (std::string &str, Addr addr) const |
Reads the string at guest address addr into the std::string str. More... | |
void | readString (std::string &str, Addr addr) const |
Same as tryReadString, but insists on success. More... | |
bool | tryReadString (char *str, Addr addr, size_t maxlen) const |
Reads the string at guest address addr into the char * str, reading up to maxlen characters. More... | |
void | readString (char *str, Addr addr, size_t maxlen) const |
Same as tryReadString, but insists on success. More... | |
Private Member Functions | |
void | recvFunctionalSnoop (PacketPtr pkt) override |
Receive a functional snoop request packet from the peer. More... | |
Private Member Functions inherited from FunctionalRequestProtocol | |
void | send (FunctionalResponseProtocol *peer, PacketPtr pkt) const |
Send a functional request packet, where the data is instantly updated everywhere in the memory system, without affecting the current state of any block or moving the block. More... | |
Private Attributes | |
SendFunctionalFunc | sendFunctional |
const unsigned int | _cacheLineSize |
Granularity of any transactions issued through this proxy. More... | |
This object is a proxy for a port or other object which implements the functional response protocol, to be used for debug accesses.
This proxy object is used when non structural entities (e.g. thread contexts, object file loaders) need access to the memory system. It calls the corresponding functions on the underlying protocol, and provides templatized convenience access functions.
The addresses are interpreted as physical addresses.
Definition at line 80 of file port_proxy.hh.
typedef std::function<void(PacketPtr pkt)> PortProxy::SendFunctionalFunc |
Definition at line 83 of file port_proxy.hh.
|
inline |
Definition at line 100 of file port_proxy.hh.
|
inline |
Definition at line 103 of file port_proxy.hh.
References RequestPort::sendFunctional().
|
inlinevirtual |
Definition at line 108 of file port_proxy.hh.
|
inline |
Same as tryMemsetBlob, but insists on success.
Definition at line 197 of file port_proxy.hh.
References addr, fatal, tryMemsetBlob(), and ArmISA::v.
Referenced by Gicv3Its::moveAllPendingState(), and Loader::MemoryImage::writeSegment().
void PortProxy::memsetBlobPhys | ( | Addr | addr, |
Request::Flags | flags, | ||
uint8_t | v, | ||
int | size | ||
) | const |
Fill size bytes starting at physical addr with byte value val.
Definition at line 77 of file port_proxy.cc.
References addr, ArmISA::v, and writeBlobPhys().
Referenced by TranslatingPortProxy::tryMemsetBlob(), and tryMemsetBlob().
T PortProxy::read | ( | Addr | address | ) | const |
Read sizeof(T) bytes from address and return as object T.
Definition at line 282 of file port_proxy.hh.
References data, and readBlob().
Referenced by ArmSemihosting::callWriteC(), Linux::ThreadInfo::curTaskInfo(), Linux::ThreadInfo::curTaskMmFromTaskStruct(), Linux::ThreadInfo::curTaskPIDFromTaskStruct(), Linux::ThreadInfo::curTaskStartFromTaskStruct(), Linux::ThreadInfo::curTaskTGIDFromTaskStruct(), ArmSemihosting::AbiBase::StateBase< Arg >::get(), Linux::ThreadInfo::get_data(), SparcISA::getArgument(), and ArmISA::getArgument().
T PortProxy::read | ( | Addr | address, |
ByteOrder | guest_byte_order | ||
) | const |
Read sizeof(T) bytes from address and return as object T.
Performs endianness conversion from the selected guest to host order.
Definition at line 298 of file port_proxy.hh.
References data, gtoh(), and readBlob().
|
inline |
Higher level interfaces based on the above.
Same as tryReadBlob, but insists on success.
Definition at line 177 of file port_proxy.hh.
References addr, fatal, MipsISA::p, and tryReadBlob().
Referenced by ArmSemihosting::callWrite(), BaseBufferArg::copyIn(), GuestABI::Argument< Aapcs32, Composite, typename std::enable_if< IsAapcs32Composite< Composite >::value >::type >::get(), X86ISA::m5PageFault(), Gicv3Its::moveAllPendingState(), VirtDescriptor::read(), read(), BaseRemoteGDB::read(), VirtQueue::VirtRing< struct vring_used_elem >::read(), Gicv3Redistributor::readEntryLPI(), VirtQueue::VirtRing< struct vring_used_elem >::readHeader(), Trace::TarmacParserRecord::readMemNoEffect(), ArmSemihosting::readString(), readvFunc(), Process::replicatePage(), DmaReadFifo::resumeFillFunctional(), VirtDescriptor::update(), Gicv3Redistributor::update(), PseudoInst::writefile(), and writevFunc().
void PortProxy::readBlobPhys | ( | Addr | addr, |
Request::Flags | flags, | ||
void * | p, | ||
int | size | ||
) | const |
Fixed functionality for use in base classes.
Read size bytes memory at physical address and store in p.
Definition at line 43 of file port_proxy.cc.
References _cacheLineSize, addr, Packet::dataStatic(), ChunkGenerator::done(), Request::funcRequestorId, MipsISA::p, MemCmd::ReadReq, and sendFunctional.
Referenced by TranslatingPortProxy::tryReadBlob(), and tryReadBlob().
|
inline |
Same as tryReadString, but insists on success.
Definition at line 272 of file port_proxy.hh.
References addr, fatal, and tryReadString().
|
inline |
Same as tryReadString, but insists on success.
Definition at line 255 of file port_proxy.hh.
References addr, fatal, and tryReadString().
Referenced by PseudoInst::addsymbol(), ArmSemihosting::callWrite0(), Linux::ThreadInfo::curTaskNameFromTaskStruct(), Linux::printk(), and PseudoInst::writefile().
|
inlineoverrideprivatevirtual |
Receive a functional snoop request packet from the peer.
Implements FunctionalRequestProtocol.
Definition at line 92 of file port_proxy.hh.
References panic.
|
inlinevirtual |
Fill size bytes starting at addr with byte value val.
Returns true on success and false on failure.
Reimplemented in TranslatingPortProxy.
Definition at line 163 of file port_proxy.hh.
References addr, memsetBlobPhys(), and X86ISA::val.
Referenced by memsetBlob().
|
inlinevirtual |
Methods to override in base classes.
Read size bytes memory at address and store in p. Returns true on success and false on failure.
Reimplemented in TranslatingPortProxy.
Definition at line 141 of file port_proxy.hh.
References addr, MipsISA::p, and readBlobPhys().
Referenced by readBlob(), and tryReadString().
bool PortProxy::tryReadString | ( | char * | str, |
Addr | addr, | ||
size_t | maxlen | ||
) | const |
Reads the string at guest address addr into the char * str, reading up to maxlen characters.
The last character read is always a nul terminator. Returns true on success and false on failure.
Definition at line 113 of file port_proxy.cc.
References addr, and tryReadBlob().
bool PortProxy::tryReadString | ( | std::string & | str, |
Addr | addr | ||
) | const |
Reads the string at guest address addr into the std::string str.
Returns true on success and false on failure.
Definition at line 100 of file port_proxy.cc.
References addr, ArmISA::c, and tryReadBlob().
Referenced by accessFunc(), chdirFunc(), chmodFunc(), chownFunc(), execveFunc(), fstatat64Func(), lstat64Func(), lstatFunc(), mkdirFunc(), mknodFunc(), openatFunc(), readlinkFunc(), readString(), renameFunc(), rmdirFunc(), stat64Func(), statfsFunc(), statFunc(), truncate64Func(), truncateFunc(), unlinkFunc(), and utimesFunc().
|
inlinevirtual |
Write size bytes from p to address.
Returns true on success and false on failure.
Reimplemented in TranslatingPortProxy.
Definition at line 152 of file port_proxy.hh.
References addr, MipsISA::p, and writeBlobPhys().
Referenced by Sparc32Process::flushWindows(), Sparc64Process::flushWindows(), tryWriteString(), and writeBlob().
bool PortProxy::tryWriteString | ( | Addr | addr, |
const char * | str | ||
) | const |
Write the string str into guest memory at address addr.
Returns true on success and false on failure.
Definition at line 90 of file port_proxy.cc.
References addr, and tryWriteBlob().
Referenced by writeString().
void PortProxy::write | ( | Addr | address, |
const T & | data | ||
) | const |
Write object T to address.
Writes sizeof(T) bytes.
Definition at line 291 of file port_proxy.hh.
References data, and writeBlob().
Referenced by ArmSemihosting::callHeapInfo32(), and ArmSemihosting::callHeapInfo64().
void PortProxy::write | ( | Addr | address, |
T | data, | ||
ByteOrder | guest_byte_order | ||
) | const |
Write object T to address.
Writes sizeof(T) bytes. Performs endianness conversion from host to the selected guest order.
Definition at line 307 of file port_proxy.hh.
References data, htog(), and writeBlob().
|
inline |
Same as tryWriteBlob, but insists on success.
Definition at line 187 of file port_proxy.hh.
References addr, fatal, MipsISA::p, and tryWriteBlob().
Referenced by ArmSemihosting::callGetCmdLine(), ArmSemihosting::callRead(), ArmSemihosting::callTmpNam(), BaseBufferArg::copyOut(), copyStringArray(), VMA::fillMemPages(), ArmLinuxProcess32::initState(), X86ISA::FsWorkload::initState(), ArmISA::FsLinux::initState(), X86ISA::X86_64Process::initState(), Gicv3Its::moveAllPendingState(), SimpleDisk::read(), PseudoInst::readfile(), readvFunc(), Process::replicatePage(), setTLSFunc32(), VirtDescriptor::write(), write(), BaseRemoteGDB::write(), VirtQueue::VirtRing< struct vring_used_elem >::write(), Gicv3Redistributor::writeEntryLPI(), VirtQueue::VirtRing< struct vring_used_elem >::writeHeader(), X86ISA::SMBios::SMBiosStructure::writeOut(), X86ISA::IntelMP::FloatingPointer::writeOut(), X86ISA::IntelMP::BaseConfigEntry::writeOut(), X86ISA::IntelMP::ExtConfigEntry::writeOut(), X86ISA::SMBios::BiosInformation::writeOut(), X86ISA::IntelMP::ConfigTable::writeOut(), X86ISA::IntelMP::Processor::writeOut(), X86ISA::SMBios::SMBiosTable::writeOut(), X86ISA::IntelMP::BusHierarchy::writeOut(), writeOutField(), writeOutString(), X86ISA::SMBios::SMBiosStructure::writeOutStrings(), Loader::MemoryImage::writeSegment(), X86ISA::E820Table::writeTo(), and writeVal().
void PortProxy::writeBlobPhys | ( | Addr | addr, |
Request::Flags | flags, | ||
const void * | p, | ||
int | size | ||
) | const |
Write size bytes from p to physical address.
Definition at line 60 of file port_proxy.cc.
References _cacheLineSize, addr, Packet::dataStaticConst(), ChunkGenerator::done(), Request::funcRequestorId, MipsISA::p, sendFunctional, and MemCmd::WriteReq.
Referenced by memsetBlobPhys(), TranslatingPortProxy::tryWriteBlob(), and tryWriteBlob().
|
inline |
Same as tryWriteString, but insists on success.
Definition at line 239 of file port_proxy.hh.
References addr, fatal, and tryWriteString().
Referenced by copyStringArray().
|
private |
Granularity of any transactions issued through this proxy.
Definition at line 89 of file port_proxy.hh.
Referenced by readBlobPhys(), and writeBlobPhys().
|
private |
Definition at line 86 of file port_proxy.hh.
Referenced by readBlobPhys(), and writeBlobPhys().