From db495a5ebee32c5c42c0a274f3217f8fc53d678a Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 18 Jan 2023 11:09:26 -0800 Subject: [PATCH] xtensa: stop execution under simulator for double exception If running under Xtensa simulator, it is good to tell simulator to stop execution once we reach double exception, as the current double exception handler is simply an endless loop. If we turn on tracing in the simulator, the output file would contain an infinite iteration of this endless loop, and the simulator needs to be stopped manually before the file size goes out of control. So we need to tell the simulator to stop once we reach this point instead of doing an endless loop. Signed-off-by: Daniel Leung --- arch/xtensa/core/xtensa-asm2-util.S | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/core/xtensa-asm2-util.S b/arch/xtensa/core/xtensa-asm2-util.S index dcf3744a682..a0b95977f48 100644 --- a/arch/xtensa/core/xtensa-asm2-util.S +++ b/arch/xtensa/core/xtensa-asm2-util.S @@ -7,6 +7,10 @@ #include #include +#if defined(CONFIG_SIMULATOR_XTENSA) || defined(XT_SIMULATOR) +#include +#endif + /* * xtensa_spill_reg_windows * @@ -365,7 +369,17 @@ _KernelExceptionVector: .pushsection .DoubleExceptionVector.text, "ax" .global _DoubleExceptionVector _DoubleExceptionVector: -#if XCHAL_HAVE_DEBUG +#if defined(CONFIG_SIMULATOR_XTENSA) || defined(XT_SIMULATOR) +1: +/* 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 + * jumps. + */ + movi a3, 1 + movi a2, SYS_exit + simcall +#elif XCHAL_HAVE_DEBUG /* Signals an unhandled double exception */ 1: break 1, 4 #else