summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/arm/ArmNativeTrace.py2
-rw-r--r--src/arch/arm/nativetrace.cc5
-rw-r--r--src/arch/arm/nativetrace.hh14
3 files changed, 20 insertions, 1 deletions
diff --git a/src/arch/arm/ArmNativeTrace.py b/src/arch/arm/ArmNativeTrace.py
index fb3d4a4ff..0a76913e3 100644
--- a/src/arch/arm/ArmNativeTrace.py
+++ b/src/arch/arm/ArmNativeTrace.py
@@ -33,3 +33,5 @@ from NativeTrace import NativeTrace
class ArmNativeTrace(NativeTrace):
type = 'ArmNativeTrace'
cxx_class = 'Trace::ArmNativeTrace'
+ stop_on_pc_error = Param.Bool(True,
+ "Stop M5 if it and statetrace's pcs are different")
diff --git a/src/arch/arm/nativetrace.cc b/src/arch/arm/nativetrace.cc
index 90c5e5c25..1ad9e1a19 100644
--- a/src/arch/arm/nativetrace.cc
+++ b/src/arch/arm/nativetrace.cc
@@ -162,6 +162,11 @@ Trace::ArmNativeTrace::check(NativeTraceRecord *record)
}
assert(inst);
record->traceInst(inst, ran);
+
+ bool pcError = (mState.newState[STATE_PC] !=
+ nState.newState[STATE_PC]);
+ if (stopOnPCError && pcError)
+ panic("Native trace detected an error in control flow!");
}
}
diff --git a/src/arch/arm/nativetrace.hh b/src/arch/arm/nativetrace.hh
index d39bdcfa8..7467e3378 100644
--- a/src/arch/arm/nativetrace.hh
+++ b/src/arch/arm/nativetrace.hh
@@ -33,6 +33,7 @@
#include "base/types.hh"
#include "cpu/nativetrace.hh"
+#include "params/ArmNativeTrace.hh"
namespace Trace {
@@ -88,8 +89,19 @@ class ArmNativeTrace : public NativeTrace
ThreadState nState, mState;
+ bool stopOnPCError;
+
public:
- ArmNativeTrace(const Params *p) : NativeTrace(p)
+ typedef ArmNativeTraceParams Params;
+
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
+
+ ArmNativeTrace(const Params *p) :
+ NativeTrace(p), stopOnPCError(p->stop_on_pc_error)
{}
void check(NativeTraceRecord *record);