From 946b01d4a838120d2eed5c545dce5f95de69b1d6 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 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