mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
arch: call *_getsp in up_assert and board_crashdump
and remove the static up_getsp Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Abdelatif Guettouche
parent
4176a3828b
commit
924ba84737
@@ -182,7 +182,7 @@ void up_assert(const uint8_t *filename, int lineno)
|
||||
syslog_flush();
|
||||
|
||||
#ifdef CONFIG_BOARD_CRASHDUMP
|
||||
board_crashdump(up_getsp(), running_task(), filename, lineno);
|
||||
board_crashdump(misoc_getsp(), running_task(), filename, lineno);
|
||||
#endif
|
||||
|
||||
_up_assert(EXIT_FAILURE);
|
||||
|
||||
@@ -58,19 +58,6 @@
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_getsp
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32_t up_getsp(void)
|
||||
{
|
||||
register uint32_t sp;
|
||||
|
||||
__asm__ __volatile__("addi %0, sp, 0" : "=r" (sp));
|
||||
|
||||
return sp;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_stackdump
|
||||
****************************************************************************/
|
||||
@@ -100,22 +87,26 @@ static inline void up_registerdump(void)
|
||||
{
|
||||
_alert("EPC:%08x \n",
|
||||
g_current_regs[REG_EPC]);
|
||||
_alert(" X0:%08x A0:%08x A1:%08x A2:%08x A3:%08x A4:%08x A5:%08x A6:%08x\n",
|
||||
_alert(" X0:%08x A0:%08x A1:%08x A2:%08x "
|
||||
" A3:%08x A4:%08x A5:%08x A6:%08x\n",
|
||||
g_current_regs[REG_X0_NDX], g_current_regs[REG_X1_NDX],
|
||||
g_current_regs[REG_X2_NDX], g_current_regs[REG_X3_NDX],
|
||||
g_current_regs[REG_X4_NDX], g_current_regs[REG_X5_NDX],
|
||||
g_current_regs[REG_X6_NDX], g_current_regs[REG_X7_NDX]);
|
||||
_alert(" A7:%08x X9:%08x X10:%08x X11:%08x X12:%08x X13:%08x X14:%08x X15:%08x\n",
|
||||
_alert(" A7:%08x X9:%08x X10:%08x X11:%08x "
|
||||
"X12:%08x X13:%08x X14:%08x X15:%08x\n",
|
||||
g_current_regs[REG_X8_NDX], g_current_regs[REG_X9_NDX],
|
||||
g_current_regs[REG_X10_NDX], g_current_regs[REG_X11_NDX],
|
||||
g_current_regs[REG_X12_NDX], g_current_regs[REG_X13_NDX],
|
||||
g_current_regs[REG_X14_NDX], g_current_regs[REG_X15_NDX]);
|
||||
_alert("X16:%08x X17:%08x X18:%08x X19:%08x X20:%08x X21:%08x X22:%08x X23:%08x\n",
|
||||
_alert("X16:%08x X17:%08x X18:%08x X19:%08x "
|
||||
"X20:%08x X21:%08x X22:%08x X23:%08x\n",
|
||||
g_current_regs[REG_X16_NDX], g_current_regs[REG_X17_NDX],
|
||||
g_current_regs[REG_X18_NDX], g_current_regs[REG_X19_NDX],
|
||||
g_current_regs[REG_X20_NDX], g_current_regs[REG_X21_NDX],
|
||||
g_current_regs[REG_X22_NDX], g_current_regs[REG_X23_NDX]);
|
||||
_alert("X24:%08x X25:%08x GP:%08x FP:%08x SP:%08x RA:%08x EA:%08x BA:%08x\n",
|
||||
_alert("X24:%08x X25:%08x GP:%08x FP:%08x "
|
||||
" SP:%08x RA:%08x EA:%08x BA:%08x\n",
|
||||
g_current_regs[REG_X24_NDX], g_current_regs[REG_X25_NDX],
|
||||
g_current_regs[REG_X26_NDX], g_current_regs[REG_X27_NDX],
|
||||
g_current_regs[REG_X28_NDX], g_current_regs[REG_X29_NDX],
|
||||
@@ -136,7 +127,7 @@ static inline void up_registerdump(void)
|
||||
void lm32_dumpstate(void)
|
||||
{
|
||||
struct tcb_s *rtcb = running_task();
|
||||
uint32_t sp = up_getsp();
|
||||
uint32_t sp = misoc_getsp();
|
||||
uint32_t ustackbase;
|
||||
uint32_t ustacksize;
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
|
||||
@@ -181,7 +181,7 @@ void up_assert(const uint8_t * filename, int lineno)
|
||||
syslog_flush();
|
||||
|
||||
#ifdef CONFIG_BOARD_CRASHDUMP
|
||||
board_crashdump(up_getsp(), running_task(), filename, lineno);
|
||||
board_crashdump(misoc_getsp(), running_task(), filename, lineno);
|
||||
#endif
|
||||
|
||||
_up_assert(EXIT_FAILURE);
|
||||
|
||||
@@ -58,19 +58,6 @@
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_getsp
|
||||
****************************************************************************/
|
||||
|
||||
static inline uint32_t up_getsp(void)
|
||||
{
|
||||
register uint32_t sp;
|
||||
|
||||
__asm__ __volatile__("addi %0, sp, 0":"=r"(sp));
|
||||
|
||||
return sp;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_stackdump
|
||||
****************************************************************************/
|
||||
@@ -100,25 +87,29 @@ static inline void up_registerdump(void)
|
||||
{
|
||||
_alert("EPC:%08x \n", g_current_regs[REG_CSR_MEPC]);
|
||||
_alert
|
||||
(" X0:%08x A0:%08x A1:%08x A2:%08x A3:%08x A4:%08x A5:%08x A6:%08x\n",
|
||||
(" X0:%08x A0:%08x A1:%08x A2:%08x "
|
||||
" A3:%08x A4:%08x A5:%08x A6:%08x\n",
|
||||
g_current_regs[REG_X0_NDX], g_current_regs[REG_X1_NDX],
|
||||
g_current_regs[REG_X2_NDX], g_current_regs[REG_X3_NDX],
|
||||
g_current_regs[REG_X4_NDX], g_current_regs[REG_X5_NDX],
|
||||
g_current_regs[REG_X6_NDX], g_current_regs[REG_X7_NDX]);
|
||||
_alert
|
||||
(" A7:%08x X9:%08x X10:%08x X11:%08x X12:%08x X13:%08x X14:%08x X15:%08x\n",
|
||||
(" A7:%08x X9:%08x X10:%08x X11:%08x "
|
||||
"X12:%08x X13:%08x X14:%08x X15:%08x\n",
|
||||
g_current_regs[REG_X8_NDX], g_current_regs[REG_X9_NDX],
|
||||
g_current_regs[REG_X10_NDX], g_current_regs[REG_X11_NDX],
|
||||
g_current_regs[REG_X12_NDX], g_current_regs[REG_X13_NDX],
|
||||
g_current_regs[REG_X14_NDX], g_current_regs[REG_X15_NDX]);
|
||||
_alert
|
||||
("X16:%08x X17:%08x X18:%08x X19:%08x X20:%08x X21:%08x X22:%08x X23:%08x\n",
|
||||
("X16:%08x X17:%08x X18:%08x X19:%08x "
|
||||
"X20:%08x X21:%08x X22:%08x X23:%08x\n",
|
||||
g_current_regs[REG_X16_NDX], g_current_regs[REG_X17_NDX],
|
||||
g_current_regs[REG_X18_NDX], g_current_regs[REG_X19_NDX],
|
||||
g_current_regs[REG_X20_NDX], g_current_regs[REG_X21_NDX],
|
||||
g_current_regs[REG_X22_NDX], g_current_regs[REG_X23_NDX]);
|
||||
_alert
|
||||
("X24:%08x X25:%08x GP:%08x FP:%08x SP:%08x RA:%08x EA:%08x BA:%08x\n",
|
||||
("X24:%08x X25:%08x GP:%08x FP:%08x "
|
||||
" SP:%08x RA:%08x EA:%08x BA:%08x\n",
|
||||
g_current_regs[REG_X24_NDX], g_current_regs[REG_X25_NDX],
|
||||
g_current_regs[REG_X26_NDX], g_current_regs[REG_X27_NDX],
|
||||
g_current_regs[REG_X28_NDX], g_current_regs[REG_X29_NDX],
|
||||
@@ -138,7 +129,7 @@ static inline void up_registerdump(void)
|
||||
void minerva_dumpstate(void)
|
||||
{
|
||||
struct tcb_s *rtcb = running_task();
|
||||
uint32_t sp = up_getsp();
|
||||
uint32_t sp = misoc_getsp();
|
||||
uint32_t ustackbase;
|
||||
uint32_t ustacksize;
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
|
||||
Reference in New Issue
Block a user