From: Gabe Black Date: Tue, 7 Nov 2017 03:25:21 +0000 (-0800) Subject: sparc: Return debug faults from unimplemented instructions. X-Git-Tag: v19.0.0.0~2527 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd96f10f997de75d31192cb232f50c37b4a11eac;p=gem5.git sparc: Return debug faults from unimplemented instructions. These had been marked as non-speculative so that their execute functions would only be called if the instruction should really be executed. Instead, we can return faults which will cause the same behavior when the instruction is committed and let the instruction execute as normal. Change-Id: I39fa5073e93399424144724b99bdc12070e42286 Reviewed-on: https://gem5-review.googlesource.com/5465 Reviewed-by: Gabe Black Maintainer: Gabe Black --- diff --git a/src/arch/sparc/insts/unimp.hh b/src/arch/sparc/insts/unimp.hh index c0d97858f..a63443a4c 100644 --- a/src/arch/sparc/insts/unimp.hh +++ b/src/arch/sparc/insts/unimp.hh @@ -31,6 +31,9 @@ #ifndef __ARCH_SPARC_INSTS_UNIMP_HH__ #define __ARCH_SPARC_INSTS_UNIMP_HH__ +#include + +#include "arch/generic/debugfaults.hh" #include "arch/sparc/insts/static_inst.hh" #include "base/cprintf.hh" @@ -55,17 +58,14 @@ class FailUnimplemented : public SparcStaticInst /// Constructor FailUnimplemented(const char *_mnemonic, ExtMachInst _machInst) : SparcStaticInst(_mnemonic, _machInst, No_OpClass) - { - // don't call execute() (which panics) if we're on a - // speculative path - flags[IsNonSpeculative] = true; - } + {} Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const override { - panic("attempt to execute unimplemented instruction '%s' " - "(inst 0x%08x)", mnemonic, machInst); + return std::make_shared( + "attempt to execute unimplemented instruction '%s' (inst %#08x)", + mnemonic, machInst); } std::string @@ -94,17 +94,14 @@ class WarnUnimplemented : public SparcStaticInst /// Constructor WarnUnimplemented(const char *_mnemonic, ExtMachInst _machInst) : SparcStaticInst(_mnemonic, _machInst, No_OpClass), warned(false) - { - // don't call execute() (which panics) if we're on a - // speculative path - flags[IsNonSpeculative] = true; - } + {} Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const override { if (!warned) { - warn("instruction '%s' unimplemented\n", mnemonic); + return std::make_shared( + "instruction '%s' unimplemented\n", mnemonic); warned = true; } return NoFault;