summaryrefslogtreecommitdiff
path: root/src/cpu/o3
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-04-27 19:51:20 -0700
committerGabe Black <gabeblack@google.com>2019-04-30 03:49:40 +0000
commiteea1fb6fc887e523f23cd3141869da59e7047c55 (patch)
tree4b82d9aa743f48c18e9373ffe19254e89012550a /src/cpu/o3
parentf9b72476fd948cde713f145834fba81574b0fde0 (diff)
downloadgem5-eea1fb6fc887e523f23cd3141869da59e7047c55.tar.xz
arch: cpu: Track kernel stats using the base ISA agnostic type.
Then cast to the ISA specific type when necessary. This removes (mostly) an ISA specific aspect to some of the interfaces. The ISA specific version of the kernel stats still needs to be constructed and stored in a few places which means that kernel_stats.hh still needs to be a switching arch header, for instance. In the future, I'd like to make the kernel its own object like the Process objects in SE mode, and then it would be able to instantiate and maintain its own stats. Change-Id: I8309d49019124f6bea1482aaea5b5b34e8c97433 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18429 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/cpu/o3')
-rw-r--r--src/cpu/o3/cpu.cc12
-rw-r--r--src/cpu/o3/regfile.hh1
-rw-r--r--src/cpu/o3/thread_context.hh2
3 files changed, 9 insertions, 6 deletions
diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc
index 621a6a409..70417d51f 100644
--- a/src/cpu/o3/cpu.cc
+++ b/src/cpu/o3/cpu.cc
@@ -925,7 +925,10 @@ FullO3CPU<Impl>::hwrei(ThreadID tid)
// Need to clear the lock flag upon returning from an interrupt.
this->setMiscRegNoEffect(AlphaISA::MISCREG_LOCKFLAG, false, tid);
- this->thread[tid]->kernelStats->hwrei();
+ auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
+ this->thread[tid]->kernelStats);
+ assert(stats);
+ stats->hwrei();
// FIXME: XXX check for interrupts? XXX
#endif
@@ -937,9 +940,10 @@ bool
FullO3CPU<Impl>::simPalCheck(int palFunc, ThreadID tid)
{
#if THE_ISA == ALPHA_ISA
- if (this->thread[tid]->kernelStats)
- this->thread[tid]->kernelStats->callpal(palFunc,
- this->threadContexts[tid]);
+ auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
+ this->thread[tid]->kernelStats);
+ if (stats)
+ stats->callpal(palFunc, this->threadContexts[tid]);
switch (palFunc) {
case PAL::halt:
diff --git a/src/cpu/o3/regfile.hh b/src/cpu/o3/regfile.hh
index d2fcd0749..d4b6602ad 100644
--- a/src/cpu/o3/regfile.hh
+++ b/src/cpu/o3/regfile.hh
@@ -48,7 +48,6 @@
#include <vector>
#include "arch/isa_traits.hh"
-#include "arch/kernel_stats.hh"
#include "arch/types.hh"
#include "base/trace.hh"
#include "config/the_isa.hh"
diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh
index b87aac4a7..e5f01871b 100644
--- a/src/cpu/o3/thread_context.hh
+++ b/src/cpu/o3/thread_context.hh
@@ -119,7 +119,7 @@ class O3ThreadContext : public ThreadContext
System *getSystemPtr() override { return cpu->system; }
/** Returns a pointer to this thread's kernel statistics. */
- TheISA::Kernel::Statistics *
+ ::Kernel::Statistics *
getKernelStats() override
{
return thread->kernelStats;