gem5  v22.0.0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gem5::TranslatingPortProxy Class Reference

This proxy attempts to translate virtual addresses using the TLBs. More...

#include <translating_port_proxy.hh>

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

Public Member Functions

 TranslatingPortProxy (ThreadContext *tc, Request::Flags _flags=0)
 
bool tryReadBlob (Addr addr, void *p, int size) const override
 Version of tryReadblob that translates virt->phys and deals with page boundries. More...
 
bool tryWriteBlob (Addr addr, const void *p, int size) const override
 Version of tryWriteBlob that translates virt->phys and deals with page boundries. More...
 
bool tryMemsetBlob (Addr address, uint8_t v, int size) const override
 Fill size bytes starting at addr with byte value val. More...
 
- Public Member Functions inherited from gem5::PortProxy
 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...
 
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...
 

Protected Member Functions

virtual bool fixupRange (const TranslationGen::Range &range, BaseMMU::Mode mode) const
 
bool tryOnBlob (BaseMMU::Mode mode, TranslationGenPtr gen, std::function< void(const TranslationGen::Range &)> func) const
 

Protected Attributes

ThreadContext_tc
 
Request::Flags flags
 

Additional Inherited Members

- Public Types inherited from gem5::PortProxy
typedef std::function< void(PacketPtr pkt)> SendFunctionalFunc
 

Detailed Description

This proxy attempts to translate virtual addresses using the TLBs.

If it fails, subclasses can override the fixupAddr virtual method to try to recover, and then attempt the translation again. If it still fails then the access as a whole fails.

Definition at line 60 of file translating_port_proxy.hh.

Constructor & Destructor Documentation

◆ TranslatingPortProxy()

gem5::TranslatingPortProxy::TranslatingPortProxy ( ThreadContext tc,
Request::Flags  _flags = 0 
)

Definition at line 57 of file translating_port_proxy.cc.

Member Function Documentation

◆ fixupRange()

virtual bool gem5::TranslatingPortProxy::fixupRange ( const TranslationGen::Range range,
BaseMMU::Mode  mode 
) const
inlineprotectedvirtual

Reimplemented in gem5::SETranslatingPortProxy.

Definition at line 67 of file translating_port_proxy.hh.

Referenced by tryOnBlob().

◆ tryMemsetBlob()

bool gem5::TranslatingPortProxy::tryMemsetBlob ( Addr  address,
uint8_t  v,
int  size 
) const
overridevirtual

Fill size bytes starting at addr with byte value val.

Reimplemented from gem5::PortProxy.

Definition at line 114 of file translating_port_proxy.cc.

References _tc, gem5::X86ISA::addr, flags, gem5::ThreadContext::getMMUPtr(), gem5::ArmISA::mode, gem5::BaseMMU::translateFunctional(), tryOnBlob(), gem5::VegaISA::v, and gem5::BaseMMU::Write.

◆ tryOnBlob()

bool gem5::TranslatingPortProxy::tryOnBlob ( BaseMMU::Mode  mode,
TranslationGenPtr  gen,
std::function< void(const TranslationGen::Range &)>  func 
) const
protected

Definition at line 63 of file translating_port_proxy.cc.

References fixupRange(), and gem5::ArmISA::mode.

Referenced by tryMemsetBlob(), tryReadBlob(), and tryWriteBlob().

◆ tryReadBlob()

bool gem5::TranslatingPortProxy::tryReadBlob ( Addr  addr,
void *  p,
int  size 
) const
overridevirtual

Version of tryReadblob that translates virt->phys and deals with page boundries.

Reimplemented from gem5::PortProxy.

Definition at line 89 of file translating_port_proxy.cc.

References _tc, gem5::X86ISA::addr, flags, gem5::ThreadContext::getMMUPtr(), gem5::ArmISA::mode, gem5::VegaISA::p, gem5::BaseMMU::Read, gem5::BaseMMU::translateFunctional(), and tryOnBlob().

◆ tryWriteBlob()

bool gem5::TranslatingPortProxy::tryWriteBlob ( Addr  addr,
const void *  p,
int  size 
) const
overridevirtual

Version of tryWriteBlob that translates virt->phys and deals with page boundries.

Reimplemented from gem5::PortProxy.

Definition at line 101 of file translating_port_proxy.cc.

References _tc, gem5::X86ISA::addr, flags, gem5::ThreadContext::getMMUPtr(), gem5::ArmISA::mode, gem5::VegaISA::p, gem5::BaseMMU::translateFunctional(), tryOnBlob(), and gem5::BaseMMU::Write.

Referenced by gem5::SparcISA::SEWorkload::flushWindows().

Member Data Documentation

◆ _tc

ThreadContext* gem5::TranslatingPortProxy::_tc
protected

◆ flags

Request::Flags gem5::TranslatingPortProxy::flags
protected

Definition at line 64 of file translating_port_proxy.hh.

Referenced by tryMemsetBlob(), tryReadBlob(), and tryWriteBlob().


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

Generated on Sat Jun 18 2022 08:13:28 for gem5 by doxygen 1.8.17