gem5  v20.1.0.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 PortProxy:
FunctionalRequestProtocol TranslatingPortProxy SETranslatingPortProxy

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 >
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 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 80 of file port_proxy.hh.

Member Typedef Documentation

◆ SendFunctionalFunc

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

Definition at line 83 of file port_proxy.hh.

Constructor & Destructor Documentation

◆ PortProxy() [1/2]

PortProxy::PortProxy ( SendFunctionalFunc  func,
unsigned int  cacheLineSize 
)
inline

Definition at line 100 of file port_proxy.hh.

◆ PortProxy() [2/2]

PortProxy::PortProxy ( const RequestPort port,
unsigned int  cacheLineSize 
)
inline

Definition at line 103 of file port_proxy.hh.

References RequestPort::sendFunctional().

◆ ~PortProxy()

virtual PortProxy::~PortProxy ( )
inlinevirtual

Definition at line 108 of file port_proxy.hh.

Member Function Documentation

◆ memsetBlob()

void PortProxy::memsetBlob ( Addr  addr,
uint8_t  v,
int  size 
) const
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().

◆ memsetBlobPhys()

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

◆ read() [1/2]

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

◆ read() [2/2]

template<typename T >
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().

◆ readBlob()

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

◆ readBlobPhys()

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

◆ readString() [1/2]

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

Same as tryReadString, but insists on success.

Definition at line 272 of file port_proxy.hh.

References addr, fatal, and tryReadString().

◆ readString() [2/2]

void PortProxy::readString ( std::string &  str,
Addr  addr 
) const
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().

◆ recvFunctionalSnoop()

void PortProxy::recvFunctionalSnoop ( PacketPtr  pkt)
inlineoverrideprivatevirtual

Receive a functional snoop request packet from the peer.

Implements FunctionalRequestProtocol.

Definition at line 92 of file port_proxy.hh.

References panic.

◆ tryMemsetBlob()

virtual bool 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 TranslatingPortProxy.

Definition at line 163 of file port_proxy.hh.

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

Referenced by memsetBlob().

◆ tryReadBlob()

virtual bool 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 TranslatingPortProxy.

Definition at line 141 of file port_proxy.hh.

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

Referenced by readBlob(), and tryReadString().

◆ tryReadString() [1/2]

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

◆ tryReadString() [2/2]

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

◆ tryWriteBlob()

virtual bool 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 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().

◆ tryWriteString()

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

◆ write() [1/2]

template<typename T >
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().

◆ write() [2/2]

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

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

◆ writeBlob()

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

◆ writeBlobPhys()

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

◆ writeString()

void PortProxy::writeString ( Addr  addr,
const char *  str 
) const
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().

Member Data Documentation

◆ _cacheLineSize

const unsigned int PortProxy::_cacheLineSize
private

Granularity of any transactions issued through this proxy.

Definition at line 89 of file port_proxy.hh.

Referenced by readBlobPhys(), and writeBlobPhys().

◆ sendFunctional

SendFunctionalFunc PortProxy::sendFunctional
private

Definition at line 86 of file port_proxy.hh.

Referenced by readBlobPhys(), and writeBlobPhys().


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

Generated on Wed Sep 30 2020 14:02:29 for gem5 by doxygen 1.8.17