From c74627cbecd9972571918c8a7681a10b633f6edc Mon Sep 17 00:00:00 2001 From: ligd Date: Mon, 19 Dec 2022 20:09:58 +0800 Subject: [PATCH] sim/head: don't let switch out when do poweroff Signed-off-by: ligd --- arch/sim/src/sim/posix/sim_hostmisc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/sim/src/sim/posix/sim_hostmisc.c b/arch/sim/src/sim/posix/sim_hostmisc.c index ed5fe6f804..70c975d639 100644 --- a/arch/sim/src/sim/posix/sim_hostmisc.c +++ b/arch/sim/src/sim/posix/sim_hostmisc.c @@ -38,6 +38,10 @@ void __gcov_dump(void); * Public Functions ****************************************************************************/ +extern uint64_t up_irq_save(void); +extern void up_irq_restore(uint64_t flags); +extern int backtrace(void **array, int size); + /**************************************************************************** * Name: host_abort * @@ -50,6 +54,8 @@ void __gcov_dump(void); void host_abort(int status) { + uint64_t flags = up_irq_save(); + #ifdef CONFIG_ARCH_COVERAGE /* Dump gcov data. */ @@ -59,14 +65,26 @@ void host_abort(int status) /* exit the simulation */ exit(status); + + up_irq_restore(flags); } +/**************************************************************************** + * Name: host_backtrace + * + * Description: + * bcaktrace + * + * Input Parameters: + * array - return array, which backtrace will be stored + * size - array size + ****************************************************************************/ + int host_backtrace(void** array, int size) { #ifdef CONFIG_WINDOWS_CYGWIN return 0; #else - extern int backtrace(void **array, int size); return backtrace(array, size); #endif }