diff options
-rw-r--r-- | src/mem/fs_translating_port_proxy.cc | 10 | ||||
-rw-r--r-- | src/mem/fs_translating_port_proxy.hh | 5 | ||||
-rw-r--r-- | src/mem/port_proxy.cc | 4 | ||||
-rw-r--r-- | src/mem/port_proxy.hh | 33 | ||||
-rw-r--r-- | src/mem/se_translating_port_proxy.cc | 9 | ||||
-rw-r--r-- | src/mem/se_translating_port_proxy.hh | 4 | ||||
-rw-r--r-- | src/mem/secure_port_proxy.hh | 3 |
7 files changed, 49 insertions, 19 deletions
diff --git a/src/mem/fs_translating_port_proxy.cc b/src/mem/fs_translating_port_proxy.cc index 6a25d1121..d12af13af 100644 --- a/src/mem/fs_translating_port_proxy.cc +++ b/src/mem/fs_translating_port_proxy.cc @@ -60,8 +60,14 @@ FSTranslatingPortProxy::FSTranslatingPortProxy(ThreadContext *tc) { } -FSTranslatingPortProxy::FSTranslatingPortProxy(MasterPort &port, - unsigned int cacheLineSize) +FSTranslatingPortProxy::FSTranslatingPortProxy( + SendFunctionalFunc func, unsigned int cacheLineSize) + : PortProxy(func, cacheLineSize), _tc(NULL) +{ +} + +FSTranslatingPortProxy::FSTranslatingPortProxy( + MasterPort &port, unsigned int cacheLineSize) : PortProxy(port, cacheLineSize), _tc(NULL) { } diff --git a/src/mem/fs_translating_port_proxy.hh b/src/mem/fs_translating_port_proxy.hh index 410eb7d78..2ecd742bc 100644 --- a/src/mem/fs_translating_port_proxy.hh +++ b/src/mem/fs_translating_port_proxy.hh @@ -79,7 +79,10 @@ class FSTranslatingPortProxy : public PortProxy FSTranslatingPortProxy(ThreadContext* tc); - FSTranslatingPortProxy(MasterPort &port, unsigned int cacheLineSize); + FSTranslatingPortProxy(SendFunctionalFunc func, + unsigned int cacheLineSize); + FSTranslatingPortProxy(MasterPort &port, + unsigned int cacheLineSize); ~FSTranslatingPortProxy() {} diff --git a/src/mem/port_proxy.cc b/src/mem/port_proxy.cc index 60f79e375..b630d310a 100644 --- a/src/mem/port_proxy.cc +++ b/src/mem/port_proxy.cc @@ -53,7 +53,7 @@ PortProxy::readBlobPhys(Addr addr, Request::Flags flags, Packet pkt(req, MemCmd::ReadReq); pkt.dataStatic(static_cast<uint8_t *>(p)); - _port.sendFunctional(&pkt); + sendFunctional(&pkt); p = static_cast<uint8_t *>(p) + gen.size(); } } @@ -70,7 +70,7 @@ PortProxy::writeBlobPhys(Addr addr, Request::Flags flags, Packet pkt(req, MemCmd::WriteReq); pkt.dataStaticConst(static_cast<const uint8_t *>(p)); - _port.sendFunctional(&pkt); + sendFunctional(&pkt); p = static_cast<const uint8_t *>(p) + gen.size(); } } diff --git a/src/mem/port_proxy.hh b/src/mem/port_proxy.hh index 61a207146..31ac3e941 100644 --- a/src/mem/port_proxy.hh +++ b/src/mem/port_proxy.hh @@ -59,38 +59,53 @@ #ifndef __MEM_PORT_PROXY_HH__ #define __MEM_PORT_PROXY_HH__ +#include <functional> #include <limits> #include "mem/port.hh" #include "sim/byteswap.hh" /** - * This object is a proxy for a structural port, to be used for debug - * accesses. + * 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 - * structural port, and provides templatized convenience access functions. + * protocol, and provides templatized convenience access functions. * * The addresses are interpreted as physical addresses. * * @sa SETranslatingProxy * @sa FSTranslatingProxy */ -class PortProxy +class PortProxy : FunctionalRequestProtocol { - private: + public: + typedef std::function<void(PacketPtr pkt)> SendFunctionalFunc; - /** The actual physical port used by this proxy. */ - MasterPort &_port; + private: + SendFunctionalFunc sendFunctional; /** Granularity of any transactions issued through this proxy. */ const unsigned int _cacheLineSize; + void + recvFunctionalSnoop(PacketPtr pkt) override + { + // Since port proxies aren't anyone else's peer, they should never + // receive snoops. + panic("Port proxies should never receive snoops."); + } + public: - PortProxy(MasterPort &port, unsigned int cacheLineSize) : - _port(port), _cacheLineSize(cacheLineSize) + PortProxy(SendFunctionalFunc func, unsigned int cacheLineSize) : + sendFunctional(func), _cacheLineSize(cacheLineSize) + {} + PortProxy(const MasterPort &port, unsigned int cacheLineSize) : + sendFunctional([&port](PacketPtr pkt)->void { + port.sendFunctional(pkt); + }), _cacheLineSize(cacheLineSize) {} virtual ~PortProxy() { } diff --git a/src/mem/se_translating_port_proxy.cc b/src/mem/se_translating_port_proxy.cc index c5f38f1cd..94d2ab3d1 100644 --- a/src/mem/se_translating_port_proxy.cc +++ b/src/mem/se_translating_port_proxy.cc @@ -55,8 +55,13 @@ using namespace TheISA; -SETranslatingPortProxy::SETranslatingPortProxy(MasterPort& port, Process *p, - AllocType alloc) +SETranslatingPortProxy::SETranslatingPortProxy( + SendFunctionalFunc func, Process *p, AllocType alloc) + : PortProxy(func, p->system->cacheLineSize()), pTable(p->pTable), + process(p), allocating(alloc) +{ } +SETranslatingPortProxy::SETranslatingPortProxy(MasterPort &port, + Process *p, AllocType alloc) : PortProxy(port, p->system->cacheLineSize()), pTable(p->pTable), process(p), allocating(alloc) { } diff --git a/src/mem/se_translating_port_proxy.hh b/src/mem/se_translating_port_proxy.hh index 718e44a57..e32f1d0e3 100644 --- a/src/mem/se_translating_port_proxy.hh +++ b/src/mem/se_translating_port_proxy.hh @@ -80,7 +80,9 @@ class SETranslatingPortProxy : public PortProxy AllocType allocating; public: - SETranslatingPortProxy(MasterPort& port, Process* p, AllocType alloc); + SETranslatingPortProxy(SendFunctionalFunc func, + Process* p, AllocType alloc); + SETranslatingPortProxy(MasterPort &port, Process* p, AllocType alloc); ~SETranslatingPortProxy() {} void setPageTable(EmulationPageTable *p) { pTable = p; } diff --git a/src/mem/secure_port_proxy.hh b/src/mem/secure_port_proxy.hh index 9a2200c9e..5ce0c299a 100644 --- a/src/mem/secure_port_proxy.hh +++ b/src/mem/secure_port_proxy.hh @@ -70,8 +70,7 @@ class SecurePortProxy : public PortProxy { public: - SecurePortProxy(MasterPort &port, unsigned int cache_line_size) - : PortProxy(port, cache_line_size) {} + using PortProxy::PortProxy; bool tryReadBlob(Addr addr, void *p, int size) const override; bool tryWriteBlob(Addr addr, const void *p, int size) const override; |