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
std::vector<ExecContext *> execContexts;
public:
- virtual void execCtxStatusChg() {}
+ virtual void execCtxStatusChg(int thread_num) {}
public:
virtual void regStats();
- virtual void registerExecContexts();
+ void registerExecContexts();
/// Prepare for another CPU to take over execution. Called by
/// takeOverFrom() on its argument.
ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_sys,
AlphaItb *_itb, AlphaDtb *_dtb,
FunctionalMemory *_mem)
- : kernelStats(this, _cpu), cpu(_cpu), thread_num(_thread_num),
+ : _status(ExecContext::Unallocated),
+ kernelStats(this, _cpu), cpu(_cpu), thread_num(_thread_num),
cpu_id(-1), mem(_mem), itb(_itb), dtb(_dtb), system(_sys),
memCtrl(_sys->memCtrl), physmem(_sys->physmem),
func_exe_insn(0), storeCondFailures(0)
{
memset(®s, 0, sizeof(RegFile));
- setStatus(ExecContext::Unallocated);
}
#else
ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num,
Process *_process, int _asid)
- : cpu(_cpu), thread_num(_thread_num), cpu_id(-1),
- process(_process), asid (_asid),
+ : _status(ExecContext::Unallocated),
+ cpu(_cpu), thread_num(_thread_num), cpu_id(-1),
+ process(_process), mem(process->getMemory()), asid(_asid),
func_exe_insn(0), storeCondFailures(0)
{
- setStatus(ExecContext::Unallocated);
-
- mem = process->getMemory();
}
ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num,
#endif
_status = new_status;
- cpu->execCtxStatusChg();
+ cpu->execCtxStatusChg(thread_num);
}
void
public:
Status status() const { return _status; }
- // Unlike setStatus(), initStatus() has no side effects other than
- // setting the _status variable.
- void initStatus(Status init_status) { _status = init_status; }
-
void setStatus(Status new_status);
#ifdef FULL_SYSTEM
}
-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()
{
}
+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()
{
// execution context
ExecContext *xc;
- void registerExecContexts();
-
void switchOut();
void takeOverFrom(BaseCPU *oldCPU);
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();
fatal("Could not load PALcode file %s", palcode);
pal->loadSections(physmem, true);
- // copy of initial reg file contents
- initRegs = new RegFile;
- memset(initRegs, 0, sizeof(RegFile));
-
// Load console file
console->loadSections(physmem, true);
"Kernel entry = %#x\n",
kernelStart, kernelEnd, kernelEntry);
- // Setup kernel boot parameters
- initRegs->pc = 0x4001;
- initRegs->npc = initRegs->pc + sizeof(MachInst);
-
DPRINTF(Loader, "Kernel loaded...\n");
kernelPanicEvent = new BreakPCEvent(&pcEventQueue, "kernel panic");
Tru64System::~Tru64System()
{
- delete initRegs;
-
delete kernel;
delete console;
int xcIndex = System::registerExecContext(xc);
if (xcIndex == 0) {
- // xc->regs = *initRegs;
- xc->initStatus(ExecContext::Active);
- }
- else {
- xc->initStatus(ExecContext::Unallocated);
+ xc->setStatus(ExecContext::Active);
}
RemoteGDB *rgdb = new RemoteGDB(this, xc);
DumpMbufEvent *dumpMbufEvent;
private:
- RegFile *initRegs;
Addr kernelStart;
Addr kernelEnd;
xc->regs = *init_regs;
// mark this context as active
- xc->initStatus(ExecContext::Active);
- }
- else {
- xc->initStatus(ExecContext::Unallocated);
+ xc->setStatus(ExecContext::Active);
}
// return CPU number to caller and increment available CPU count