diff options
| author | Shell <[email protected]> | 2024-03-21 10:26:41 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-20 22:26:41 -0400 |
| commit | f143ea2b31d6cb7030850caf108f801cff7bafac (patch) | |
| tree | bd47ac237902de4a8ec8955d469e0f0b2a0edf97 /src/scheduler_up.c | |
| parent | e81978c5dc5ff75257b64da3f9ab0d9a75475ddb (diff) | |
[kernel] remove redundant _scheduler_stack_check
Diffstat (limited to 'src/scheduler_up.c')
| -rw-r--r-- | src/scheduler_up.c | 64 |
1 files changed, 1 insertions, 63 deletions
diff --git a/src/scheduler_up.c b/src/scheduler_up.c index 1c57b9ee0c..44da38d8ff 100644 --- a/src/scheduler_up.c +++ b/src/scheduler_up.c @@ -86,66 +86,6 @@ void rt_scheduler_switch_sethook(void (*hook)(struct rt_thread *tid)) /**@}*/ #endif /* RT_USING_HOOK */ -#ifdef RT_USING_OVERFLOW_CHECK -static void _scheduler_stack_check(struct rt_thread *thread) -{ - RT_ASSERT(thread != RT_NULL); - -#ifdef RT_USING_SMART -#ifndef ARCH_MM_MMU - struct rt_lwp *lwp = thread ? (struct rt_lwp *)thread->lwp : 0; - - /* if stack pointer locate in user data section skip stack check. */ - if (lwp && ((rt_uint32_t)thread->sp > (rt_uint32_t)lwp->data_entry && - (rt_uint32_t)thread->sp <= (rt_uint32_t)lwp->data_entry + (rt_uint32_t)lwp->data_size)) - { - return; - } -#endif /* not defined ARCH_MM_MMU */ -#endif /* RT_USING_SMART */ - -#ifndef RT_USING_HW_STACK_GUARD -#ifdef ARCH_CPU_STACK_GROWS_UPWARD - if (*((rt_uint8_t *)((rt_ubase_t)thread->stack_addr + thread->stack_size - 1)) != '#' || -#else - if (*((rt_uint8_t *)thread->stack_addr) != '#' || -#endif /* ARCH_CPU_STACK_GROWS_UPWARD */ - (rt_ubase_t)thread->sp <= (rt_ubase_t)thread->stack_addr || - (rt_ubase_t)thread->sp > - (rt_ubase_t)thread->stack_addr + (rt_ubase_t)thread->stack_size) - { - rt_base_t level; - - rt_kprintf("thread:%s stack overflow\n", thread->parent.name); - - level = rt_hw_interrupt_disable(); - while (level); - } -#endif -#ifdef ARCH_CPU_STACK_GROWS_UPWARD -#ifndef RT_USING_HW_STACK_GUARD - else if ((rt_ubase_t)thread->sp > ((rt_ubase_t)thread->stack_addr + thread->stack_size)) -#else - if ((rt_ubase_t)thread->sp > ((rt_ubase_t)thread->stack_addr + thread->stack_size)) -#endif - { - rt_kprintf("warning: %s stack is close to the top of stack address.\n", - thread->parent.name); - } -#else -#ifndef RT_USING_HW_STACK_GUARD - else if ((rt_ubase_t)thread->sp <= ((rt_ubase_t)thread->stack_addr + 32)) -#else - if ((rt_ubase_t)thread->sp <= ((rt_ubase_t)thread->stack_addr + 32)) -#endif - { - rt_kprintf("warning: %s stack is close to end of stack address.\n", - thread->parent.name); - } -#endif /* ARCH_CPU_STACK_GROWS_UPWARD */ -} -#endif /* RT_USING_OVERFLOW_CHECK */ - static struct rt_thread* _scheduler_get_highest_priority_thread(rt_ubase_t *highest_prio) { struct rt_thread *highest_priority_thread; @@ -325,9 +265,7 @@ void rt_schedule(void) RT_NAME_MAX, to_thread->parent.name, to_thread->sp, RT_NAME_MAX, from_thread->parent.name, from_thread->sp); -#ifdef RT_USING_OVERFLOW_CHECK - _scheduler_stack_check(to_thread); -#endif /* RT_USING_OVERFLOW_CHECK */ + RT_SCHEDULER_STACK_CHECK(to_thread); if (rt_interrupt_nest == 0) { |
