gem5 v24.0.0.0
Loading...
Searching...
No Matches
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, Addr cache_line_size)
 
 PortProxy (ThreadContext *tc, Addr cache_line_size)
 
 PortProxy (const RequestPort &port, Addr cache_line_size)
 
virtual ~PortProxy ()
 
void readBlobPhys (Addr addr, Request::Flags flags, void *p, uint64_t size) const
 Fixed functionality for use in base classes.
 
void writeBlobPhys (Addr addr, Request::Flags flags, const void *p, uint64_t size) const
 Write size bytes from p to physical address.
 
void memsetBlobPhys (Addr addr, Request::Flags flags, uint8_t v, uint64_t size) const
 Fill size bytes starting at physical addr with byte value val.
 
virtual bool tryReadBlob (Addr addr, void *p, uint64_t size) const
 Methods to override in base classes.
 
virtual bool tryWriteBlob (Addr addr, const void *p, uint64_t size) const
 Write size bytes from p to address.
 
virtual bool tryMemsetBlob (Addr addr, uint8_t val, uint64_t size) const
 Fill size bytes starting at addr with byte value val.
 
void readBlob (Addr addr, void *p, uint64_t size) const
 Higher level interfaces based on the above.
 
void writeBlob (Addr addr, const void *p, uint64_t size) const
 Same as tryWriteBlob, but insists on success.
 
void memsetBlob (Addr addr, uint8_t v, uint64_t size) const
 Same as tryMemsetBlob, but insists on success.
 
template<typename T >
read (Addr address) const
 Read sizeof(T) bytes from address and return as object T.
 
template<typename T >
void write (Addr address, const T &data) const
 Write object T to address.
 
template<typename T >
read (Addr address, ByteOrder guest_byte_order) const
 Read sizeof(T) bytes from address and return as object T.
 
template<typename T >
void write (Addr address, T data, ByteOrder guest_byte_order) const
 Write object T to address.
 
bool tryWriteString (Addr addr, const char *str) const
 Write the string str into guest memory at address addr.
 
void writeString (Addr addr, const char *str) const
 Same as tryWriteString, but insists on success.
 
bool tryReadString (std::string &str, Addr addr) const
 Reads the string at guest address addr into the std::string str.
 
void readString (std::string &str, Addr addr) const
 Same as tryReadString, but insists on success.
 
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.
 
void readString (char *str, Addr addr, size_t maxlen) const
 Same as tryReadString, but insists on success.
 

Private Member Functions

void recvFunctionalSnoop (PacketPtr pkt) override
 Receive a functional snoop request packet from the peer.
 
- 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.
 
void sendMemBackdoorReq (FunctionalResponseProtocol *peer, const MemBackdoorReq &req, MemBackdoorPtr &backdoor)
 Send a request for a back door to a range of memory.
 

Private Attributes

SendFunctionalFunc sendFunctional
 
const Addr _cacheLineSize
 Granularity of any transactions issued through this proxy.
 

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,
Addr cache_line_size )
inline

Definition at line 106 of file port_proxy.hh.

◆ PortProxy() [2/3]

gem5::PortProxy::PortProxy ( ThreadContext * tc,
Addr cache_line_size )

Definition at line 47 of file port_proxy.cc.

◆ PortProxy() [3/3]

gem5::PortProxy::PortProxy ( const RequestPort & port,
Addr 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,
uint64_t 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,
uint64_t 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, and flags.

Referenced by tryMemsetBlob().

◆ read() [1/2]

◆ 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()

◆ readBlobPhys()

void gem5::PortProxy::readBlobPhys ( Addr addr,
Request::Flags flags,
void * p,
uint64_t 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(), and flags.

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,
uint64_t 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,
uint64_t 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 gem5::RiscvSemihosting::isSemihostingEBreak(), and 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 c.

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

◆ tryWriteBlob()

virtual bool gem5::PortProxy::tryWriteBlob ( Addr addr,
const void * p,
uint64_t 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 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::BaseSemihosting::callHeapInfo32(), gem5::BaseSemihosting::callHeapInfo64(), and gem5::BaseSemihosting::InPlaceArg::write().

◆ write() [2/2]

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

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

◆ writeBlob()

void gem5::PortProxy::writeBlob ( Addr addr,
const void * p,
uint64_t 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::BaseSemihosting::callGetCmdLine(), gem5::BaseSemihosting::callRead(), gem5::BaseSemihosting::callTmpNam(), gem5::BaseBufferArg::copyOut(), gem5::copyStringArray(), gem5::VMA::fillMemPages(), gem5::ArmISA::FsLinux::initState(), gem5::ArmLinuxProcess32::initState(), gem5::X86ISA::X86_64Process::initState(), gem5::Gicv3Its::moveAllPendingState(), gem5::SimpleDisk::read(), gem5::pseudo_inst::readfile(), gem5::readvFunc(), gem5::Process::replicatePage(), gem5::ArmISA::setTLSFunc32(), write(), write(), gem5::VirtDescriptor::write(), gem5::VirtQueue::VirtRing< T >::write(), gem5::X86ISA::ACPI::RSDP::write(), gem5::BaseRemoteGDB::writeBlob(), gem5::X86ISA::ACPI::SysDescTable::writeBuf(), gem5::Gicv3Redistributor::writeEntryLPI(), gem5::VirtQueue::VirtRing< T >::writeHeader(), gem5::X86ISA::intelmp::BaseConfigEntry::writeOut(), gem5::X86ISA::intelmp::BusHierarchy::writeOut(), gem5::X86ISA::intelmp::ConfigTable::writeOut(), gem5::X86ISA::intelmp::ExtConfigEntry::writeOut(), gem5::X86ISA::intelmp::FloatingPointer::writeOut(), gem5::X86ISA::intelmp::Processor::writeOut(), gem5::X86ISA::smbios::BiosInformation::writeOut(), gem5::X86ISA::smbios::SMBiosStructure::writeOut(), gem5::X86ISA::smbios::SMBiosTable::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,
uint64_t 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(), and flags.

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 Addr 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 Tue Jun 18 2024 16:24:13 for gem5 by doxygen 1.11.0