sim/head: don't let switch out when do poweroff

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-12-19 20:09:58 +08:00 committed by Xiang Xiao
parent e6bfaa14ee
commit c74627cbec

View File

@ -38,6 +38,10 @@ void __gcov_dump(void);
* Public Functions * 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 * Name: host_abort
* *
@ -50,6 +54,8 @@ void __gcov_dump(void);
void host_abort(int status) void host_abort(int status)
{ {
uint64_t flags = up_irq_save();
#ifdef CONFIG_ARCH_COVERAGE #ifdef CONFIG_ARCH_COVERAGE
/* Dump gcov data. */ /* Dump gcov data. */
@ -59,14 +65,26 @@ void host_abort(int status)
/* exit the simulation */ /* exit the simulation */
exit(status); 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) int host_backtrace(void** array, int size)
{ {
#ifdef CONFIG_WINDOWS_CYGWIN #ifdef CONFIG_WINDOWS_CYGWIN
return 0; return 0;
#else #else
extern int backtrace(void **array, int size);
return backtrace(array, size); return backtrace(array, size);
#endif #endif
} }