36a37
> #include "mem/fs_translating_port_proxy.hh"
38,39c39,40
< #include "mem/translating_port.hh"
< #include "mem/vport.hh"
---
> #include "mem/port_proxy.hh"
> #include "mem/se_translating_port_proxy.hh"
41a43
> #include "sim/system.hh"
47,48c49,50
< kernelStats(NULL), process(_process), port(NULL), virtPort(NULL),
< physPort(NULL), funcExeInst(0), storeCondFailures(0)
---
> kernelStats(NULL), process(_process), physProxy(NULL), virtProxy(NULL),
> proxy(NULL), funcExeInst(0), storeCondFailures(0)
54,57c56,61
< if (port) {
< delete port->getPeer();
< delete port;
< }
---
> if (physProxy != NULL)
> delete physProxy;
> if (virtProxy != NULL)
> delete virtProxy;
> if (proxy != NULL)
> delete proxy;
96c100
< ThreadState::connectPhysPort()
---
> ThreadState::initMemProxies(ThreadContext *tc)
98,106c102,109
< // @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);
---
> // 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);
110,130d112
< 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);
< }
<
< void
< ThreadState::connectMemPorts(ThreadContext *tc)
< {
< connectPhysPort();
< connectVirtPort(tc);
< }
<
< void
144,145c126,127
< TranslatingPort *
< ThreadState::getMemPort()
---
> SETranslatingPortProxy *
> ThreadState::getMemProxy()
147,148c129,130
< if (port != NULL)
< return port;
---
> if (proxy != NULL)
> return proxy;
150,152c132,135
< /* 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);
154,156c137
< connectToMemFunc(port);
<
< return port;
---
> return proxy;
158,175d138
<
< 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);
< }