From f5da73b6881991a28844ed59e8dcc1d154ddae7e Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 23 Oct 2003 19:07:52 -0700 Subject: Initial support for CPU switching. New SamplingCPU object encompasses a set of CPUs that get switched round-robin (though currently we're only shooting for two CPUs and one switch event, and even that doesn't quite work yet). Registration of ExecContexts with System/Process object factored out so we can create two CPUs but only register one of them at a time. Also worked at making behavior and naming in System and Process objects more consistent. arch/alpha/ev5.cc: Rename ipr_init to initIPRs and get rid of unused mem arg. arch/alpha/fake_syscall.cc: Process:numCpus is now a function (not a data member). base/remote_gdb.hh: Support for ExecContext switching. cpu/base_cpu.cc: cpu/base_cpu.hh: cpu/exec_context.cc: cpu/exec_context.hh: cpu/simple_cpu/simple_cpu.hh: Support for ExecContext switching. Renamed contexts array to execContexts to be consistent with Process. CPU ID now auto-assigned by system object. cpu/simple_cpu/simple_cpu.cc: Support for ExecContext switching. Renamed contexts array to execContexts to be consistent with Process. CPU ID now auto-assigned by system object. Cleaned up MP full-system initialization a bit. dev/alpha_console.cc: Renamed xcvec array to execContexts to be consistent with Process. kern/tru64/tru64_system.cc: kern/tru64/tru64_system.hh: Support for ExecContext switching. CPU ID now auto-assigned by system object. sim/prog.cc: sim/prog.hh: Support for ExecContext switching. Process:numCpus is now a function (not a data member). sim/system.cc: sim/system.hh: Support for ExecContext switching. Renamed xcvec array to execContexts to be consistent with Process. --HG-- extra : convert_revision : 79649cffad5bf3e83de8df44236941907926d791 --- cpu/exec_context.hh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'cpu/exec_context.hh') diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index 4a2688f1c..817c72b3b 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -67,6 +67,11 @@ class ExecContext 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 @@ -83,12 +88,15 @@ class ExecContext // Index of hardware thread context on the CPU that this represents. int thread_num; + // ID of this context w.r.t. the System or Process object to which + // it belongs. For full-system mode, this is the system CPU ID. + int cpu_id; + #ifdef FULL_SYSTEM FunctionalMemory *mem; AlphaItb *itb; AlphaDtb *dtb; - int cpu_id; System *system; // the following two fields are redundant, since we can always @@ -124,8 +132,7 @@ class ExecContext // constructor: initialize context from given process structure #ifdef FULL_SYSTEM ExecContext(BaseCPU *_cpu, int _thread_num, System *_system, - AlphaItb *_itb, AlphaDtb *_dtb, FunctionalMemory *_dem, - int _cpu_id); + AlphaItb *_itb, AlphaDtb *_dtb, FunctionalMemory *_dem); #else ExecContext(BaseCPU *_cpu, int _thread_num, Process *_process, int _asid); ExecContext(BaseCPU *_cpu, int _thread_num, FunctionalMemory *_mem, @@ -133,6 +140,8 @@ class ExecContext #endif virtual ~ExecContext() {} + virtual void takeOverFrom(ExecContext *oldContext); + void regStats(const std::string &name); #ifdef FULL_SYSTEM @@ -156,7 +165,6 @@ class ExecContext return dtb->translate(req, true); } - #else bool validInstAddr(Addr addr) { return process->validInstAddr(addr); } @@ -244,8 +252,8 @@ class ExecContext // and all other stores (WH64?). Unsuccessful Store // Conditionals would have returned above, and wouldn't fall // through. - for (int i = 0; i < system->xcvec.size(); i++){ - cregs = &system->xcvec[i]->regs.miscRegs; + for (int i = 0; i < system->execContexts.size(); i++){ + cregs = &system->execContexts[i]->regs.miscRegs; if ((cregs->lock_addr & ~0xf) == (req->paddr & ~0xf)) { cregs->lock_flag = false; } -- cgit v1.2.3