You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/01/14 18:20:16 UTC
[incubator-nuttx] branch master updated (47f9ec9 -> 3544fc1)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 47f9ec9 binfmt/coredump: remove the block fragmentation
new c27839f arm/xtensa: save the running registers to xcp context
new 3544fc1 risc-v/assert: add CURRENT_REGS check to avoid null pointer reference
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/arm/src/common/arm_assert.c | 31 +++++++++++++---------------
arch/risc-v/src/common/riscv_assert.c | 22 ++++++++++++++++++--
arch/xtensa/src/common/xtensa_dumpstate.c | 34 +++++++++++++------------------
3 files changed, 48 insertions(+), 39 deletions(-)
[incubator-nuttx] 01/02: arm/xtensa: save the running registers to xcp context
Posted by xi...@apache.org.
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
commit c27839f98e5b00e06a820fed757cbaa24036767f
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed Jan 12 11:58:31 2022 +0800
arm/xtensa: save the running registers to xcp context
Signed-off-by: chao.an <an...@xiaomi.com>
---
arch/arm/src/common/arm_assert.c | 31 +++++++++++++---------------
arch/xtensa/src/common/xtensa_dumpstate.c | 34 +++++++++++++------------------
2 files changed, 28 insertions(+), 37 deletions(-)
diff --git a/arch/arm/src/common/arm_assert.c b/arch/arm/src/common/arm_assert.c
index 6c1abb7..2d09aed 100644
--- a/arch/arm/src/common/arm_assert.c
+++ b/arch/arm/src/common/arm_assert.c
@@ -58,12 +58,7 @@
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
#ifdef CONFIG_ARCH_STACKDUMP
-static uint32_t s_last_regs[XCPTCONTEXT_REGS];
/****************************************************************************
* Private Functions
@@ -96,16 +91,6 @@ static void arm_stackdump(uint32_t sp, uint32_t stack_top)
static void arm_registerdump(FAR volatile uint32_t *regs)
{
- /* Are user registers available from interrupt processing? */
-
- if (regs == NULL)
- {
- /* No.. capture user registers by hand */
-
- arm_saveusercontext(s_last_regs);
- regs = s_last_regs;
- }
-
/* Dump the interrupt registers */
_alert("R0: %08x R1: %08x R2: %08x R3: %08x\n",
@@ -368,9 +353,21 @@ static void arm_dumpstate(void)
sched_dumpstack(rtcb->pid);
#endif
- /* Dump the registers (if available) */
+ /* Update the xcp context */
+
+ if (CURRENT_REGS)
+ {
+ memcpy(rtcb->xcp.regs,
+ (FAR uintptr_t *)CURRENT_REGS, XCPTCONTEXT_SIZE);
+ }
+ else
+ {
+ arm_saveusercontext(rtcb->xcp.regs);
+ }
+
+ /* Dump the registers */
- arm_registerdump(CURRENT_REGS);
+ arm_registerdump(rtcb->xcp.regs);
/* Dump the irq stack */
diff --git a/arch/xtensa/src/common/xtensa_dumpstate.c b/arch/xtensa/src/common/xtensa_dumpstate.c
index 8ed7bf8..39e6629 100644
--- a/arch/xtensa/src/common/xtensa_dumpstate.c
+++ b/arch/xtensa/src/common/xtensa_dumpstate.c
@@ -43,12 +43,6 @@
#ifdef CONFIG_DEBUG_ALERT
/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static uint32_t s_last_regs[XCPTCONTEXT_REGS];
-
-/****************************************************************************
* Private Functions
****************************************************************************/
@@ -238,20 +232,8 @@ static void xtensa_stackdump(uint32_t sp, uint32_t stack_top)
* Name: xtensa_registerdump
****************************************************************************/
-static inline void xtensa_registerdump(void)
+static inline void xtensa_registerdump(uintptr_t *regs)
{
- uint32_t *regs = (uint32_t *)CURRENT_REGS; /* Don't need volatile here */
-
- /* Are user registers available from interrupt processing? */
-
- if (regs == NULL)
- {
- /* No.. capture user registers by hand */
-
- xtensa_context_save(s_last_regs);
- regs = s_last_regs;
- }
-
_alert(" PC: %08lx PS: %08lx\n",
(unsigned long)regs[REG_PC], (unsigned long)regs[REG_PS]);
_alert(" A0: %08lx A1: %08lx A2: %08lx A3: %08lx\n",
@@ -301,9 +283,21 @@ void xtensa_dumpstate(void)
_alert("CPU%d:\n", up_cpu_index());
#endif
+ /* Update the xcp context */
+
+ if (CURRENT_REGS)
+ {
+ memcpy(rtcb->xcp.regs,
+ (uintptr_t *)CURRENT_REGS, XCPTCONTEXT_REGS);
+ }
+ else
+ {
+ xtensa_context_save(rtcb->xcp.regs);
+ }
+
/* Dump the registers (if available) */
- xtensa_registerdump();
+ xtensa_registerdump(rtcb->xcp.regs);
/* Dump the backtrace */
[incubator-nuttx] 02/02: risc-v/assert: add CURRENT_REGS check to avoid null pointer reference
Posted by xi...@apache.org.
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
commit 3544fc1fd6c9f81a29d1306ec9449157279cddb4
Author: chao.an <an...@xiaomi.com>
AuthorDate: Fri Jan 14 23:16:38 2022 +0800
risc-v/assert: add CURRENT_REGS check to avoid null pointer reference
Signed-off-by: chao.an <an...@xiaomi.com>
---
arch/risc-v/src/common/riscv_assert.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/arch/risc-v/src/common/riscv_assert.c b/arch/risc-v/src/common/riscv_assert.c
index 7e3bbed..2b49e8d 100644
--- a/arch/risc-v/src/common/riscv_assert.c
+++ b/arch/risc-v/src/common/riscv_assert.c
@@ -29,6 +29,8 @@
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
+
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
@@ -313,9 +315,21 @@ static void riscv_dumpstate(void)
sched_dumpstack(rtcb->pid);
#endif
+ /* Update the xcp context */
+
+ if (CURRENT_REGS)
+ {
+ memcpy(rtcb->xcp.regs,
+ (uintptr_t *)CURRENT_REGS, XCPTCONTEXT_REGS);
+ }
+ else
+ {
+ riscv_saveusercontext(rtcb->xcp.regs);
+ }
+
/* Dump the registers (if available) */
- riscv_registerdump((volatile uintptr_t *)CURRENT_REGS);
+ riscv_registerdump(rtcb->xcp.regs);
/* Get the limits on the user stack memory */
@@ -347,7 +361,11 @@ static void riscv_dumpstate(void)
/* Extract the user stack pointer */
- sp = CURRENT_REGS[REG_SP];
+ if (CURRENT_REGS)
+ {
+ sp = CURRENT_REGS[REG_SP];
+ }
+
_alert("sp: %" PRIxREG "\n", sp);
}
else if (CURRENT_REGS)