diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/faults.cc | 7 | ||||
-rw-r--r-- | sim/faults.hh | 67 | ||||
-rw-r--r-- | sim/process.cc | 6 | ||||
-rw-r--r-- | sim/pseudo_inst.cc | 40 | ||||
-rw-r--r-- | sim/pseudo_inst.hh | 5 | ||||
-rw-r--r-- | sim/system.cc | 2 | ||||
-rw-r--r-- | sim/vptr.hh | 2 |
7 files changed, 96 insertions, 33 deletions
diff --git a/sim/faults.cc b/sim/faults.cc index 58a631263..78bfc8092 100644 --- a/sim/faults.cc +++ b/sim/faults.cc @@ -28,9 +28,6 @@ #include "sim/faults.hh" -NoFaultType * const NoFault = new NoFaultType("none"); -MachineCheckFaultType * const MachineCheckFault = - new MachineCheckFaultType("mchk"); -AlignmentFaultType * const AlignmentFault = - new AlignmentFaultType("unalign"); +FaultName MachineCheckFault::_name = "mchk"; +FaultName AlignmentFault::_name = "unalign"; diff --git a/sim/faults.hh b/sim/faults.hh index dbec399af..9b8c94cda 100644 --- a/sim/faults.hh +++ b/sim/faults.hh @@ -29,34 +29,63 @@ #ifndef __FAULTS_HH__ #define __FAULTS_HH__ +#include "base/refcnt.hh" +#include "sim/stats.hh" +#include "config/full_system.hh" + +class ExecContext; class FaultBase; -typedef FaultBase * Fault; +typedef RefCountingPtr<FaultBase> Fault; + +typedef const char * FaultName; +typedef Stats::Scalar<> FaultStat; -class FaultBase +// Each class has it's name statically define in _name, +// and has a virtual function to access it's name. +// The function is necessary because otherwise, all objects +// which are being accessed cast as a FaultBase * (namely +// all faults returned using the Fault type) will use the +// generic FaultBase name. + +class FaultBase : public RefCounted { -public: - FaultBase(char * newName, int newId = 0) : name(newName), id(newId) {;} - const char * name; - int id; + public: + virtual FaultName name() = 0; + virtual FaultStat & stat() = 0; +#if FULL_SYSTEM + virtual void ev5_trap(ExecContext * xc) = 0; +#endif + template<typename T> + bool isA() {return dynamic_cast<T *>(this);} + virtual bool isMachineCheckFault() {return false;} + virtual bool isAlignmentFault() {return false;} }; -extern class NoFaultType : public FaultBase -{ -public: - NoFaultType(char * newName) : FaultBase(newName) {;} -} * const NoFault; +FaultBase * const NoFault = 0; -extern class MachineCheckFaultType : public FaultBase +//The ISAs are each responsible for providing a genMachineCheckFault and a +//genAlignmentFault functions, which return faults to use in the case of a +//machine check fault or an alignment fault, respectively. Base classes which +//provide the name() function, and the isMachineCheckFault and isAlignmentFault +//functions are provided below. + +class MachineCheckFault : public virtual FaultBase { -public: - MachineCheckFaultType(char * newName) : FaultBase(newName) {;} -} * const MachineCheckFault; + private: + static FaultName _name; + public: + FaultName name() {return _name;} + bool isMachineCheckFault() {return true;} +}; -extern class AlignmentFaultType : public FaultBase +class AlignmentFault : public virtual FaultBase { -public: - AlignmentFaultType(char * newName) : FaultBase(newName) {;} -} * const AlignmentFault; + private: + static FaultName _name; + public: + FaultName name() {return _name;} + bool isAlignmentFault() {return true;} +}; #endif // __FAULTS_HH__ diff --git a/sim/process.cc b/sim/process.cc index 0a7e46082..e3cae2855 100644 --- a/sim/process.cc +++ b/sim/process.cc @@ -48,10 +48,8 @@ #include "sim/stats.hh" #include "sim/syscall_emul.hh" -#ifdef TARGET_ALPHA -#include "arch/alpha/alpha_tru64_process.hh" -#include "arch/alpha/alpha_linux_process.hh" -#endif +#include "arch/tru64_process.hh" +#include "arch/linux_process.hh" using namespace std; using namespace TheISA; diff --git a/sim/pseudo_inst.cc b/sim/pseudo_inst.cc index 0250352f4..f4285be8a 100644 --- a/sim/pseudo_inst.cc +++ b/sim/pseudo_inst.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2005 The Regents of The University of Michigan + * Copyright (c) 2003-2006 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,7 +34,7 @@ #include <string> #include "sim/pseudo_inst.hh" -#include "targetarch/vtophys.hh" +#include "arch/vtophys.hh" #include "cpu/base.hh" #include "cpu/sampler/sampler.hh" #include "cpu/exec_context.hh" @@ -78,6 +78,42 @@ namespace AlphaPseudo } void + quiesceNs(ExecContext *xc, uint64_t ns) + { + if (!doQuiesce || ns == 0) + return; + + if (xc->quiesceEvent.scheduled()) + xc->quiesceEvent.reschedule(curTick + Clock::Int::ns * ns); + else + xc->quiesceEvent.schedule(curTick + Clock::Int::ns * ns); + + xc->suspend(); + xc->kernelStats->quiesce(); + } + + void + quiesceCycles(ExecContext *xc, uint64_t cycles) + { + if (!doQuiesce || cycles == 0) + return; + + if (xc->quiesceEvent.scheduled()) + xc->quiesceEvent.reschedule(curTick + xc->cpu->cycles(cycles)); + else + xc->quiesceEvent.schedule(curTick + xc->cpu->cycles(cycles)); + + xc->suspend(); + xc->kernelStats->quiesce(); + } + + uint64_t + quiesceTime(ExecContext *xc) + { + return (xc->lastActivate - xc->lastSuspend) / Clock::Int::ns ; + } + + void ivlb(ExecContext *xc) { xc->kernelStats->ivlb(); diff --git a/sim/pseudo_inst.hh b/sim/pseudo_inst.hh index 3857f2050..4dd427c99 100644 --- a/sim/pseudo_inst.hh +++ b/sim/pseudo_inst.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2005 The Regents of The University of Michigan + * Copyright (c) 2003-2006 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,9 @@ namespace AlphaPseudo void arm(ExecContext *xc); void quiesce(ExecContext *xc); + void quiesceNs(ExecContext *xc, uint64_t ns); + void quiesceCycles(ExecContext *xc, uint64_t cycles); + uint64_t quiesceTime(ExecContext *xc); void ivlb(ExecContext *xc); void ivle(ExecContext *xc); void m5exit(ExecContext *xc, Tick delay); diff --git a/sim/system.cc b/sim/system.cc index e138a6c22..8820922c1 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -5,7 +5,7 @@ #include "kern/kernel_stats.hh" #include "mem/functional/memory_control.hh" #include "mem/functional/physical.hh" -#include "targetarch/vtophys.hh" +#include "arch/vtophys.hh" #include "sim/builder.hh" #include "arch/isa_traits.hh" #include "sim/byteswap.hh" diff --git a/sim/vptr.hh b/sim/vptr.hh index 7ec43602d..0ec452f25 100644 --- a/sim/vptr.hh +++ b/sim/vptr.hh @@ -29,7 +29,7 @@ #ifndef __ARCH_ALPHA_VPTR_HH__ #define __ARCH_ALPHA_VPTR_HH__ -#include "targetarch/vtophys.hh" +#include "arch/vtophys.hh" #include "arch/isa_traits.hh" class ExecContext; |