gem5  v21.1.0.2
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
gem5::PortProxy Class Reference

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>

Inheritance diagram for gem5::PortProxy:
gem5::FunctionalRequestProtocol gem5::TranslatingPortProxy gem5::SETranslatingPortProxy

Public Types

typedef std::function< void(PacketPtr pkt)> SendFunctionalFunc
 

Public Member Functions

 PortProxy (SendFunctionalFunc func, unsigned int cache_line_size)
 
 PortProxy (ThreadContext *tc, unsigned int cache_line_size)
 
 PortProxy (const RequestPort &port, unsigned int cache_line_size)
 
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 >
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 >
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 gem5::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...
 

Detailed Description

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.

See also
SETranslatingProxy
FSTranslatingProxy

Definition at line 86 of file port_proxy.hh.

Member Typedef Documentation

◆ SendFunctionalFunc

typedef std::function<void(PacketPtr pkt)> gem5::PortProxy::SendFunctionalFunc

Definition at line 89 of file port_proxy.hh.

Constructor & Destructor Documentation

◆ PortProxy() [1/3]

gem5::PortProxy::PortProxy ( SendFunctionalFunc  func,
unsigned int  cache_line_size 
)
inline

Definition at line 106 of file port_proxy.hh.

◆ PortProxy() [2/3]

gem5::PortProxy::PortProxy ( ThreadContext tc,
unsigned int  cache_line_size 
)

Definition at line 47 of file port_proxy.cc.

References gem5::ThreadContext::sendFunctional().

◆ PortProxy() [3/3]

gem5::PortProxy::PortProxy ( const RequestPort port,
unsigned int  cache_line_size 
)

Definition at line 52 of file port_proxy.cc.

References gem5::RequestPort::sendFunctional().

◆ ~PortProxy()

virtual gem5::PortProxy::~PortProxy ( )
inlinevirtual

Definition at line 114 of file port_proxy.hh.

Member Function Documentation

◆ memsetBlob()

void gem5::PortProxy::memsetBlob ( Addr  addr,
uint8_t  v,
int  size 
) const
inline

Same as tryMemsetBlob, but insists on success.

Definition at line 202 of file port_proxy.hh.

References gem5::X86ISA::addr, fatal, tryMemsetBlob(), and gem5::ArmISA::v.

Referenced by gem5::Gicv3Its::moveAllPendingState(), and gem5::loader::MemoryImage::writeSegment().

◆ memsetBlobPhys()

void gem5::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 92 of file port_proxy.cc.

References gem5::X86ISA::addr, gem5::ArmISA::v, and writeBlobPhys().

Referenced by gem5::TranslatingPortProxy::tryMemsetBlob(), and tryMemsetBlob().

◆ read() [1/2]

template<typename T >
T gem5::PortProxy::read ( Addr  address) const

◆ read() [2/2]

template<typename T >
T gem5::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 303 of file port_proxy.hh.

References data, gem5::gtoh(), and readBlob().

◆ readBlob()

void gem5::PortProxy::readBlob ( Addr  addr,
void *  p,
int  size 
) const
inline

◆ readBlobPhys()

void gem5::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 58 of file port_proxy.cc.

References _cacheLineSize, gem5::X86ISA::addr, gem5::Packet::dataStatic(), gem5::ChunkGenerator::done(), gem5::Request::funcRequestorId, gem5::MipsISA::p, gem5::MemCmd::ReadReq, and sendFunctional.

Referenced by gem5::TranslatingPortProxy::tryReadBlob(), and tryReadBlob().

◆ readString() [1/2]

void gem5::PortProxy::readString ( char *  str,
Addr  addr,
size_t  maxlen 
) const
inline

Same as tryReadString, but insists on success.

Definition at line 277 of file port_proxy.hh.

References gem5::X86ISA::addr, fatal, and tryReadString().

◆ readString() [2/2]

void gem5::PortProxy::readString ( std::string &  str,
Addr  addr 
) const
inline

◆ recvFunctionalSnoop()

void gem5::PortProxy::recvFunctionalSnoop ( PacketPtr  pkt)
inlineoverrideprivatevirtual

Receive a functional snoop request packet from the peer.

Implements gem5::FunctionalRequestProtocol.

Definition at line 98 of file port_proxy.hh.

References panic.

◆ tryMemsetBlob()

virtual bool gem5::PortProxy::tryMemsetBlob ( Addr  addr,
uint8_t  val,
int  size 
) const
inlinevirtual

Fill size bytes starting at addr with byte value val.

Returns true on success and false on failure.

Reimplemented in gem5::TranslatingPortProxy.

Definition at line 168 of file port_proxy.hh.

References gem5::X86ISA::addr, memsetBlobPhys(), and gem5::X86ISA::val.

Referenced by memsetBlob().

◆ tryReadBlob()

virtual bool gem5::PortProxy::tryReadBlob ( Addr  addr,
void *  p,
int  size 
) const
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 gem5::TranslatingPortProxy.

Definition at line 146 of file port_proxy.hh.

References gem5::X86ISA::addr, gem5::MipsISA::p, and readBlobPhys().

Referenced by readBlob(), and tryReadString().

