sched: fix stack check crash in idle thread

Change-Id: Iea7c096ffcab181f318edcc1bfe1717785831b7a
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-06-18 14:29:01 +08:00 committed by Xiang Xiao
parent 6685df498f
commit 940c80f7b3

View File

@ -801,18 +801,21 @@ void nx_start(void)
for (; ; )
{
#if defined(CONFIG_STACK_COLORATION) && defined(CONFIG_DEBUG_MM)
irqstate_t flags;
/* Check stack in idle thread */
for (i = 0; i < CONFIG_MAX_TASKS && g_pidhash[i].tcb; i++)
for (i = 0; i < CONFIG_MAX_TASKS; i++)
{
FAR struct tcb_s *tcb;
irqstate_t flags;
flags = enter_critical_section();
if (up_check_tcbstack_remain(g_pidhash[i].tcb) <= 0)
tcb = g_pidhash[i].tcb;
if (tcb && up_check_tcbstack_remain(tcb) <= 0)
{
_alert("Stack check failed, pid %d, name %s\n",
g_pidhash[i].tcb->pid, g_pidhash[i].tcb->name);
tcb->pid, tcb->name);
PANIC();
}