diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 82a44f820c58..af0e3ae12887 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -103,6 +103,13 @@ config XTENSA_NUM_SPIN_RELAX_NOPS Specify the number of NOPs in Xtensa specific arch_spin_relax(). +config XTENSA_BREAK_ON_UNRECOVERABLE_EXCEPTIONS + bool "Use BREAK instruction on unrecoverable exceptions" + help + Use BREAK instruction when unrecoverable exceptions are + encountered. This requires a debugger attached to catch + the BREAK. + menu "Xtensa HiFi Options" config XTENSA_CPU_HAS_HIFI diff --git a/arch/xtensa/core/xtensa_asm2_util.S b/arch/xtensa/core/xtensa_asm2_util.S index 76aab766bc92..76fd2ed71165 100644 --- a/arch/xtensa/core/xtensa_asm2_util.S +++ b/arch/xtensa/core/xtensa_asm2_util.S @@ -503,8 +503,13 @@ _DoubleExceptionVector: j _Level1Vector #else -#if defined(CONFIG_SIMULATOR_XTENSA) || defined(XT_SIMULATOR) -1: +#if XCHAL_HAVE_DEBUG && defined(CONFIG_XTENSA_BREAK_ON_UNRECOVERABLE_EXCEPTIONS) + /* Signals an unhandled double exception, and unrecoverable exceptions. + * Definitely needs debugger to be attached to the hardware or simulator + * to catch this. + */ + break 1, 4 +#elif defined(CONFIG_SIMULATOR_XTENSA) || defined(XT_SIMULATOR) /* Tell simulator to stop executing here, instead of trying to do * an infinite loop (see below). Greatly help with using tracing in * simulator so that traces will not have infinite iterations of @@ -513,12 +518,8 @@ _DoubleExceptionVector: movi a3, 1 movi a2, SYS_exit simcall -#elif XCHAL_HAVE_DEBUG -/* Signals an unhandled double exception */ -1: break 1, 4 -#else -1: #endif +1: j 1b #endif /* CONFIG_XTENSA_MMU */