summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/arm/insts/static_inst.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/arch/arm/insts/static_inst.hh b/src/arch/arm/insts/static_inst.hh
index 431e81b07..4595646cb 100644
--- a/src/arch/arm/insts/static_inst.hh
+++ b/src/arch/arm/insts/static_inst.hh
@@ -423,6 +423,25 @@ class ArmStaticInst : public StaticInst
{
return intWidth;
}
+
+ /** Returns the byte size of current instruction */
+ ssize_t
+ instSize() const
+ {
+ return (!machInst.thumb || machInst.bigThumb) ? 4 : 2;
+ }
+
+ /**
+ * Returns the real encoding of the instruction:
+ * the machInst field is in fact always 64 bit wide and
+ * contains some instruction metadata, which means it differs
+ * from the real opcode.
+ */
+ MachInst
+ encoding() const
+ {
+ return static_cast<MachInst>(mask(instSize() * 8));
+ }
};
}