mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
arm: optimize up_interrupt_context used in armv[6/7/8]-m
resson: using percpu storage for g_current_regs or leveraging interrupt status registers to determine if code is running within an interrupt context can enhance performance. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -394,17 +394,7 @@ static inline_function void up_set_current_regs(uint32_t *regs)
|
|||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function bool up_interrupt_context(void)
|
static inline_function bool up_interrupt_context(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
return getipsr() != 0;
|
||||||
irqstate_t flags = up_irq_save();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool ret = up_current_regs() != NULL;
|
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
up_irq_restore(flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -599,17 +599,7 @@ static inline_function void up_set_current_regs(uint32_t *regs)
|
|||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function bool up_interrupt_context(void)
|
static inline_function bool up_interrupt_context(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
return getipsr() != 0;
|
||||||
irqstate_t flags = up_irq_save();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool ret = up_current_regs() != NULL;
|
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
up_irq_restore(flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -572,17 +572,7 @@ static inline_function void up_set_current_regs(uint32_t *regs)
|
|||||||
noinstrument_function
|
noinstrument_function
|
||||||
static inline_function bool up_interrupt_context(void)
|
static inline_function bool up_interrupt_context(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
return getipsr() != 0;
|
||||||
irqstate_t flags = up_irq_save();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool ret = up_current_regs() != NULL;
|
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
up_irq_restore(flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user