Remove delVirtPort() and make getVirtPort() only return cached version.

This commit is contained in:
Ali Saidi 2008-07-01 10:25:07 -04:00
parent c5fbbf376a
commit a4a7a09e96
21 changed files with 15 additions and 114 deletions

View file

@ -169,7 +169,6 @@ LinuxAlphaSystem::setDelayLoop(ThreadContext *tc)
vp = tc->getVirtPort();
vp->writeHtoG(addr, (uint32_t)((cpuFreq / intrFreq) * 0.9988));
tc->delVirtPort(vp);
}
}

View file

@ -71,8 +71,6 @@ namespace AlphaISA
if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
panic("thread info not compiled into kernel\n");
name_off = vp->readGtoH<int32_t>(addr);
tc->delVirtPort(vp);
}
Addr
@ -88,7 +86,6 @@ namespace AlphaISA
vp = tc->getVirtPort();
tsk = vp->readGtoH<Addr>(base + task_off);
tc->delVirtPort(vp);
return tsk;
}
@ -106,7 +103,6 @@ namespace AlphaISA
vp = tc->getVirtPort();
pd = vp->readGtoH<uint16_t>(task + pid_off);
tc->delVirtPort(vp);
return pd;
}

View file

@ -52,7 +52,6 @@ uint64_t getArgument(ThreadContext *tc, int number, bool fp)
VirtualPort *vp = tc->getVirtPort();
uint64_t arg = vp->read<uint64_t>(sp +
(number-NumArgumentRegs) * sizeof(uint64_t));
tc->delVirtPort(vp);
return arg;
}
#else

View file

@ -168,7 +168,6 @@ LinuxMipsSystem::setDelayLoop(ThreadContext *tc)
vp = tc->getVirtPort();
vp->writeHtoG(addr, (uint32_t)((cpuFreq / intrFreq) * 0.9988));
tc->delVirtPort(vp);
}
}

View file

@ -70,8 +70,6 @@ ProcessInfo::ProcessInfo(ThreadContext *_tc)
// if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
// panic("thread info not compiled into kernel\n");
// name_off = vp->readGtoH<int32_t>(addr);
tc->delVirtPort(vp);
}
Addr
@ -87,7 +85,6 @@ ProcessInfo::task(Addr ksp) const
vp = tc->getVirtPort();
tsk = vp->readGtoH<Addr>(base + task_off);
tc->delVirtPort(vp);
return tsk;
}
@ -105,7 +102,6 @@ ProcessInfo::pid(Addr ksp) const
vp = tc->getVirtPort();
pd = vp->readGtoH<uint16_t>(task + pid_off);
tc->delVirtPort(vp);
return pd;
}

View file

@ -62,7 +62,6 @@ getArgument(ThreadContext *tc, int number, bool fp)
VirtualPort *vp = tc->getVirtPort();
uint64_t arg = vp->read<uint64_t>(sp +
(number-NumArgumentRegs) * sizeof(uint64_t));
tc->delVirtPort(vp);
return arg;
}
#else

View file

@ -70,8 +70,6 @@ namespace SparcISA
if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
panic("thread info not compiled into kernel\n");
name_off = vp->readGtoH<int32_t>(addr);
tc->delVirtPort(vp);
}
Addr
@ -87,7 +85,6 @@ namespace SparcISA
vp = tc->getVirtPort();
tsk = vp->readGtoH<Addr>(base + task_off);
tc->delVirtPort(vp);
return tsk;
}
@ -105,7 +102,6 @@ namespace SparcISA
vp = tc->getVirtPort();
pd = vp->readGtoH<uint16_t>(task + pid_off);
tc->delVirtPort(vp);
return pd;
}

View file

@ -53,7 +53,6 @@ uint64_t getArgument(ThreadContext *tc, int number, bool fp) {
VirtualPort *vp = tc->getVirtPort();
uint64_t arg = vp->read<uint64_t>(sp + 92 +
(number-NumArgumentRegs) * sizeof(uint64_t));
tc->delVirtPort(vp);
return arg;
}
#else

