{
}
-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)
{
}
FSTranslatingPortProxy(ThreadContext* tc);
- FSTranslatingPortProxy(MasterPort &port, unsigned int cacheLineSize);
+ FSTranslatingPortProxy(SendFunctionalFunc func,
+ unsigned int cacheLineSize);
+ FSTranslatingPortProxy(MasterPort &port,
+ unsigned int cacheLineSize);
~FSTranslatingPortProxy() {}
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();
}
}
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();
}
}
#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() { }
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)
{ }
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; }
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;