diff --git a/boards/arm/cxd56xx/common/src/cxd56_crashdump.c b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c index fa186f5aca..893137919e 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_crashdump.c +++ b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c @@ -98,15 +98,14 @@ static void copy_reverse(stack_word_t *dest, stack_word_t *src, int size) * Name: board_crashdump ****************************************************************************/ -void board_crashdump(uintptr_t currentsp, void *tcb, - const char *filename, int lineno) +void board_crashdump(uintptr_t sp, struct tcb_s *tcb, + const char *filename, int lineno, + const char *msg) { - struct tcb_s *rtcb; fullcontext_t *pdump; enter_critical_section(); - rtcb = (struct tcb_s *)tcb; #ifdef CONFIG_CXD56_BACKUPLOG pdump = up_backuplog_alloc("crash", sizeof(fullcontext_t)); #else @@ -151,10 +150,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* Save Context */ #if CONFIG_TASK_NAME_SIZE > 0 - strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name)); + strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name)); #endif - pdump->info.pid = rtcb->pid; + pdump->info.pid = tcb->pid; /* If current_regs is not NULL then we are in an interrupt context * and the user context is in current_regs else we are running in @@ -164,7 +163,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb, if (CURRENT_REGS) { #if CONFIG_ARCH_INTERRUPTSTACK > 3 - pdump->info.stacks.interrupt.sp = currentsp; + pdump->info.stacks.interrupt.sp = sp; #endif pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \ INTSTACK_PRESENT); @@ -177,12 +176,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* users context */ pdump->info.flags |= USERSTACK_PRESENT; - pdump->info.stacks.user.sp = currentsp; + pdump->info.stacks.user.sp = sp; } - pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr + - rtcb->adj_stack_size; - pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size; + pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr + + tcb->adj_stack_size; + pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size; #if CONFIG_ARCH_INTERRUPTSTACK > 3 /* Get the limits on the interrupt stack memory */ diff --git a/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c b/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c index eb3fb5a11e..e3cc48813e 100644 --- a/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c +++ b/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c @@ -379,17 +379,15 @@ int stm32_bbsram_int(void) ****************************************************************************/ #if defined(CONFIG_STM32F4_SAVE_CRASHDUMP) -void board_crashdump(uintptr_t currentsp, void *tcb, - const char *filename, int lineno) +void board_crashdump(uintptr_t sp, struct tcb_s *tcb, + const char *filename, int lineno, + const char *msg) { fullcontext_t *pdump = (fullcontext_t *)&g_sdata; - struct tcb_s *rtcb; int rv; enter_critical_section(); - rtcb = (struct tcb_s *)tcb; - /* Zero out everything */ memset(pdump, 0, sizeof(fullcontext_t)); @@ -423,10 +421,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* Save Context */ #if CONFIG_TASK_NAME_SIZE > 0 - strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name)); + strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name)); #endif - pdump->info.pid = rtcb->pid; + pdump->info.pid = tcb->pid; /* If current_regs is not NULL then we are in an interrupt context * and the user context is in current_regs else we are running in @@ -435,7 +433,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb, if (CURRENT_REGS) { - pdump->info.stacks.interrupt.sp = currentsp; + pdump->info.stacks.interrupt.sp = sp; pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \ INTSTACK_PRESENT); memcpy(pdump->info.regs, (void *)CURRENT_REGS, @@ -447,12 +445,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* users context */ pdump->info.flags |= USERSTACK_PRESENT; - pdump->info.stacks.user.sp = currentsp; + pdump->info.stacks.user.sp = sp; } - pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr + - rtcb->adj_stack_size; - pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size; + pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr + + tcb->adj_stack_size; + pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size; #if CONFIG_ARCH_INTERRUPTSTACK > 3 /* Get the limits on the interrupt stack memory */ diff --git a/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c b/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c index bfc87153ac..5793e720f7 100644 --- a/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c +++ b/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c @@ -379,17 +379,15 @@ int stm32_bbsram_int(void) ****************************************************************************/ #if defined(CONFIG_STM32F7_SAVE_CRASHDUMP) -void board_crashdump(uintptr_t currentsp, void *tcb, - const char *filename, int lineno) +void board_crashdump(uintptr_t sp, struct tcb_s *tcb, + const char *filename, int lineno, + const char *msg) { fullcontext_t *pdump = (fullcontext_t *)&g_sdata; - struct tcb_s *rtcb; int rv; enter_critical_section(); - rtcb = (struct tcb_s *)tcb; - /* Zero out everything */ memset(pdump, 0, sizeof(fullcontext_t)); @@ -423,10 +421,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* Save Context */ #if CONFIG_TASK_NAME_SIZE > 0 - strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name)); + strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name)); #endif - pdump->info.pid = rtcb->pid; + pdump->info.pid = tcb->pid; /* If current_regs is not NULL then we are in an interrupt context * and the user context is in current_regs else we are running in @@ -435,7 +433,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb, if (CURRENT_REGS) { - pdump->info.stacks.interrupt.sp = currentsp; + pdump->info.stacks.interrupt.sp = sp; pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \ INTSTACK_PRESENT); memcpy(pdump->info.regs, (void *)CURRENT_REGS, @@ -447,12 +445,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* users context */ pdump->info.flags |= USERSTACK_PRESENT; - pdump->info.stacks.user.sp = currentsp; + pdump->info.stacks.user.sp = sp; } - pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr + - rtcb->adj_stack_size; - pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size; + pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr + + tcb->adj_stack_size; + pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size; #if CONFIG_ARCH_INTERRUPTSTACK > 3 /* Get the limits on the interrupt stack memory */ diff --git a/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c b/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c index 776f20df03..83c7621317 100644 --- a/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c +++ b/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c @@ -332,18 +332,16 @@ int rx65n_sbram_int(void) ****************************************************************************/ #if defined(CONFIG_RX65N_SAVE_CRASHDUMP) -void board_crashdump(uintptr_t currentsp, void *tcb, - const char *filename, int lineno) +void board_crashdump(uintptr_t sp, struct tcb_s *tcb, + const char *filename, int lineno, + const char *msg) { - struct fullcontext *pdump ; + struct fullcontext *pdump; pdump = (struct fullcontext *)&g_sdata; - struct tcb_s *rtcb; int rv; enter_critical_section(); - rtcb = (struct tcb_s *)tcb; - /* Zero out everything */ memset((uint8_t *)pdump, 0, sizeof(struct fullcontext)); @@ -377,10 +375,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* Save Context */ #if CONFIG_TASK_NAME_SIZE > 0 - strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name)); + strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name)); #endif - pdump->info.pid = rtcb->pid; + pdump->info.pid = tcb->pid; /* If current_regs is not NULL then we are in an interrupt context * and the user context is in current_regs else we are running in @@ -389,7 +387,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb, if (g_current_regs) { - pdump->info.stacks.interrupt.sp = currentsp; + pdump->info.stacks.interrupt.sp = sp; pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \ INTSTACK_PRESENT); memcpy((uint8_t *)pdump->info.regs, (void *)g_current_regs, @@ -401,12 +399,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* users context */ pdump->info.flags |= USERSTACK_PRESENT; - pdump->info.stacks.user.sp = currentsp; + pdump->info.stacks.user.sp = sp; } - pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr + - rtcb->adj_stack_size; - pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size; + pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr + + tcb->adj_stack_size; + pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size; #if CONFIG_ARCH_INTERRUPTSTACK > 3 /* Get the limits on the interrupt stack memory */ diff --git a/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c b/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c index 630dc9332c..42e51f5ac2 100644 --- a/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c +++ b/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c @@ -330,18 +330,16 @@ int rx65n_sbram_int(void) ****************************************************************************/ #if defined(CONFIG_RX65N_SAVE_CRASHDUMP) -void board_crashdump(uintptr_t currentsp, void *tcb, - const char *filename, int lineno) +void board_crashdump(uintptr_t sp, struct tcb_s *tcb, + const char *filename, int lineno, + const char *msg) { - struct fullcontext *pdump ; + struct fullcontext *pdump; pdump = (struct fullcontext *)&g_sdata; - struct tcb_s *rtcb; int rv; enter_critical_section(); - rtcb = (struct tcb_s *)tcb; - /* Zero out everything */ memset((uint8_t *)pdump, 0, sizeof(struct fullcontext)); @@ -375,10 +373,10 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* Save Context */ #if CONFIG_TASK_NAME_SIZE > 0 - strlcpy(pdump->info.name, rtcb->name, sizeof(pdump->info.name)); + strlcpy(pdump->info.name, tcb->name, sizeof(pdump->info.name)); #endif - pdump->info.pid = rtcb->pid; + pdump->info.pid = tcb->pid; /* If current_regs is not NULL then we are in an interrupt context * and the user context is in current_regs else we are running in @@ -387,7 +385,7 @@ void board_crashdump(uintptr_t currentsp, void *tcb, if (g_current_regs) { - pdump->info.stacks.interrupt.sp = currentsp; + pdump->info.stacks.interrupt.sp = sp; pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \ INTSTACK_PRESENT); memcpy((uint8_t *)pdump->info.regs, (void *)g_current_regs, @@ -399,12 +397,12 @@ void board_crashdump(uintptr_t currentsp, void *tcb, /* users context */ pdump->info.flags |= USERSTACK_PRESENT; - pdump->info.stacks.user.sp = currentsp; + pdump->info.stacks.user.sp = sp; } - pdump->info.stacks.user.top = (uint32_t)rtcb->stack_base_ptr + - rtcb->adj_stack_size; - pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size; + pdump->info.stacks.user.top = (uint32_t)tcb->stack_base_ptr + + tcb->adj_stack_size; + pdump->info.stacks.user.size = (uint32_t)tcb->adj_stack_size; #if CONFIG_ARCH_INTERRUPTSTACK > 3 /* Get the limits on the interrupt stack memory */ diff --git a/include/nuttx/board.h b/include/nuttx/board.h index 02887563d0..05b324b780 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -802,9 +802,10 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg); ****************************************************************************/ #ifdef CONFIG_BOARD_CRASHDUMP -void board_crashdump(uintptr_t currentsp, FAR void *tcb, - FAR const char *filename, - int lineno); +struct tcb_s; +void board_crashdump(uintptr_t sp, FAR struct tcb_s *tcb, + FAR const char *filename, int lineno, + FAR const char *msg); #endif /**************************************************************************** diff --git a/sched/misc/assert.c b/sched/misc/assert.c index 034b0a028a..cf068f09da 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -525,7 +525,7 @@ void _assert(FAR const char *filename, int linenum, FAR const char *msg) #endif #ifdef CONFIG_BOARD_CRASHDUMP - board_crashdump(up_getsp(), rtcb, filename, linenum); + board_crashdump(up_getsp(), rtcb, filename, linenum, msg); #endif /* Flush any buffered SYSLOG data */