summaryrefslogtreecommitdiff
path: root/src/cpu/static_inst.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2017-12-19 23:44:39 -0800
committerGabe Black <gabeblack@google.com>2017-12-22 00:27:20 +0000
commit3742cc9137b43d1e42957d8b440044fa9e95e907 (patch)
tree0e5fe46d7bb8dcee131d81f6bc4faff78ed0c6d5 /src/cpu/static_inst.cc
parent7df83c94da53f8d04367cb472be8f7f947f94234 (diff)
downloadgem5-3742cc9137b43d1e42957d8b440044fa9e95e907.tar.xz
cpu: Add a pointer to a generic Nop StaticInst.
This can be used whenever generic code needs a filler instruction that doesn't do anything. Change-Id: Ib245d3e880a951e229eb315a09ecc7c47e6ae00f Reviewed-on: https://gem5-review.googlesource.com/6823 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/cpu/static_inst.cc')
-rw-r--r--src/cpu/static_inst.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cpu/static_inst.cc b/src/cpu/static_inst.cc
index d50c9f15d..cdcd93c58 100644
--- a/src/cpu/static_inst.cc
+++ b/src/cpu/static_inst.cc
@@ -35,7 +35,41 @@
#include "sim/core.hh"
+namespace {
+
+static TheISA::ExtMachInst nopMachInst;
+
+class NopStaticInst : public StaticInst
+{
+ public:
+ NopStaticInst() : StaticInst("gem5 nop", nopMachInst, No_OpClass)
+ {}
+
+ Fault
+ execute(ExecContext *xc, Trace::InstRecord *traceData) const override
+ {
+ return NoFault;
+ }
+
+ void
+ advancePC(TheISA::PCState &pcState) const override
+ {
+ pcState.advance();
+ }
+
+ std::string
+ generateDisassembly(Addr pc, const SymbolTable *symtab) const override
+ {
+ return mnemonic;
+ }
+
+ private:
+};
+
+}
+
StaticInstPtr StaticInst::nullStaticInstPtr;
+StaticInstPtr StaticInst::nopStaticInstPtr = new NopStaticInst;
using namespace std;