sched/init/nx_start.c: enter_critical_section when check heap & stack in idle

Change-Id: I2ef95ee8e1dc1ba3e74c1d6c8c6af20f53be85c7
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-03-23 18:07:39 +08:00 committed by Xiang Xiao
parent b1f711f790
commit 646b229f74

View File

@ -800,17 +800,30 @@ void nx_start(void)
sinfo("CPU0: Beginning Idle Loop\n");
for (; ; )
{
/* Check heap & stack in idle thread */
kmm_checkcorruption();
#if defined(CONFIG_STACK_COLORATION) && defined(CONFIG_DEBUG_MM)
irqstate_t flags;
/* Check stack in idle thread */
flags = enter_critical_section();
for (i = 0; i < CONFIG_MAX_TASKS && g_pidhash[i].tcb; i++)
{
assert(up_check_tcbstack_remain(g_pidhash[i].tcb) > 0);
if (up_check_tcbstack_remain(g_pidhash[i].tcb) <= 0)
{
_alert("Stack check failed, pid %d, name %s\n",
g_pidhash[i].tcb->pid, g_pidhash[i].tcb->name);
PANIC();
}
}
leave_critical_section(flags);
#endif
/* Check heap in idle thread */
kmm_checkcorruption();
/* Perform any processor-specific idle state operations */
up_idle();