summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2008-07-01 10:25:07 -0400
committerAli Saidi <saidi@eecs.umich.edu>2008-07-01 10:25:07 -0400
commita4a7a09e9622d6ad1ca91a4df253b9768c73de90 (patch)
tree828d818d5420c123f005a3b4617abc1689628406
parentc5fbbf376a6be4bb3ad7ddc64841450541c16db6 (diff)
downloadgem5-a4a7a09e9622d6ad1ca91a4df253b9768c73de90.tar.xz
Remove delVirtPort() and make getVirtPort() only return cached version.
-rw-r--r--src/arch/alpha/linux/system.cc1
-rw-r--r--src/arch/alpha/stacktrace.cc4
-rw-r--r--src/arch/alpha/utility.cc1
-rw-r--r--src/arch/mips/linux/system.cc1
-rw-r--r--src/arch/mips/stacktrace.cc4
-rw-r--r--src/arch/mips/utility.cc1
-rw-r--r--src/arch/sparc/stacktrace.cc4
-rw-r--r--src/arch/sparc/utility.cc1
-rw-r--r--src/arch/x86/stacktrace.cc4
-rw-r--r--src/base/remote_gdb.cc7
-rw-r--r--src/cpu/checker/thread_context.hh4
-rwxr-xr-xsrc/cpu/o3/thread_context.hh4
-rwxr-xr-xsrc/cpu/o3/thread_context_impl.hh23
-rw-r--r--src/cpu/ozone/cpu.hh6
-rw-r--r--src/cpu/ozone/cpu_impl.hh10
-rw-r--r--src/cpu/simple_thread.cc23
-rw-r--r--src/cpu/simple_thread.hh11
-rw-r--r--src/cpu/thread_context.hh8
-rw-r--r--src/cpu/thread_state.hh4
-rw-r--r--src/mem/vport.cc7
-rw-r--r--src/sim/vptr.hh1
21 files changed, 15 insertions, 114 deletions
diff --git a/src/arch/alpha/linux/system.cc b/src/arch/alpha/linux/system.cc
index 102598716..a52bcae36 100644
--- a/src/arch/alpha/linux/system.cc
+++ b/src/arch/alpha/linux/system.cc
@@ -169,7 +169,6 @@ LinuxAlphaSystem::setDelayLoop(ThreadContext *tc)
vp = tc->getVirtPort();
vp->writeHtoG(addr, (uint32_t)((cpuFreq / intrFreq) * 0.9988));
- tc->delVirtPort(vp);
}
}
diff --git a/src/arch/alpha/stacktrace.cc b/src/arch/alpha/stacktrace.cc
index c16498e72..124949781 100644
--- a/src/arch/alpha/stacktrace.cc
+++ b/src/arch/alpha/stacktrace.cc
@@ -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;
}
diff --git a/src/arch/alpha/utility.cc b/src/arch/alpha/utility.cc
index 94e82adf3..23abceb93 100644
--- a/src/arch/alpha/utility.cc
+++ b/src/arch/alpha/utility.cc
@@ -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
diff --git a/src/arch/mips/linux/system.cc b/src/arch/mips/linux/system.cc
index bed863e9d..23062c96b 100644
--- a/src/arch/mips/linux/system.cc
+++ b/src/arch/mips/linux/system.cc
@@ -168,7 +168,6 @@ LinuxMipsSystem::setDelayLoop(ThreadContext *tc)
vp = tc->getVirtPort();
vp->writeHtoG(addr, (uint32_t)((cpuFreq / intrFreq) * 0.9988));
- tc->delVirtPort(vp);
}
}
diff --git a/src/arch/mips/stacktrace.cc b/src/arch/mips/stacktrace.cc
index 6c6f6bb3c..482d264e8 100644
--- a/src/arch/mips/stacktrace.cc
+++ b/src/arch/mips/stacktrace.cc
@@ -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;
}
diff --git a/src/arch/mips/utility.cc b/src/arch/mips/utility.cc
index 52c52f8e7..36cf76c67 100644
--- a/src/arch/mips/utility.cc
+++ b/src/arch/mips/utility.cc
@@ -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
diff --git a/src/arch/sparc/stacktrace.cc b/src/arch/sparc/stacktrace.cc
index 2d7991267..8ec1d36c8 100644
--- a/src/arch/sparc/stacktrace.cc
+++ b/src/arch/sparc/stacktrace.cc
@@ -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;
}
diff --git a/src/arch/sparc/utility.cc b/src/arch/sparc/utility.cc
index 0677823af..8f5c3e036 100644
--- a/src/arch/sparc/utility.cc
+++ b/src/arch/sparc/utility.cc
@@ -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
diff --git a/src/arch/x86/stacktrace.cc b/src/arch/x86/stacktrace.cc
index 300e8dcd0..87767583b 100644
--- a/src/arch/x86/stacktrace.cc
+++ b/src/arch/x86/stacktrace.cc
@@ -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;
}
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 1a858a3f3..51293e118 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -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
diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh
index 15454c3fe..4ede74c64 100644
--- a/src/cpu/checker/thread_context.hh
+++ b/src/cpu/checker/thread_context.hh
@@ -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(); }
diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh
index 44e26729c..66dc47f0b 100755
--- a/src/cpu/o3/thread_context.hh
+++ b/src/cpu/o3/thread_context.hh
@@ -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
diff --git a/src/cpu/o3/thread_context_impl.hh b/src/cpu/o3/thread_context_impl.hh
index 865d58635..a521c3636 100755
--- a/src/cpu/o3/thread_context_impl.hh
+++ b/src/cpu/o3/thread_context_impl.hh
@@ -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)
diff --git a/src/cpu/ozone/cpu.hh b/src/cpu/ozone/cpu.hh
index b0ea2cba9..c3ea33673 100644
--- a/src/cpu/ozone/cpu.hh
+++ b/src/cpu/ozone/cpu.hh
@@ -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(); }
diff --git a/src/cpu/ozone/cpu_impl.hh b/src/cpu/ozone/cpu_impl.hh
index 0c7105382..ec531d571 100644
--- a/src/cpu/ozone/cpu_impl.hh
+++ b/src/cpu/ozone/cpu_impl.hh
@@ -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)
diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc
index 5a5444de4..8d5c4eafb 100644
--- a/src/cpu/simple_thread.cc
+++ b/src/cpu/simple_thread.cc
@@ -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
-
diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh
index fa80a283a..37c3221f5 100644
--- a/src/cpu/simple_thread.hh
+++ b/src/cpu/simple_thread.hh
@@ -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; }
diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh
index b25a67d59..b1687a494 100644
--- a/src/cpu/thread_context.hh
+++ b/src/cpu/thread_context.hh
@@ -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
diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh
index b6a62eebc..1b667f72a 100644
--- a/src/cpu/thread_state.hh
+++ b/src/cpu/thread_state.hh
@@ -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; }
diff --git a/src/mem/vport.cc b/src/mem/vport.cc
index a2f8b1ecc..15be45c2a 100644
--- a/src/mem/vport.cc
+++ b/src/mem/vport.cc
@@ -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);
}
diff --git a/src/sim/vptr.hh b/src/sim/vptr.hh
index 88b515c13..09aa2d213 100644
--- a/src/sim/vptr.hh
+++ b/src/sim/vptr.hh
@@ -73,7 +73,6 @@ class VPtr
VirtualPort *port = tc->getVirtPort();
port->readBlob(ptr, buffer, sizeof(T));
- tc->delVirtPort(port);
}
bool