arch/sim: Disable interrupt in up_interrupt_context for SMP

like other arch to fix the race condition

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-12-17 04:10:06 +08:00 committed by Petro Karashchenko
parent 07758d9b58
commit 6e66603da5
1 changed files with 11 additions and 1 deletions

View File

@ -146,7 +146,17 @@ static inline uintptr_t up_getsp(void)
static inline bool up_interrupt_context(void)
{
return CURRENT_REGS != NULL;
#ifdef CONFIG_SMP
irqstate_t flags = up_irq_save();
#endif
bool ret = CURRENT_REGS != NULL;
#ifdef CONFIG_SMP
up_irq_restore(flags);
#endif
return ret;
}
#undef EXTERN