From e74547bbb36c38bbebf8baca4d728b3db14885df Mon Sep 17 00:00:00 2001 From: wdfk-prog <1425075683@qq.com> Date: Wed, 8 Apr 2026 13:45:46 +0800 Subject: feat(core): Add Cortex-M4 interrupt context helpers --- src/scheduler_up.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/scheduler_up.c b/src/scheduler_up.c index e2d90d14c5..8560166fd1 100644 --- a/src/scheduler_up.c +++ b/src/scheduler_up.c @@ -284,6 +284,7 @@ void rt_schedule(void) struct rt_thread *to_thread; struct rt_thread *from_thread; struct rt_thread *curr_thread; + rt_base_t interrupt_nest; /* disable interrupt */ level = rt_hw_interrupt_disable(); @@ -343,16 +344,17 @@ void rt_schedule(void) RT_SCHED_CTX(to_thread).stat = RT_THREAD_RUNNING | (RT_SCHED_CTX(to_thread).stat & ~RT_THREAD_STAT_MASK); /* switch to new thread */ + interrupt_nest = rt_interrupt_get_nest(); LOG_D("[%d]switch to priority#%d " "thread:%.*s(sp:0x%08x), " "from thread:%.*s(sp: 0x%08x)", - rt_interrupt_get_nest(), highest_ready_priority, + interrupt_nest, highest_ready_priority, RT_NAME_MAX, to_thread->parent.name, to_thread->sp, RT_NAME_MAX, from_thread->parent.name, from_thread->sp); RT_SCHEDULER_STACK_CHECK(to_thread); - if (rt_interrupt_get_nest() == 0) + if (interrupt_nest == 0) { extern void rt_thread_handle_sig(rt_bool_t clean_state); -- cgit v1.3.1