◆ tryReadString() [1/2]

bool gem5::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 128 of file port_proxy.cc.

References gem5::X86ISA::addr, and tryReadBlob().

◆ tryReadString() [2/2]

bool gem5::PortProxy::tryReadString ( std::string &  str,
Addr  addr 
) const

◆ tryWriteBlob()

virtual bool gem5::PortProxy::tryWriteBlob ( Addr  addr,
const void *  p,
int  size 
) const
inlinevirtual

Write size bytes from p to address.

Returns true on success and false on failure.

Reimplemented in gem5::TranslatingPortProxy.

Definition at line 157 of file port_proxy.hh.

References gem5::X86ISA::addr, gem5::MipsISA::p, and writeBlobPhys().

Referenced by gem5::SparcISA::SEWorkload::flushWindows(), tryWriteString(), and writeBlob().

◆ tryWriteString()

bool gem5::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 105 of file port_proxy.cc.

References gem5::X86ISA::addr, and tryWriteBlob().

Referenced by writeString().

◆ write() [1/2]

template<typename T >
void gem5::PortProxy::write ( Addr  address,
const T &  data 
) const

Write object T to address.

Writes sizeof(T) bytes.

Definition at line 296 of file port_proxy.hh.

References data, and writeBlob().

Referenced by gem5::ArmSemihosting::callHeapInfo32(), and gem5::ArmSemihosting::callHeapInfo64().

◆ write() [2/2]

template<typename T >
void gem5::PortProxy::write ( Addr  address,
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 312 of file port_proxy.hh.

References data, gem5::htog(), and writeBlob().

◆ writeBlob()

void gem5::PortProxy::writeBlob ( Addr  addr,
const void *  p,
int  size 
) const
inline

Same as tryWriteBlob, but insists on success.

Definition at line 192 of file port_proxy.hh.

References gem5::X86ISA::addr, fatal, gem5::MipsISA::p, and tryWriteBlob().

Referenced by gem5::ArmSemihosting::callGetCmdLine(), gem5::ArmSemihosting::callRead(), gem5::ArmSemihosting::callTmpNam(), gem5::BaseBufferArg::copyOut(), gem5::copyStringArray(), gem5::VMA::fillMemPages(), gem5::ArmLinuxProcess32::initState(), gem5::X86ISA::FsWorkload::initState(), gem5::ArmISA::FsLinux::initState(), gem5::X86ISA::X86_64Process::initState(), gem5::Gicv3Its::moveAllPendingState(), gem5::SimpleDisk::read(), gem5::pseudo_inst::readfile(), gem5::readvFunc(), gem5::Process::replicatePage(), gem5::ArmISA::setTLSFunc32(), gem5::X86ISA::ACPI::RSDP::write(), gem5::VirtDescriptor::write(), write(), gem5::BaseRemoteGDB::write(), gem5::VirtQueue::VirtRing< struct vring_used_elem >::write(), gem5::X86ISA::ACPI::SysDescTable::writeBuf(), gem5::Gicv3Redistributor::writeEntryLPI(), gem5::VirtQueue::VirtRing< struct vring_used_elem >::writeHeader(), gem5::X86ISA::smbios::SMBiosStructure::writeOut(), gem5::X86ISA::intelmp::FloatingPointer::writeOut(), gem5::X86ISA::intelmp::BaseConfigEntry::writeOut(), gem5::X86ISA::intelmp::ExtConfigEntry::writeOut(), gem5::X86ISA::smbios::BiosInformation::writeOut(), gem5::X86ISA::intelmp::ConfigTable::writeOut(), gem5::X86ISA::intelmp::Processor::writeOut(), gem5::X86ISA::smbios::SMBiosTable::writeOut(), gem5::X86ISA::intelmp::BusHierarchy::writeOut(), gem5::writeOutField(), gem5::writeOutString(), gem5::X86ISA::smbios::SMBiosStructure::writeOutStrings(), gem5::loader::MemoryImage::writeSegment(), gem5::X86ISA::E820Table::writeTo(), and gem5::writeVal().

◆ writeBlobPhys()

void gem5::PortProxy::writeBlobPhys ( Addr  addr,
Request::Flags  flags,
const void *  p,
int  size 
) const

◆ writeString()

void gem5::PortProxy::writeString ( Addr  addr,
const char *  str 
) const
inline

Same as tryWriteString, but insists on success.

Definition at line 244 of file port_proxy.hh.

References gem5::X86ISA::addr, fatal, and tryWriteString().

Referenced by gem5::copyStringArray().

Member Data Documentation

◆ _cacheLineSize

const unsigned int gem5::PortProxy::_cacheLineSize
private

Granularity of any transactions issued through this proxy.

Definition at line 95 of file port_proxy.hh.

Referenced by readBlobPhys(), and writeBlobPhys().

◆ sendFunctional

SendFunctionalFunc gem5::PortProxy::sendFunctional
private

Definition at line 92 of file port_proxy.hh.

Referenced by readBlobPhys(), and writeBlobPhys().


The documentation for this class was generated from the following files:

Generated on Tue Sep 21 2021 12:27:58 for gem5 by doxygen 1.8.17