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 --- sim/prog.hh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'sim/prog.hh') diff --git a/sim/prog.hh b/sim/prog.hh index ee4bc59fe..e93dd684c 100644 --- a/sim/prog.hh +++ b/sim/prog.hh @@ -36,7 +36,7 @@ // #ifndef FULL_SYSTEM -#include +#include #include "targetarch/isa_traits.hh" #include "sim/sim_object.hh" @@ -55,10 +55,10 @@ class Process : public SimObject bool initialContextLoaded; // execution contexts associated with this process - std::list execContexts; - // number of CPUs assigned to this process: should match number of - // contexts in execContexts list - unsigned numCpus; + std::vector execContexts; + + // number of CPUs (esxec contexts, really) assigned to this process. + unsigned int numCpus() { return execContexts.size(); } // record of blocked context struct WaitRec @@ -123,8 +123,12 @@ class Process : public SimObject // override of virtual SimObject method: register statistics virtual void regStats(); - // register an execution context for this process - void registerExecContext(ExecContext *); + // register an execution context for this process. + // returns xc's cpu number (index into execContexts[]) + int registerExecContext(ExecContext *xc); + + + void replaceExecContext(int xcIndex, ExecContext *xc); // map simulator fd sim_fd to target fd tgt_fd void dup_fd(int sim_fd, int tgt_fd); -- cgit v1.2.3