mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-04-25 22:57:55 +08:00 committed by Xiang Xiao
parent fa90a3dfd4
commit b5d1ec28de
2 changed files with 11 additions and 1 deletions

View File

@ -108,7 +108,8 @@
#define TCB_FLAG_SYSCALL (1 << 10) /* Bit 9: In a system call */
#define TCB_FLAG_EXIT_PROCESSING (1 << 11) /* Bit 10: Exitting */
#define TCB_FLAG_FREE_STACK (1 << 12) /* Bit 12: Free stack after exit */
/* Bits 13-15: Available */
#define TCB_FLAG_MEM_CHECK (1 << 13) /* Bit 13: Memory check */
/* Bits 14-15: Available */
/* Values for struct task_group tg_flags */

View File

@ -27,6 +27,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/mm/mm.h>
#include <nuttx/random.h>
#include <nuttx/sched_note.h>
@ -184,6 +185,14 @@ void irq_dispatch(int irq, FAR void *context)
sched_note_irqhandler(irq, vector, false);
#endif
#ifdef CONFIG_DEBUG_MM
if ((g_running_tasks[this_cpu()]->flags & TCB_FLAG_MEM_CHECK) || \
(this_task()->flags & TCB_FLAG_MEM_CHECK))
{
kmm_checkcorruption();
}
#endif
/* Record the new "running" task. g_running_tasks[] is only used by
* assertion logic for reporting crashes.
*/