MEM: Add port proxies instead of non-structural ports
Port proxies are used to replace non-structural ports, and thus enable all ports in the system to correspond to a structural entity. This has the advantage of accessing memory through the normal memory subsystem and thus allowing any constellation of distributed memories, address maps, etc. Most accesses are done through the "system port" that is used for loading binaries, debugging etc. For the entities that belong to the CPU, e.g. threads and thread contexts, they wrap the CPU data port in a port proxy. The following replacements are made: FunctionalPort > PortProxy TranslatingPort > SETranslatingPortProxy VirtualPort > FSTranslatingPortProxy --HG-- rename : src/mem/vport.cc => src/mem/fs_translating_port_proxy.cc rename : src/mem/vport.hh => src/mem/fs_translating_port_proxy.hh rename : src/mem/translating_port.cc => src/mem/se_translating_port_proxy.cc rename : src/mem/translating_port.hh => src/mem/se_translating_port_proxy.hh
This commit is contained in:
@@ -97,12 +97,12 @@ class CheckerThreadContext : public ThreadContext
|
||||
TheISA::Kernel::Statistics *getKernelStats()
|
||||
{ return actualTC->getKernelStats(); }
|
||||
|
||||
FunctionalPort *getPhysPort() { return actualTC->getPhysPort(); }
|
||||
PortProxy* getPhysProxy() { return actualTC->getPhysProxy(); }
|
||||
|
||||
VirtualPort *getVirtPort()
|
||||
{ return actualTC->getVirtPort(); }
|
||||
FSTranslatingPortProxy* getVirtProxy()
|
||||
{ return actualTC->getVirtProxy(); }
|
||||
#else
|
||||
TranslatingPort *getMemPort() { return actualTC->getMemPort(); }
|
||||
SETranslatingPortProxy* getMemProxy() { return actualTC->getMemProxy(); }
|
||||
|
||||
Process *getProcessPtr() { return actualTC->getProcessPtr(); }
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#include "debug/RefCount.hh"
|
||||
#include "debug/SkedCache.hh"
|
||||
#include "debug/Quiesce.hh"
|
||||
#include "mem/translating_port.hh"
|
||||
#include "params/InOrderCPU.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/stat_control.hh"
|
||||
@@ -766,6 +765,8 @@ InOrderCPU::init()
|
||||
for (ThreadID tid = 0; tid < numThreads; tid++) {
|
||||
ThreadContext *src_tc = threadContexts[tid];
|
||||
TheISA::initCPU(src_tc, src_tc->contextId());
|
||||
// Initialise the ThreadContext's memory proxies
|
||||
thread[tid]->initMemProxies(thread[tid]->getTC());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -888,16 +889,6 @@ InOrderCPU::processInterrupts(Fault interrupt)
|
||||
trap(interrupt, threadContexts[0]->contextId(), dummyBufferInst);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InOrderCPU::updateMemPorts()
|
||||
{
|
||||
// Update all ThreadContext's memory ports (Functional/Virtual
|
||||
// Ports)
|
||||
ThreadID size = thread.size();
|
||||
for (ThreadID i = 0; i < size; ++i)
|
||||
thread[i]->connectMemPorts(thread[i]->getTC());
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
|
||||
@@ -430,10 +430,6 @@ class InOrderCPU : public BaseCPU
|
||||
/** Halts the CPU. */
|
||||
void halt() { panic("Halt not implemented!\n"); }
|
||||
|
||||
/** Update the Virt and Phys ports of all ThreadContexts to
|
||||
* reflect change in memory connections. */
|
||||
void updateMemPorts();
|
||||
|
||||
/** Check if this address is a valid instruction address. */
|
||||
bool validInstAddr(Addr addr) { return true; }
|
||||
|
||||
|
||||
@@ -145,21 +145,6 @@ CacheUnit::tlb()
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
CacheUnit::CachePort::setPeer(Port *port)
|
||||
{
|
||||
Port::setPeer(port);
|
||||
|
||||
#if FULL_SYSTEM
|
||||
// Update the ThreadContext's memory ports (Functional/Virtual
|
||||
// Ports)
|
||||
if (cachePortUnit->resName == "dcache_port") {
|
||||
cachePortUnit->cpu->updateMemPorts();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Port *
|
||||
CacheUnit::getPort(const string &if_name, int idx)
|
||||
{
|
||||
|
||||
@@ -95,8 +95,6 @@ class CacheUnit : public Resource
|
||||
|
||||
bool snoopRangeSent;
|
||||
|
||||
void setPeer(Port *port);
|
||||
|
||||
protected:
|
||||
/** Atomic version of receive. Panics. */
|
||||
Tick recvAtomic(PacketPtr pkt);
|
||||
|
||||
@@ -39,10 +39,10 @@ using namespace TheISA;
|
||||
|
||||
#if FULL_SYSTEM
|
||||
|
||||
VirtualPort *
|
||||
InOrderThreadContext::getVirtPort()
|
||||
FSTranslatingPortProxy*
|
||||
InOrderThreadContext::getVirtProxy()
|
||||
{
|
||||
return thread->getVirtPort();
|
||||
return thread->getVirtProxy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -118,12 +118,12 @@ class InOrderThreadContext : public ThreadContext
|
||||
TheISA::Kernel::Statistics *getKernelStats()
|
||||
{ return thread->kernelStats; }
|
||||
|
||||
FunctionalPort *getPhysPort() { return thread->getPhysPort(); }
|
||||
PortProxy* getPhysProxy() { return thread->getPhysProxy(); }
|
||||
|
||||
VirtualPort *getVirtPort();
|
||||
FSTranslatingPortProxy* getVirtProxy();
|
||||
|
||||
void connectMemPorts(ThreadContext *tc)
|
||||
{ thread->connectMemPorts(tc); }
|
||||
void initMemProxies(ThreadContext *tc)
|
||||
{ thread->initMemProxies(tc); }
|
||||
|
||||
/** Dumps the function profiling information.
|
||||
* @todo: Implement.
|
||||
@@ -147,7 +147,7 @@ class InOrderThreadContext : public ThreadContext
|
||||
return this->thread->quiesceEvent;
|
||||
}
|
||||
#else
|
||||
TranslatingPort *getMemPort() { return thread->getMemPort(); }
|
||||
SETranslatingPortProxy* getMemProxy() { return thread->getMemProxy(); }
|
||||
|
||||
/** Returns a pointer to this thread's process. */
|
||||
Process *getProcessPtr() { return thread->getProcessPtr(); }
|
||||
|
||||
@@ -610,6 +610,8 @@ FullO3CPU<Impl>::init()
|
||||
for (ThreadID tid = 0; tid < numThreads; tid++) {
|
||||
ThreadContext *src_tc = threadContexts[tid];
|
||||
TheISA::initCPU(src_tc, src_tc->contextId());
|
||||
// Initialise the ThreadContext's memory proxies
|
||||
thread[tid]->initMemProxies(thread[tid]->getTC());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -974,16 +976,6 @@ FullO3CPU<Impl>::processInterrupts(Fault interrupt)
|
||||
this->trap(interrupt, 0, NULL);
|
||||
}
|
||||
|
||||
template <class Impl>
|
||||
void
|
||||
FullO3CPU<Impl>::updateMemPorts()
|
||||
{
|
||||
// Update all ThreadContext's memory ports (Functional/Virtual
|
||||
// Ports)
|
||||
ThreadID size = thread.size();
|
||||
for (ThreadID i = 0; i < size; ++i)
|
||||
thread[i]->connectMemPorts(thread[i]->getTC());
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class Impl>
|
||||
|
||||
@@ -395,10 +395,6 @@ class FullO3CPU : public BaseO3CPU
|
||||
/** Halts the CPU. */
|
||||
void halt() { panic("Halt not implemented!\n"); }
|
||||
|
||||
/** Update the Virt and Phys ports of all ThreadContexts to
|
||||
* reflect change in memory connections. */
|
||||
void updateMemPorts();
|
||||
|
||||
/** Check if this address is a valid instruction address. */
|
||||
bool validInstAddr(Addr addr) { return true; }
|
||||
|
||||
|
||||
@@ -305,8 +305,6 @@ class LSQ {
|
||||
|
||||
bool snoopRangeSent;
|
||||
|
||||
virtual void setPeer(Port *port);
|
||||
|
||||
protected:
|
||||
/** Atomic version of receive. Panics. */
|
||||
virtual Tick recvAtomic(PacketPtr pkt);
|
||||
@@ -334,11 +332,6 @@ class LSQ {
|
||||
/** D-cache port. */
|
||||
DcachePort dcachePort;
|
||||
|
||||
#if FULL_SYSTEM
|
||||
/** Tell the CPU to update the Phys and Virt ports. */
|
||||
void updateMemPorts() { cpu->updateMemPorts(); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
/** The LSQ policy for SMT mode. */
|
||||
LSQPolicy lsqPolicy;
|
||||
|
||||
@@ -40,19 +40,6 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<class Impl>
|
||||
void
|
||||
LSQ<Impl>::DcachePort::setPeer(Port *port)
|
||||
{
|
||||
Port::setPeer(port);
|
||||
|
||||
#if FULL_SYSTEM
|
||||
// Update the ThreadContext's memory ports (Functional/Virtual
|
||||
// Ports)
|
||||
lsq->updateMemPorts();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class Impl>
|
||||
Tick
|
||||
LSQ<Impl>::DcachePort::recvAtomic(PacketPtr pkt)
|
||||
|
||||
@@ -97,13 +97,15 @@ class O3ThreadContext : public ThreadContext
|
||||
virtual TheISA::Kernel::Statistics *getKernelStats()
|
||||
{ return thread->kernelStats; }
|
||||
|
||||
virtual FunctionalPort *getPhysPort() { return thread->getPhysPort(); }
|
||||
virtual PortProxy* getPhysProxy() { return thread->getPhysProxy(); }
|
||||
|
||||
virtual VirtualPort *getVirtPort();
|
||||
virtual FSTranslatingPortProxy* getVirtProxy();
|
||||
|
||||
virtual void connectMemPorts(ThreadContext *tc) { thread->connectMemPorts(tc); }
|
||||
virtual void initMemProxies(ThreadContext *tc)
|
||||
{ thread->initMemProxies(tc); }
|
||||
#else
|
||||
virtual TranslatingPort *getMemPort() { return thread->getMemPort(); }
|
||||
virtual SETranslatingPortProxy* getMemProxy()
|
||||
{ return thread->getMemProxy(); }
|
||||
|
||||
/** Returns a pointer to this thread's process. */
|
||||
virtual Process *getProcessPtr() { return thread->getProcessPtr(); }
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
|
||||
#if FULL_SYSTEM
|
||||
template <class Impl>
|
||||
VirtualPort *
|
||||
O3ThreadContext<Impl>::getVirtPort()
|
||||
FSTranslatingPortProxy*
|
||||
O3ThreadContext<Impl>::getVirtProxy()
|
||||
{
|
||||
return thread->getVirtPort();
|
||||
return thread->getVirtProxy();
|
||||
}
|
||||
|
||||
template <class Impl>
|
||||
|
||||
@@ -124,12 +124,12 @@ class OzoneCPU : public BaseCPU
|
||||
TheISA::Kernel::Statistics *getKernelStats()
|
||||
{ return thread->getKernelStats(); }
|
||||
|
||||
FunctionalPort *getPhysPort() { return thread->getPhysPort(); }
|
||||
PortProxy* getPhysProxy() { return thread->getPhysProxy(); }
|
||||
|
||||
VirtualPort *getVirtPort()
|
||||
{ return thread->getVirtPort(); }
|
||||
FSTranslatingPortProxy* getVirtProxy()
|
||||
{ return thread->getVirtProxy(); }
|
||||
#else
|
||||
TranslatingPort *getMemPort() { return thread->getMemPort(); }
|
||||
SETranslatingPortProxy* getMemProxy() { return thread->getMemProxy(); }
|
||||
|
||||
Process *getProcessPtr() { return thread->getProcessPtr(); }
|
||||
#endif
|
||||
|
||||
@@ -195,23 +195,7 @@ OzoneCPU<Impl>::OzoneCPU(Params *p)
|
||||
backEnd->renameTable.copyFrom(thread.renameTable);
|
||||
|
||||
#if FULL_SYSTEM
|
||||
Port *mem_port;
|
||||
FunctionalPort *phys_port;
|
||||
VirtualPort *virt_port;
|
||||
phys_port = new FunctionalPort(csprintf("%s-%d-funcport",
|
||||
name(), 0));
|
||||
mem_port = system->physmem->getPort("functional");
|
||||
mem_port->setPeer(phys_port);
|
||||
phys_port->setPeer(mem_port);
|
||||
|
||||
virt_port = new VirtualPort(csprintf("%s-%d-vport",
|
||||
name(), 0));
|
||||
mem_port = system->physmem->getPort("functional");
|
||||
mem_port->setPeer(virt_port);
|
||||
virt_port->setPeer(mem_port);
|
||||
|
||||
thread.setPhysPort(phys_port);
|
||||
thread.setVirtPort(virt_port);
|
||||
thread.connectMemPorts(tc);
|
||||
#endif
|
||||
|
||||
DPRINTF(OzoneCPU, "OzoneCPU: Created Ozone cpu object.\n");
|
||||
|
||||
@@ -91,6 +91,9 @@ AtomicSimpleCPU::init()
|
||||
// initialize CPU, including PC
|
||||
TheISA::initCPU(tc, tc->contextId());
|
||||
}
|
||||
|
||||
// Initialise the ThreadContext's memory proxies
|
||||
tcBase()->initMemProxies(tcBase());
|
||||
#endif
|
||||
if (hasPhysMemPort) {
|
||||
bool snoop = false;
|
||||
@@ -145,18 +148,6 @@ AtomicSimpleCPU::CpuPort::recvRetry()
|
||||
panic("AtomicSimpleCPU doesn't expect recvRetry callback!");
|
||||
}
|
||||
|
||||
void
|
||||
AtomicSimpleCPU::DcachePort::setPeer(Port *port)
|
||||
{
|
||||
Port::setPeer(port);
|
||||
|
||||
#if FULL_SYSTEM
|
||||
// Update the ThreadContext's memory ports (Functional/Virtual
|
||||
// Ports)
|
||||
cpu->tcBase()->connectMemPorts(cpu->tcBase());
|
||||
#endif
|
||||
}
|
||||
|
||||
AtomicSimpleCPU::AtomicSimpleCPU(AtomicSimpleCPUParams *p)
|
||||
: BaseSimpleCPU(p), tickEvent(this), width(p->width), locked(false),
|
||||
simulate_data_stalls(p->simulate_data_stalls),
|
||||
|
||||
@@ -95,16 +95,7 @@ class AtomicSimpleCPU : public BaseSimpleCPU
|
||||
};
|
||||
CpuPort icachePort;
|
||||
|
||||
class DcachePort : public CpuPort
|
||||
{
|
||||
public:
|
||||
DcachePort(const std::string &_name, AtomicSimpleCPU *_cpu)
|
||||
: CpuPort(_name, _cpu)
|
||||
{ }
|
||||
|
||||
virtual void setPeer(Port *port);
|
||||
};
|
||||
DcachePort dcachePort;
|
||||
CpuPort dcachePort;
|
||||
|
||||
CpuPort physmemPort;
|
||||
bool hasPhysMemPort;
|
||||
|
||||
@@ -81,6 +81,9 @@ TimingSimpleCPU::init()
|
||||
// initialize CPU, including PC
|
||||
TheISA::initCPU(tc, _cpuId);
|
||||
}
|
||||
|
||||
// Initialise the ThreadContext's memory proxies
|
||||
tcBase()->initMemProxies(tcBase());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -874,18 +877,6 @@ TimingSimpleCPU::completeDrain()
|
||||
drainEvent->process();
|
||||
}
|
||||
|
||||
void
|
||||
TimingSimpleCPU::DcachePort::setPeer(Port *port)
|
||||
{
|
||||
Port::setPeer(port);
|
||||
|
||||
#if FULL_SYSTEM
|
||||
// Update the ThreadContext's memory ports (Functional/Virtual
|
||||
// Ports)
|
||||
cpu->tcBase()->connectMemPorts(cpu->tcBase());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
TimingSimpleCPU::DcachePort::recvTiming(PacketPtr pkt)
|
||||
{
|
||||
|
||||
@@ -212,8 +212,6 @@ class TimingSimpleCPU : public BaseSimpleCPU
|
||||
: CpuPort(_cpu->name() + "-dport", _cpu, _lat), tickEvent(_cpu)
|
||||
{ }
|
||||
|
||||
virtual void setPeer(Port *port);
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool recvTiming(PacketPtr pkt);
|
||||
|
||||
@@ -50,11 +50,11 @@
|
||||
#include "base/trace.hh"
|
||||
#include "cpu/profile.hh"
|
||||
#include "cpu/quiesce_event.hh"
|
||||
#include "mem/vport.hh"
|
||||
#include "mem/fs_translating_port_proxy.hh"
|
||||
#include "sim/serialize.hh"
|
||||
#include "sim/sim_exit.hh"
|
||||
#else
|
||||
#include "mem/translating_port.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/system.hh"
|
||||
#endif
|
||||
@@ -117,10 +117,6 @@ SimpleThread::SimpleThread()
|
||||
|
||||
SimpleThread::~SimpleThread()
|
||||
{
|
||||
#if FULL_SYSTEM
|
||||
delete physPort;
|
||||
delete virtPort;
|
||||
#endif
|
||||
delete tc;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,13 +208,13 @@ class SimpleThread : public ThreadState
|
||||
System *getSystemPtr() { return system; }
|
||||
|
||||
#if FULL_SYSTEM
|
||||
FunctionalPort *getPhysPort() { return physPort; }
|
||||
PortProxy* getPhysProxy() { return physProxy; }
|
||||
|
||||
/** Return a virtual port. This port cannot be cached locally in an object.
|
||||
* After a CPU switch it may point to the wrong memory object which could
|
||||
* mean stale data.
|
||||
*/
|
||||
VirtualPort *getVirtPort() { return virtPort; }
|
||||
FSTranslatingPortProxy* getVirtProxy() { return virtProxy; }
|
||||
#endif
|
||||
|
||||
Status status() const { return _status; }
|
||||
|
||||
@@ -50,9 +50,9 @@ class BaseCPU;
|
||||
class Checkpoint;
|
||||
class Decoder;
|
||||
class EndQuiesceEvent;
|
||||
class TranslatingPort;
|
||||
class FunctionalPort;
|
||||
class VirtualPort;
|
||||
class SETranslatingPortProxy;
|
||||
class FSTranslatingPortProxy;
|
||||
class PortProxy;
|
||||
class Process;
|
||||
class System;
|
||||
namespace TheISA {
|
||||
@@ -128,13 +128,19 @@ class ThreadContext
|
||||
#if FULL_SYSTEM
|
||||
virtual TheISA::Kernel::Statistics *getKernelStats() = 0;
|
||||
|
||||
virtual FunctionalPort *getPhysPort() = 0;
|
||||
virtual PortProxy* getPhysProxy() = 0;
|
||||
|
||||
virtual VirtualPort *getVirtPort() = 0;
|
||||
virtual FSTranslatingPortProxy* getVirtProxy() = 0;
|
||||
|
||||
virtual void connectMemPorts(ThreadContext *tc) = 0;
|
||||
/**
|
||||
* Initialise the physical and virtual port proxies and tie them to
|
||||
* the data port of the CPU.
|
||||
*
|
||||
* tc ThreadContext for the virtual-to-physical translation
|
||||
*/
|
||||
virtual void initMemProxies(ThreadContext *tc) = 0;
|
||||
#else
|
||||
virtual TranslatingPort *getMemPort() = 0;
|
||||
virtual SETranslatingPortProxy *getMemProxy() = 0;
|
||||
|
||||
virtual Process *getProcessPtr() = 0;
|
||||
#endif
|
||||
@@ -298,13 +304,13 @@ class ProxyThreadContext : public ThreadContext
|
||||
TheISA::Kernel::Statistics *getKernelStats()
|
||||
{ return actualTC->getKernelStats(); }
|
||||
|
||||
FunctionalPort *getPhysPort() { return actualTC->getPhysPort(); }
|
||||
PortProxy* getPhysProxy() { return actualTC->getPhysProxy(); }
|
||||
|
||||
VirtualPort *getVirtPort() { return actualTC->getVirtPort(); }
|
||||
FSTranslatingPortProxy* getVirtProxy() { return actualTC->getVirtProxy(); }
|
||||
|
||||
void connectMemPorts(ThreadContext *tc) { actualTC->connectMemPorts(tc); }
|
||||
void initMemProxies(ThreadContext *tc) { actualTC->initMemProxies(tc); }
|
||||
#else
|
||||
TranslatingPort *getMemPort() { return actualTC->getMemPort(); }
|
||||
SETranslatingPortProxy* getMemProxy() { return actualTC->getMemProxy(); }
|
||||
|
||||
Process *getProcessPtr() { return actualTC->getProcessPtr(); }
|
||||
#endif
|
||||
|
||||
@@ -32,14 +32,15 @@
|
||||
#include "cpu/base.hh"
|
||||
#include "cpu/profile.hh"
|
||||
#include "cpu/thread_state.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "mem/translating_port.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/serialize.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
#if FULL_SYSTEM
|
||||
#include "arch/kernel_stats.hh"
|
||||
#include "cpu/quiesce_event.hh"
|
||||
#include "mem/vport.hh"
|
||||
#include "mem/fs_translating_port_proxy.hh"
|
||||
#endif
|
||||
|
||||
#if FULL_SYSTEM
|
||||
@@ -51,9 +52,9 @@ ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
|
||||
baseCpu(cpu), _threadId(_tid), lastActivate(0), lastSuspend(0),
|
||||
#if FULL_SYSTEM
|
||||
profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL),
|
||||
kernelStats(NULL), physPort(NULL), virtPort(NULL),
|
||||
kernelStats(NULL), physProxy(NULL), virtProxy(NULL),
|
||||
#else
|
||||
port(NULL), process(_process),
|
||||
proxy(NULL), process(_process),
|
||||
#endif
|
||||
funcExeInst(0), storeCondFailures(0)
|
||||
{
|
||||
@@ -61,10 +62,16 @@ ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
|
||||
|
||||
ThreadState::~ThreadState()
|
||||
{
|
||||
#if !FULL_SYSTEM
|
||||
if (port) {
|
||||
delete port->getPeer();
|
||||
delete port;
|
||||
#if FULL_SYSTEM
|
||||
if (physProxy != NULL) {
|
||||
delete physProxy;
|
||||
}
|
||||
if (virtProxy != NULL) {
|
||||
delete virtProxy;
|
||||
}
|
||||
#else
|
||||
if (proxy != NULL) {
|
||||
delete proxy;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -106,38 +113,16 @@ ThreadState::unserialize(Checkpoint *cp, const std::string §ion)
|
||||
|
||||
#if FULL_SYSTEM
|
||||
void
|
||||
ThreadState::connectMemPorts(ThreadContext *tc)
|
||||
ThreadState::initMemProxies(ThreadContext *tc)
|
||||
{
|
||||
connectPhysPort();
|
||||
connectVirtPort(tc);
|
||||
}
|
||||
|
||||
void
|
||||
ThreadState::connectPhysPort()
|
||||
{
|
||||
// @todo: For now this disregards any older port that may have
|
||||
// already existed. Fix this memory leak once the bus port IDs
|
||||
// for functional ports is resolved.
|
||||
if (physPort)
|
||||
physPort->removeConn();
|
||||
else
|
||||
physPort = new FunctionalPort(csprintf("%s-%d-funcport",
|
||||
baseCpu->name(), _threadId));
|
||||
connectToMemFunc(physPort);
|
||||
}
|
||||
|
||||
void
|
||||
ThreadState::connectVirtPort(ThreadContext *tc)
|
||||
{
|
||||
// @todo: For now this disregards any older port that may have
|
||||
// already existed. Fix this memory leak once the bus port IDs
|
||||
// for functional ports is resolved.
|
||||
if (virtPort)
|
||||
virtPort->removeConn();
|
||||
else
|
||||
virtPort = new VirtualPort(csprintf("%s-%d-vport",
|
||||
baseCpu->name(), _threadId), tc);
|
||||
connectToMemFunc(virtPort);
|
||||
// Note that this only refers to the port on the CPU side and can
|
||||
// safely be done at init() time even if the CPU is not connected
|
||||
// (i.e. due to restoring from a checkpoint and later switching
|
||||
// in.
|
||||
if (physProxy == NULL)
|
||||
physProxy = new PortProxy(*baseCpu->getPort("dcache_port"));
|
||||
if (virtProxy == NULL)
|
||||
virtProxy = new FSTranslatingPortProxy(tc);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -155,36 +140,17 @@ ThreadState::profileSample()
|
||||
}
|
||||
|
||||
#else
|
||||
TranslatingPort *
|
||||
ThreadState::getMemPort()
|
||||
SETranslatingPortProxy *
|
||||
ThreadState::getMemProxy()
|
||||
{
|
||||
if (port != NULL)
|
||||
return port;
|
||||
if (proxy != NULL)
|
||||
return proxy;
|
||||
|
||||
/* Use this port to for syscall emulation writes to memory. */
|
||||
port = new TranslatingPort(csprintf("%s-%d-funcport", baseCpu->name(), _threadId),
|
||||
process, TranslatingPort::NextPage);
|
||||
/* Use this port proxy to for syscall emulation writes to memory. */
|
||||
proxy = new SETranslatingPortProxy(*process->system->getSystemPort(),
|
||||
process,
|
||||
SETranslatingPortProxy::NextPage);
|
||||
|
||||
connectToMemFunc(port);
|
||||
|
||||
return port;
|
||||
return proxy;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ThreadState::connectToMemFunc(Port *port)
|
||||
{
|
||||
Port *dcache_port, *func_mem_port;
|
||||
|
||||
dcache_port = baseCpu->getPort("dcache_port");
|
||||
assert(dcache_port != NULL);
|
||||
|
||||
MemObject *mem_object = dcache_port->getPeer()->getOwner();
|
||||
assert(mem_object != NULL);
|
||||
|
||||
func_mem_port = mem_object->getPort("functional");
|
||||
assert(func_mem_port != NULL);
|
||||
|
||||
func_mem_port->setPeer(port);
|
||||
port->setPeer(func_mem_port);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,9 @@ namespace TheISA {
|
||||
#endif
|
||||
|
||||
class Checkpoint;
|
||||
class Port;
|
||||
class TranslatingPort;
|
||||
class PortProxy;
|
||||
class SETranslatingPort;
|
||||
class FSTranslatingPort;
|
||||
|
||||
/**
|
||||
* Struct for holding general thread state that is needed across CPU
|
||||
@@ -93,11 +94,13 @@ struct ThreadState {
|
||||
Tick readLastSuspend() { return lastSuspend; }
|
||||
|
||||
#if FULL_SYSTEM
|
||||
void connectMemPorts(ThreadContext *tc);
|
||||
|
||||
void connectPhysPort();
|
||||
|
||||
void connectVirtPort(ThreadContext *tc);
|
||||
/**
|
||||
* Initialise the physical and virtual port proxies and tie them to
|
||||
* the data port of the CPU.
|
||||
*
|
||||
* tc ThreadContext for the virtual-to-physical translation
|
||||
*/
|
||||
void initMemProxies(ThreadContext *tc);
|
||||
|
||||
void dumpFuncProfile();
|
||||
|
||||
@@ -109,17 +112,13 @@ struct ThreadState {
|
||||
|
||||
TheISA::Kernel::Statistics *getKernelStats() { return kernelStats; }
|
||||
|
||||
FunctionalPort *getPhysPort() { return physPort; }
|
||||
PortProxy* getPhysProxy() { return physProxy; }
|
||||
|
||||
void setPhysPort(FunctionalPort *port) { physPort = port; }
|
||||
|
||||
VirtualPort *getVirtPort() { return virtPort; }
|
||||
FSTranslatingPortProxy* getVirtProxy() { return virtProxy; }
|
||||
#else
|
||||
Process *getProcessPtr() { return process; }
|
||||
|
||||
TranslatingPort *getMemPort();
|
||||
|
||||
void setMemPort(TranslatingPort *_port) { port = _port; }
|
||||
SETranslatingPortProxy* getMemProxy();
|
||||
#endif
|
||||
|
||||
/** Reads the number of instructions functionally executed and
|
||||
@@ -139,9 +138,6 @@ struct ThreadState {
|
||||
void setStatus(Status new_status) { _status = new_status; }
|
||||
|
||||
public:
|
||||
/** Connects port to the functional port of the memory object
|
||||
* below the CPU. */
|
||||
void connectToMemFunc(Port *port);
|
||||
|
||||
/** Number of instructions committed. */
|
||||
Counter numInst;
|
||||
@@ -186,15 +182,15 @@ struct ThreadState {
|
||||
|
||||
TheISA::Kernel::Statistics *kernelStats;
|
||||
protected:
|
||||
/** A functional port outgoing only for functional accesses to physical
|
||||
/** A port proxy outgoing only for functional accesses to physical
|
||||
* addresses.*/
|
||||
FunctionalPort *physPort;
|
||||
PortProxy *physProxy;
|
||||
|
||||
/** A functional port, outgoing only, for functional accesse to virtual
|
||||
* addresses. */
|
||||
VirtualPort *virtPort;
|
||||
/** A translating port proxy, outgoing only, for functional
|
||||
* accesse to virtual addresses. */
|
||||
FSTranslatingPortProxy* virtProxy;
|
||||
#else
|
||||
TranslatingPort *port;
|
||||
SETranslatingPortProxy* proxy;
|
||||
|
||||
Process *process;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user