summaryrefslogtreecommitdiff
path: root/cpu/simple_cpu
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2003-10-24 23:02:36 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2003-10-24 23:02:36 -0700
commit91cb532f9f44874e768ba749df03ca1f4dc07bc9 (patch)
tree71e2b0173f5ed7c2e84968e525973f514fb9b1b8 /cpu/simple_cpu
parentcd6b6df581f554805a5a1388ccd78044d91a2663 (diff)
downloadgem5-91cb532f9f44874e768ba749df03ca1f4dc07bc9.tar.xz
Make FullCPU schedule its TickEvent when one of its contexts becomes active.
This fixes detailed-mpboot, which was broken as of my last change. Also clean up some of the ExecContext status initialization. cpu/base_cpu.hh: CPU::execCtxStatusChg() now takes thread_num as an arg so the CPU knows which execContext had the status change. BaseCPU::registerExecContexts() no longer needs to be virtual. cpu/exec_context.cc: Initialize _status directly... don't use setStatus() as this will notify the CPU of the change before it is ready. CPU::execCtxStatusChg() now takes thread_num as an arg so the CPU knows which execContext had the status change. cpu/exec_context.hh: Don't need initStatus() any more. cpu/simple_cpu/simple_cpu.cc: Move execCtxStatusChg() from header to .cc file. No longer need specialized version of registerExecContexts to schedule TickEvent. cpu/simple_cpu/simple_cpu.hh: Move execCtxStatusChg() from header to .cc file. CPU::execCtxStatusChg() now takes thread_num as arg (must be 0 for SimpleCPU). No longer need specialized version of registerExecContexts to schedule TickEvent. kern/tru64/tru64_system.cc: Don't need initRegs; the PC etc. get initialized in the CPU constructor. ExecContexts start out as Unallocated, so no need to set them to Unallocated here. kern/tru64/tru64_system.hh: Don't need initRegs; the PC etc. get initialized in the CPU constructor. sim/prog.cc: ExecContexts start out as Unallocated, so no need to set them to Unallocated here. --HG-- extra : convert_revision : e960ebbeb845960344633798e251b6c8bf1c0378
Diffstat (limited to 'cpu/simple_cpu')
-rw-r--r--cpu/simple_cpu/simple_cpu.cc31
-rw-r--r--cpu/simple_cpu/simple_cpu.hh11
2 files changed, 13 insertions, 29 deletions
diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc
index 41e3de24e..891e6cdb3 100644
--- a/cpu/simple_cpu/simple_cpu.cc
+++ b/cpu/simple_cpu/simple_cpu.cc
@@ -164,25 +164,6 @@ SimpleCPU::~SimpleCPU()
void
-SimpleCPU::registerExecContexts()
-{
- BaseCPU::registerExecContexts();
-
- // if any of this CPU's ExecContexts are active, mark the CPU as
- // running and schedule its tick event.
- for (int i = 0; i < execContexts.size(); ++i) {
- ExecContext *xc = execContexts[i];
- if (xc->status() == ExecContext::Active && _status != Running) {
- _status = Running;
- // this should only happen at initialization time
- assert(curTick == 0);
- tickEvent.schedule(0);
- }
- }
-}
-
-
-void
SimpleCPU::switchOut()
{
_status = SwitchedOut;
@@ -213,6 +194,18 @@ SimpleCPU::takeOverFrom(BaseCPU *oldCPU)
void
+SimpleCPU::execCtxStatusChg(int thread_num) {
+ assert(thread_num == 0);
+ assert(xc);
+
+ if (xc->status() == ExecContext::Active)
+ setStatus(Running);
+ else
+ setStatus(Idle);
+}
+
+
+void
SimpleCPU::regStats()
{
BaseCPU::regStats();
diff --git a/cpu/simple_cpu/simple_cpu.hh b/cpu/simple_cpu/simple_cpu.hh
index e1b351cab..60c038163 100644
--- a/cpu/simple_cpu/simple_cpu.hh
+++ b/cpu/simple_cpu/simple_cpu.hh
@@ -136,8 +136,6 @@ class SimpleCPU : public BaseCPU
// execution context
ExecContext *xc;
- void registerExecContexts();
-
void switchOut();
void takeOverFrom(BaseCPU *oldCPU);
@@ -178,14 +176,7 @@ class SimpleCPU : public BaseCPU
Status status() const { return _status; }
- virtual void execCtxStatusChg() {
- if (xc) {
- if (xc->status() == ExecContext::Active)
- setStatus(Running);
- else
- setStatus(Idle);
- }
- }
+ virtual void execCtxStatusChg(int thread_num);
void setStatus(Status new_status) {
Status old_status = status();