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 --- kern/tru64/tru64_system.cc | 40 ++++++++++++++++++++++++++++++---------- kern/tru64/tru64_system.hh | 11 ++++++----- 2 files changed, 36 insertions(+), 15 deletions(-) (limited to 'kern') diff --git a/kern/tru64/tru64_system.cc b/kern/tru64/tru64_system.cc index 0a4f8ae4e..66eccf58c 100644 --- a/kern/tru64/tru64_system.cc +++ b/kern/tru64/tru64_system.cc @@ -184,24 +184,44 @@ Tru64System::~Tru64System() } -void -Tru64System::init(ExecContext *xc) +int +Tru64System::registerExecContext(ExecContext *xc) { - xc->regs = *initRegs; + int xcIndex = System::registerExecContext(xc); + + if (xcIndex == 0) { + // xc->regs = *initRegs; + xc->initStatus(ExecContext::Active); + } + else { + xc->initStatus(ExecContext::Unallocated); + } + + RemoteGDB *rgdb = new RemoteGDB(this, xc); + GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex); + gdbl->listen(); + + if (remoteGDB.size() <= xcIndex) { + remoteGDB.resize(xcIndex+1); + } + + remoteGDB[xcIndex] = rgdb; + + return xcIndex; +} - remoteGDB = new RemoteGDB(this, xc); - gdbListen = new GDBListener(remoteGDB, 7000); - gdbListen->listen(); - // Reset the system - // - TheISA::init(physmem, &xc->regs); +void +Tru64System::replaceExecContext(ExecContext *xc, int xcIndex) +{ + System::replaceExecContext(xcIndex, xc); + remoteGDB[xcIndex]->replaceExecContext(xc); } bool Tru64System::breakpoint() { - return remoteGDB->trap(ALPHA_KENTRY_IF); + return remoteGDB[0]->trap(ALPHA_KENTRY_IF); } BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64System) diff --git a/kern/tru64/tru64_system.hh b/kern/tru64/tru64_system.hh index 7fd337eb5..5a583d62c 100644 --- a/kern/tru64/tru64_system.hh +++ b/kern/tru64/tru64_system.hh @@ -29,6 +29,8 @@ #ifndef __TRU64_SYSTEM_HH__ #define __TRU64_SYSTEM_HH__ +#include + #include "sim/system.hh" #include "targetarch/isa_traits.hh" @@ -48,8 +50,6 @@ class AlphaArguments; class Tru64System : public System { private: - ExecContext *xc; - EcoffObject *kernel; EcoffObject *console; @@ -74,8 +74,8 @@ class Tru64System : public System Addr kernelEntry; public: - RemoteGDB *remoteGDB; - GDBListener *gdbListen; + std::vector remoteGDB; + std::vector gdbListen; public: Tru64System(const std::string _name, @@ -88,7 +88,8 @@ class Tru64System : public System const std::string &boot_osflags); ~Tru64System(); - void init(ExecContext *xc); + int registerExecContext(ExecContext *xc); + void replaceExecContext(ExecContext *xc, int xcIndex); Addr getKernelStart() const { return kernelStart; } Addr getKernelEnd() const { return kernelEnd; } -- cgit v1.2.3