summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-03-07 04:31:38 -0500
committerGabe Black <gblack@eecs.umich.edu>2006-03-07 04:31:38 -0500
commitb5111285078cf790a2330c725b63fbc1f791db14 (patch)
treefa23e2984b8ddc29c5304362550ac58802e9ac03 /sim
parentb7ebc2d97f54e1f1cb6a2a7d33daa3d4fe6e0107 (diff)
downloadgem5-b5111285078cf790a2330c725b63fbc1f791db14.tar.xz
Some clean up work with faults.
arch/alpha/faults.cc: Renamed the _stat stat to a more descriptive _count, got rid of some old commented out code, and moved common fault handling code, ie recording that the fault happend and that it wasn't mispeculated, into the FaultBase class. arch/alpha/faults.hh: Renamed the _stat stat to the more descriptive _count, and renamed the appropriate accessor functions. kern/kernel_stats.cc: kern/kernel_stats.hh: The fault statistics are now handled by the fault classes themselves. sim/faults.cc: The default implementation of the "invoke" method now does what all faults should do first, ie record that the fault happened, and make sure the fault isn't being executed on a mispeculated execution path. sim/faults.hh: There is now a default implementation of invoke, and the stat function is taken care of in the architecture specific fault classes. --HG-- extra : convert_revision : f6656fbea991df9addf85cad740ac37b1036b71a
Diffstat (limited to 'sim')
-rw-r--r--sim/faults.cc9
-rw-r--r--sim/faults.hh3
2 files changed, 10 insertions, 2 deletions
diff --git a/sim/faults.cc b/sim/faults.cc
index 9b4a0ea7f..2b93353ce 100644
--- a/sim/faults.cc
+++ b/sim/faults.cc
@@ -28,10 +28,19 @@
#include "sim/faults.hh"
#include "cpu/exec_context.hh"
+#include "cpu/base.hh"
#if !FULL_SYSTEM
void FaultBase::invoke(ExecContext * xc)
{
fatal("fault (%s) detected @ PC 0x%08p", name(), xc->readPC());
}
+#else
+void FaultBase::invoke(ExecContext * xc)
+{
+ DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->regs.pc);
+ xc->cpu->recordEvent(csprintf("Fault %s", name()));
+
+ assert(!xc->misspeculating());
+}
#endif
diff --git a/sim/faults.hh b/sim/faults.hh
index 9e8d224cd..18601e8f1 100644
--- a/sim/faults.hh
+++ b/sim/faults.hh
@@ -51,9 +51,8 @@ class FaultBase : public RefCounted
{
public:
virtual FaultName name() = 0;
- virtual FaultStat & stat() = 0;
#if FULL_SYSTEM
- virtual void invoke(ExecContext * xc) = 0;
+ virtual void invoke(ExecContext * xc);
#else
virtual void invoke(ExecContext * xc);
#endif