View file

@ -70,8 +70,6 @@ namespace X86ISA
if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
panic("thread info not compiled into kernel\n");
name_off = vp->readGtoH<int32_t>(addr);
tc->delVirtPort(vp);
}
Addr
@ -87,7 +85,6 @@ namespace X86ISA
vp = tc->getVirtPort();
tsk = vp->readGtoH<Addr>(base + task_off);
tc->delVirtPort(vp);
return tsk;
}
@ -105,7 +102,6 @@ namespace X86ISA
vp = tc->getVirtPort();
pd = vp->readGtoH<uint16_t>(task + pid_off);
tc->delVirtPort(vp);
return pd;
}

View file

@ -459,9 +459,6 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data)
TranslatingPort *port = context->getMemPort();
#endif
port->readBlob(vaddr, (uint8_t*)data, size);
#if FULL_SYSTEM
context->delVirtPort(port);
#endif
#if TRACING_ON
if (DTRACE(GDBRead)) {
@ -504,9 +501,7 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data)
TranslatingPort *port = context->getMemPort();
#endif
port->writeBlob(vaddr, (uint8_t*)data, size);
#if FULL_SYSTEM
context->delVirtPort(port);
#else
#if !FULL_SYSTEM
delete port;
#endif

View file

@ -98,10 +98,8 @@ class CheckerThreadContext : public ThreadContext
FunctionalPort *getPhysPort() { return actualTC->getPhysPort(); }
VirtualPort *getVirtPort(ThreadContext *tc = NULL)
VirtualPort *getVirtPort()
{ return actualTC->getVirtPort(); }
void delVirtPort(VirtualPort *vp) { actualTC->delVirtPort(vp); }
#else
TranslatingPort *getMemPort() { return actualTC->getMemPort(); }

View file

@ -94,9 +94,7 @@ class O3ThreadContext : public ThreadContext
virtual FunctionalPort *getPhysPort() { return thread->getPhysPort(); }
virtual VirtualPort *getVirtPort(ThreadContext *src_tc = NULL);
void delVirtPort(VirtualPort *vp);
virtual VirtualPort *getVirtPort();
virtual void connectMemPorts(ThreadContext *tc) { thread->connectMemPorts(tc); }
#else

View file

@ -36,16 +36,9 @@
#if FULL_SYSTEM
template <class Impl>
VirtualPort *
O3ThreadContext<Impl>::getVirtPort(ThreadContext *src_tc)
O3ThreadContext<Impl>::getVirtPort()
{
if (!src_tc)
return thread->getVirtPort();
VirtualPort *vp;
vp = new VirtualPort("tc-vport", src_tc);
thread->connectToMemFunc(vp);
return vp;
return thread->getVirtPort();
}
template <class Impl>
@ -97,18 +90,6 @@ O3ThreadContext<Impl>::takeOverFrom(ThreadContext *old_context)
thread->trapPending = false;
}
#if FULL_SYSTEM
template <class Impl>
void
O3ThreadContext<Impl>::delVirtPort(VirtualPort *vp)
{
if (vp != thread->getVirtPort()) {
vp->removeConn();
delete vp;
}
}
#endif
template <class Impl>
void
O3ThreadContext<Impl>::activate(int delay)

View file

@ -134,10 +134,8 @@ class OzoneCPU : public BaseCPU
FunctionalPort *getPhysPort() { return thread->getPhysPort(); }
VirtualPort *getVirtPort(ThreadContext *tc = NULL)
{ return thread->getVirtPort(tc); }
void delVirtPort(VirtualPort *vp);
VirtualPort *getVirtPort()
{ return thread->getVirtPort(); }
#else
TranslatingPort *getMemPort() { return thread->getMemPort(); }

View file

