This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 946b01d4a838120d2eed5c545dce5f95de69b1d6
Author: ligd <[email protected]>
AuthorDate: Tue Aug 13 18:34:16 2024 +0800

    arm-M: set current regs for crash dump
    
    Signed-off-by: ligd <[email protected]>
---
 arch/arm/src/armv6-m/arm_doirq.c | 10 ++++++++++
 arch/arm/src/armv7-m/arm_doirq.c | 10 ++++++++++
 arch/arm/src/armv8-m/arm_doirq.c | 10 ++++++++++
 3 files changed, 30 insertions(+)

diff --git a/arch/arm/src/armv6-m/arm_doirq.c b/arch/arm/src/armv6-m/arm_doirq.c
index 93703b4512..b9683a5708 100644
--- a/arch/arm/src/armv6-m/arm_doirq.c
+++ b/arch/arm/src/armv6-m/arm_doirq.c
@@ -74,8 +74,18 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
     }
   else
     {
+      /* Set current regs for crash dump */
+
+      up_set_current_regs(regs);
+
+      /* Dispatch irq */
+
       tcb->xcp.regs = regs;
       irq_dispatch(irq, regs);
+
+      /* Clear current regs */
+
+      up_set_current_regs(NULL);
     }
 
   /* If a context switch occurred while processing the interrupt then
diff --git a/arch/arm/src/armv7-m/arm_doirq.c b/arch/arm/src/armv7-m/arm_doirq.c
index b74414c59a..2f532969a5 100644
--- a/arch/arm/src/armv7-m/arm_doirq.c
+++ b/arch/arm/src/armv7-m/arm_doirq.c
@@ -74,8 +74,18 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
     }
   else
     {
+      /* Set current regs for crash dump */
+
+      up_set_current_regs(regs);
+
+      /* Dispatch irq */
+
       tcb->xcp.regs = regs;
       irq_dispatch(irq, regs);
+
+      /* Clear current regs */
+
+      up_set_current_regs(NULL);
     }
 
   /* If a context switch occurred while processing the interrupt then
diff --git a/arch/arm/src/armv8-m/arm_doirq.c b/arch/arm/src/armv8-m/arm_doirq.c
index 536d7c4e75..d024d1ebad 100644
--- a/arch/arm/src/armv8-m/arm_doirq.c
+++ b/arch/arm/src/armv8-m/arm_doirq.c
@@ -74,8 +74,18 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
     }
   else
     {
+      /* Set current regs for crash dump */
+
+      up_set_current_regs(regs);
+
+      /* Dispatch irq */
+
       tcb->xcp.regs = regs;
       irq_dispatch(irq, regs);
+
+      /* Clear current regs */
+
+      up_set_current_regs(NULL);
     }
 
   /* If a context switch occurred while processing the interrupt then

Reply via email to