1
0
Fork 0
forked from nuttx/nuttx-update

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:
Xiang Xiao 2020-07-09 03:05:56 +08:00 committed by Abdelatif Guettouche
parent 4176a3828b
commit 924ba84737
15 changed files with 39 additions and 199 deletions

View file

@ -84,23 +84,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
uint32_t sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -190,7 +173,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = arm_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
@ -369,7 +352,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(arm_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -82,23 +82,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
uint32_t sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -227,7 +210,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = arm_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
@ -426,7 +409,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(arm_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -70,23 +70,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
uint32_t sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -212,7 +195,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = arm_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 7
@ -460,7 +443,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(arm_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -70,23 +70,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
uint32_t sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -220,7 +203,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = arm_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 7
@ -449,7 +432,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(arm_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -67,23 +67,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
uint32_t sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -209,7 +192,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = arm_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
@ -419,7 +402,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(arm_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -70,23 +70,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
uint32_t sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -220,7 +203,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = arm_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 7
@ -449,7 +432,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(arm_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -185,7 +185,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint16_t sp = up_getsp();
uint16_t sp = hc_getsp();
uint16_t ustackbase;
uint16_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
@ -354,7 +354,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(hc_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -177,7 +177,7 @@ void up_assert(const uint8_t *filename, int lineno)
#endif
#ifdef CONFIG_BOARD_CRASHDUMP
board_crashdump(up_getsp(), running_task(), filename, lineno);
board_crashdump(mips_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -58,23 +58,6 @@
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
register uint32_t sp;
__asm__
(
"\tadd %0, $0, $29\n"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -147,7 +130,7 @@ static inline void up_registerdump(void)
void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = mips_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -81,29 +81,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* I don't know if the builtin to get SP is enabled */
static inline uint32_t up_getsp(void)
{
#if 0
uint32_t sp;
__asm__
(
"\tmov %0, sp\n\t"
: "=r"(sp)
);
return sp;
#else
return 0;
#endif
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -233,7 +210,7 @@ static int assert_tracecallback(FAR struct usbtrace_s *trace, FAR void *arg)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = or1k_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
@ -432,7 +409,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(or1k_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View file

@ -117,7 +117,7 @@ static void xtensa_assert(int errorcode)
#ifdef CONFIG_BOARD_CRASHDUMP
/* Perform board-specific crash dump */
board_crashdump(up_getsp(), running_task(), filename, lineno);
board_crashdump(xtensa_getsp(), running_task(), filename, lineno);
#endif
/* Flush any buffered SYSLOG data (from the above) */