arch-arm: Report real instruction encoding when Undefined
When dumping the opcode that caused an Undefined Instruction, we just want to dump the real instruction encoding, and not the extended version with metabits (like thumb, bigThumb etc). This was not appening when panicking in SE mode. The patch is also replacing custom masking in the Unknown(64) disassembler in favour of ArmStaticInstruction::encoding() helper. Change-Id: I9eb6fd145d02b4b07bb51f0bd89ca014d6d5a6de Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18395 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -749,15 +749,16 @@ UndefinedInstruction::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
||||
|
||||
// If the mnemonic isn't defined this has to be an unknown instruction.
|
||||
assert(unknown || mnemonic != NULL);
|
||||
auto arm_inst = static_cast<ArmStaticInst *>(inst.get());
|
||||
if (disabled) {
|
||||
panic("Attempted to execute disabled instruction "
|
||||
"'%s' (inst 0x%08x)", mnemonic, machInst);
|
||||
"'%s' (inst 0x%08x)", mnemonic, arm_inst->encoding());
|
||||
} else if (unknown) {
|
||||
panic("Attempted to execute unknown instruction (inst 0x%08x)",
|
||||
machInst);
|
||||
arm_inst->encoding());
|
||||
} else {
|
||||
panic("Attempted to execute unimplemented instruction "
|
||||
"'%s' (inst 0x%08x)", mnemonic, machInst);
|
||||
"'%s' (inst 0x%08x)", mnemonic, arm_inst->encoding());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@ RegImmRegShiftOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
std::string
|
||||
UnknownOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
return csprintf("%-10s (inst %#08x)", "unknown", machInst & mask(32));
|
||||
return csprintf("%-10s (inst %#08x)", "unknown", encoding());
|
||||
}
|
||||
|
||||
McrMrcMiscInst::McrMrcMiscInst(const char *_mnemonic, ExtMachInst _machInst,
|
||||
|
||||
@@ -78,7 +78,7 @@ RegRegRegImmOp64::generateDisassembly(
|
||||
std::string
|
||||
UnknownOp64::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
||||
{
|
||||
return csprintf("%-10s (inst %#08x)", "unknown", machInst & mask(32));
|
||||
return csprintf("%-10s (inst %#08x)", "unknown", encoding());
|
||||
}
|
||||
|
||||
Fault
|
||||
|
||||
Reference in New Issue
Block a user