From fea0ec07db816e13502bb7bb3747822924429ada Mon Sep 17 00:00:00 2001 From: ligd Date: Tue, 13 Aug 2024 18:34:16 +0800 Subject: [PATCH] arm-M: set current regs for crash dump Signed-off-by: ligd --- 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 93703b4512e4a..b9683a57081b2 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 b74414c59a3fa..2f532969a53f0 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 536d7c4e757c6..d024d1ebad45f 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