mem: Add a ThreadContext helper constructor for PortProxy.

This creates a sendFunctionalFunc which calls the tc->sendFunctional.

Change-Id: I97ac2fb52d4f61420a09b37d70d4745c779234c1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45863
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-05-22 17:47:13 -07:00
parent 73a84aafc6
commit 31952c32f7
2 changed files with 23 additions and 9 deletions

View File

@@ -38,6 +38,18 @@
#include "mem/port_proxy.hh"
#include "base/chunk_generator.hh"
#include "cpu/thread_context.hh"
#include "mem/port.hh"
PortProxy::PortProxy(ThreadContext *tc, unsigned int cache_line_size) :
PortProxy([tc](PacketPtr pkt)->void { tc->sendFunctional(pkt); },
cache_line_size)
{}
PortProxy::PortProxy(const RequestPort &port, unsigned int cache_line_size) :
PortProxy([&port](PacketPtr pkt)->void { port.sendFunctional(pkt); },
cache_line_size)
{}
void
PortProxy::readBlobPhys(Addr addr, Request::Flags flags,

View File

@@ -60,9 +60,12 @@
#include <functional>
#include <limits>
#include "mem/port.hh"
#include "mem/protocol/functional.hh"
#include "sim/byteswap.hh"
class RequestPort;
class ThreadContext;
/**
* This object is a proxy for a port or other object which implements the
* functional response protocol, to be used for debug accesses.
@@ -97,16 +100,15 @@ class PortProxy : FunctionalRequestProtocol
}
public:
PortProxy(SendFunctionalFunc func, unsigned int cacheLineSize) :
sendFunctional(func), _cacheLineSize(cacheLineSize)
PortProxy(SendFunctionalFunc func, unsigned int cache_line_size) :
sendFunctional(func), _cacheLineSize(cache_line_size)
{}
PortProxy(const RequestPort &port, unsigned int cacheLineSize) :
sendFunctional([&port](PacketPtr pkt)->void {
port.sendFunctional(pkt);
}), _cacheLineSize(cacheLineSize)
{}
virtual ~PortProxy() { }
// Helpers which create typical SendFunctionalFunc-s from other objects.
PortProxy(ThreadContext *tc, unsigned int cache_line_size);
PortProxy(const RequestPort &port, unsigned int cache_line_size);
virtual ~PortProxy() {}
/** Fixed functionality for use in base classes. */