This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new b5d1ec2 mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK
set
b5d1ec2 is described below
commit b5d1ec28def9a9a9c3611a5a8fddacc4f5e6fc4a
Author: ligd <[email protected]>
AuthorDate: Sun Apr 25 22:57:55 2021 +0800
mm: do kmm_checkcorruption in IRQ when TCB_FLAG_DEBUG_CHECK set
Signed-off-by: ligd <[email protected]>
---
include/nuttx/sched.h | 3 ++-
sched/irq/irq_dispatch.c | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index caec634..f9d00b0 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -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 */
diff --git a/sched/irq/irq_dispatch.c b/sched/irq/irq_dispatch.c
index ab984a0..96486b1 100644
--- a/sched/irq/irq_dispatch.c
+++ b/sched/irq/irq_dispatch.c
@@ -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.
*/