@ -742,16 +742,6 @@ OzoneCPU<Impl>::OzoneTC::setCpuId(int id)
thread->setCpuId(id);
}
#if FULL_SYSTEM
template <class Impl>
void
OzoneCPU<Impl>::OzoneTC::delVirtPort(VirtualPort *vp)
{
vp->removeConn();
delete vp;
}
#endif
template <class Impl>
void
OzoneCPU<Impl>::OzoneTC::setStatus(Status new_status)

View file

@ -286,26 +286,3 @@ SimpleThread::copyArchRegs(ThreadContext *src_tc)
TheISA::copyRegs(src_tc, tc);
}
#if FULL_SYSTEM
VirtualPort*
SimpleThread::getVirtPort(ThreadContext *src_tc)
{
if (!src_tc)
return virtPort;
VirtualPort *vp = new VirtualPort("tc-vport", src_tc);
connectToMemFunc(vp);
return vp;
}
void
SimpleThread::delVirtPort(VirtualPort *vp)
{
if (vp != virtPort) {
vp->removeConn();
delete vp;
}
}
#endif

View file

@ -208,12 +208,11 @@ class SimpleThread : public ThreadState
FunctionalPort *getPhysPort() { return physPort; }
/** Return a virtual port. If no thread context is specified then a static
* port is returned. Otherwise a port is created and returned. It must be
* deleted by deleteVirtPort(). */
VirtualPort *getVirtPort(ThreadContext *tc);
void delVirtPort(VirtualPort *vp);
/** 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; }
#endif
Status status() const { return _status; }

View file

@ -130,9 +130,7 @@ class ThreadContext
virtual FunctionalPort *getPhysPort() = 0;
virtual VirtualPort *getVirtPort(ThreadContext *tc = NULL) = 0;
virtual void delVirtPort(VirtualPort *vp) = 0;
virtual VirtualPort *getVirtPort() = 0;
virtual void connectMemPorts(ThreadContext *tc) = 0;
#else
@ -321,9 +319,7 @@ class ProxyThreadContext : public ThreadContext
FunctionalPort *getPhysPort() { return actualTC->getPhysPort(); }
VirtualPort *getVirtPort(ThreadContext *tc = NULL) { return actualTC->getVirtPort(tc); }
void delVirtPort(VirtualPort *vp) { return actualTC->delVirtPort(vp); }
VirtualPort *getVirtPort() { return actualTC->getVirtPort(); }
void connectMemPorts(ThreadContext *tc) { actualTC->connectMemPorts(tc); }
#else

View file

@ -111,9 +111,7 @@ struct ThreadState {
void setPhysPort(FunctionalPort *port) { physPort = port; }
VirtualPort *getVirtPort(ThreadContext *tc = NULL) { return virtPort; }
void setVirtPort(VirtualPort *port) { virtPort = port; }
VirtualPort *getVirtPort() { return virtPort; }
#else
Process *getProcessPtr() { return process; }

View file

@ -78,9 +78,6 @@ CopyOut(ThreadContext *tc, void *dest, Addr src, size_t cplen)
VirtualPort *vp = tc->getVirtPort();
vp->readBlob(src, dst, cplen);
tc->delVirtPort(vp);
}
void
@ -90,8 +87,6 @@ CopyIn(ThreadContext *tc, Addr dest, void *source, size_t cplen)
VirtualPort *vp = tc->getVirtPort();
vp->writeBlob(dest, src, cplen);
tc->delVirtPort(vp);
}
void
@ -105,7 +100,6 @@ CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen)
vp->readBlob(vaddr++, (uint8_t*)dst++, 1);
} while (len < maxlen && start[len++] != 0 );
tc->delVirtPort(vp);
dst[len] = 0;
}
@ -119,5 +113,4 @@ CopyStringIn(ThreadContext *tc, char *src, Addr vaddr)
vp->writeBlob(gen.addr(), (uint8_t*)src, gen.size());
src += gen.size();
}
tc->delVirtPort(vp);
}

View file

@ -73,7 +73,6 @@ class VPtr
VirtualPort *port = tc->getVirtPort();
port->readBlob(ptr, buffer, sizeof(T));
tc->delVirtPort(port);
}
bool