提交 90238948 编写于 作者: wuyangyong's avatar wuyangyong

fix _rt_scheduler_stack_check

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@47 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 4bd258ce
......@@ -18,6 +18,7 @@
* 2006-08-03 Bernard add hook support
* 2006-09-05 Bernard add 32 priority level support
* 2006-09-24 Bernard add rt_system_scheduler_start function
* 2009-09-16 Bernard fix _rt_scheduler_stack_check
*/
#include <rtthread.h>
......@@ -95,7 +96,9 @@ static void _rt_scheduler_stack_check(struct rt_thread* thread)
{
RT_ASSERT(thread != RT_NULL);
if ((rt_uint32_t)thread->sp <= (rt_uint32_t)thread->stack_addr)
if ( (rt_uint32_t)thread->sp <= (rt_uint32_t)thread->stack_addr ||
(rt_uint32_t)thread->sp >
(rt_uint32_t)thread->stack_addr + (rt_uint32_t)thread->stack_size )
{
rt_uint32_t level;
......@@ -213,7 +216,7 @@ void rt_schedule()
level = rt_hw_interrupt_disable();
/* check the scheduler is enabled or not */
if(rt_scheduler_lock_nest == 0)
if (rt_scheduler_lock_nest == 0)
{
/* find out the highest priority task */
if (rt_thread_ready_priority_group & 0xff)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册