summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2006-07-03 12:19:35 -0400
committerKorey Sewell <ksewell@umich.edu>2006-07-03 12:19:35 -0400
commitf4c5609988731f52f9c5bd84ee2db364bbf6fd97 (patch)
treedcd03e8a0c559afe634358dc301631e87e87e2ac /src
parent19083bc4ce379c03b39ba941c18b11a88b141e18 (diff)
downloadgem5-f4c5609988731f52f9c5bd84ee2db364bbf6fd97.tar.xz
Fix for FS O3CPU compile ... missing forward class declaration/header file after files got split for ISA-independence
src/cpu/o3/alpha/thread_context.hh: Use 'this' when accessing cpu src/cpu/o3/cpu.hh: add numActiveThreds function src/cpu/o3/thread_context.hh: forward class declarations src/cpu/o3/thread_context_impl.hh: add quiesce event header file src/cpu/thread_context.hh: add exit() function to thread context (read comments in file) src/sim/syscall_emul.cc: adjust exitFunc syscall --HG-- extra : convert_revision : 323dc871e2b4f4ee5036be388ceb6634cd85a83e
Diffstat (limited to 'src')
-rw-r--r--src/cpu/o3/alpha/thread_context.hh24
-rw-r--r--src/cpu/o3/cpu.hh4
-rwxr-xr-xsrc/cpu/o3/thread_context.hh7
-rwxr-xr-xsrc/cpu/o3/thread_context_impl.hh1
-rw-r--r--src/cpu/thread_context.hh5
-rw-r--r--src/sim/syscall_emul.cc5
6 files changed, 40 insertions, 6 deletions
diff --git a/src/cpu/o3/alpha/thread_context.hh b/src/cpu/o3/alpha/thread_context.hh
index 57190d65e..78b0ee788 100644
--- a/src/cpu/o3/alpha/thread_context.hh
+++ b/src/cpu/o3/alpha/thread_context.hh
@@ -37,21 +37,21 @@ class AlphaTC : public O3ThreadContext<Impl>
public:
#if FULL_SYSTEM
/** Returns a pointer to the ITB. */
- virtual AlphaITB *getITBPtr() { return cpu->itb; }
+ virtual AlphaITB *getITBPtr() { return this->cpu->itb; }
/** Returns a pointer to the DTB. */
- virtual AlphaDTB *getDTBPtr() { return cpu->dtb; }
+ virtual AlphaDTB *getDTBPtr() { return this->cpu->dtb; }
/** Returns pointer to the quiesce event. */
virtual EndQuiesceEvent *getQuiesceEvent()
{
- return thread->quiesceEvent;
+ return this->thread->quiesceEvent;
}
/** Returns if the thread is currently in PAL mode, based on
* the PC's value. */
virtual bool inPalMode()
- { return TheISA::PcPAL(cpu->readPC(thread->readTid())); }
+ { return TheISA::PcPAL(this->cpu->readPC(this->thread->readTid())); }
#endif
virtual uint64_t readNextNPC()
@@ -68,4 +68,20 @@ class AlphaTC : public O3ThreadContext<Impl>
virtual void changeRegFileContext(TheISA::RegFile::ContextParam param,
TheISA::RegFile::ContextVal val)
{ panic("Not supported on Alpha!"); }
+
+
+ // This function exits the thread context in the CPU and returns
+ // 1 if the CPU has no more active threads (meaning it's OK to exit);
+ // Used in syscall-emulation mode when a thread executes the 'exit'
+ // syscall.
+ virtual int exit()
+ {
+ this->cpu->deallocateContext(this->thread->readTid());
+
+ // If there are still threads executing in the system
+ if (this->cpu->numActiveThreads())
+ return 0;
+ else
+ return 1;
+ }
};
diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh
index 2a9ecff4e..1cff6142d 100644
--- a/src/cpu/o3/cpu.hh
+++ b/src/cpu/o3/cpu.hh
@@ -214,6 +214,10 @@ class FullO3CPU : public BaseO3CPU
/** Initialize the CPU */
void init();
+ /** Returns the Number of Active Threads in the CPU */
+ int numActiveThreads()
+ { return activeThreads.size(); }
+
/** Add Thread to Active Threads List */
void activateThread(unsigned int tid);
diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh
index d60867029..d097ee63e 100755
--- a/src/cpu/o3/thread_context.hh
+++ b/src/cpu/o3/thread_context.hh
@@ -34,6 +34,13 @@
#include "cpu/o3/isa_specific.hh"
+class EndQuiesceEvent;
+namespace Kernel {
+ class Statistics;
+};
+
+class TranslatingPort;
+
/**
* Derived ThreadContext class for use with the O3CPU. It
* provides the interface for any external objects to access a
diff --git a/src/cpu/o3/thread_context_impl.hh b/src/cpu/o3/thread_context_impl.hh
index fccabaf36..cfb71f623 100755
--- a/src/cpu/o3/thread_context_impl.hh
+++ b/src/cpu/o3/thread_context_impl.hh
@@ -30,6 +30,7 @@
*/
#include "cpu/o3/thread_context.hh"
+#include "cpu/quiesce_event.hh"
using namespace TheISA;
diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh
index 3c79e1116..70d705144 100644
--- a/src/cpu/thread_context.hh
+++ b/src/cpu/thread_context.hh
@@ -247,6 +247,11 @@ class ThreadContext
// Same with st cond failures.
virtual Counter readFuncExeInst() = 0;
+
+ // This function exits the thread context in the CPU and returns
+ // 1 if the CPU has no more active threads (meaning it's OK to exit);
+ // Used in syscall-emulation mode when a thread calls the exit syscall.
+ virtual int exit() { return 1; };
#endif
virtual void changeRegFileContext(RegFile::ContextParam param,
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 848b6f869..e72890612 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -27,7 +27,6 @@
*
* Authors: Steve Reinhardt
* Ali Saidi
- * Korey Sewell
*/
#include <fcntl.h>
@@ -92,7 +91,9 @@ SyscallReturn
exitFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
- exitSimLoop("target called exit()", tc->getSyscallArg(0) & 0xff);
+ if (tc->exit()) {
+ exitSimLoop("target called exit()", tc->getSyscallArg(0) & 0xff);
+ }
return 1;
}