gem5  v22.1.0.0
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.

◆ PortProxy() [3/3]

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

Definition at line 52 of file port_proxy.cc.

◆ ~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::VegaISA::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, flags, and gem5::VegaISA::v.

Referenced by 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 gem5::X86ISA::addr, gem5::Packet::dataStatic(), gem5::ChunkGenerator::done(), flags, and gem5::VegaISA::p.

Referenced by 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::VegaISA::p, and readBlobPhys().

Referenced by readBlob().

◆ 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.

◆ tryReadString() [2/2]

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

References gem5::X86ISA::addr, and gem5::VegaISA::c.

Referenced by gem5::execveFunc(), gem5::linkFunc(), readString(), gem5::renameatFunc(), gem5::renameFunc(), and gem5::symlinkFunc().

◆ 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::VegaISA::p, and writeBlobPhys().

Referenced by 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.

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::VegaISA::p, and tryWriteBlob().

Referenced by gem5::ArmSemihosting::callGetCmdLine(), gem5::ArmSemihosting::callRead(), gem5::ArmSemihosting::callTmpNam(), gem5::BaseBufferArg::copyOut(), gem5::copyStringArray(), gem5::VMA::fillMemPages(), gem5::ArmISA::FsLinux::initState(), gem5::ArmLinuxProcess32::initState(), gem5::X86ISA::FsWorkload::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::VirtQueue::VirtRing< T >::write(), write(), gem5::X86ISA::ACPI::RSDP::write(), gem5::VirtDescriptor::write(), gem5::BaseRemoteGDB::writeBlob(), gem5::X86ISA::ACPI::SysDescTable::writeBuf(), gem5::Gicv3Redistributor::writeEntryLPI(), gem5::VirtQueue::VirtRing< T >::writeHeader(), gem5::X86ISA::intelmp::FloatingPointer::writeOut(), gem5::X86ISA::intelmp::ConfigTable::writeOut(), gem5::X86ISA::smbios::SMBiosStructure::writeOut(), gem5::X86ISA::smbios::BiosInformation::writeOut(), gem5::X86ISA::smbios::SMBiosTable::writeOut(), gem5::X86ISA::intelmp::BaseConfigEntry::writeOut(), gem5::X86ISA::intelmp::ExtConfigEntry::writeOut(), gem5::X86ISA::intelmp::Processor::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

Write size bytes from p to physical address.

Definition at line 75 of file port_proxy.cc.

References gem5::X86ISA::addr, gem5::Packet::dataStaticConst(), gem5::ChunkGenerator::done(), flags, and gem5::VegaISA::p.

Referenced by tryWriteBlob().

◆ 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.

◆ sendFunctional

SendFunctionalFunc gem5::PortProxy::sendFunctional
private

Definition at line 92 of file port_proxy.hh.


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

Generated on Wed Dec 21 2022 10:23:28 for gem5 by doxygen 1.9.1