arch/avr,renesas,risc-v: The *_getsp function was moved to a header

file, remove it from the different source files that used to implement
it to avoid redefinitions.
This commit is contained in:
Ouss4 2020-05-07 00:45:42 +01:00 committed by patacongo
parent a4dd967440
commit d56c613b7d
9 changed files with 11 additions and 128 deletions

View File

@ -58,27 +58,6 @@
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
/* There may be a built-in to do this, but I don't know if it is enabled */
static inline uint16_t up_getsp(void)
{
uint8_t spl;
uint8_t sph;
__asm__ __volatile__
(
"in %0, __SP_L__\n\t"
"in %1, __SP_H__\n"
: "=r" (spl), "=r" (sph)
:
);
return (uint16_t)sph << 8 | spl;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -161,7 +140,7 @@ static inline void up_registerdump(void)
void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint16_t sp = up_getsp();
uint16_t sp = avr_getsp();
uint16_t ustackbase;
uint16_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 0

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)
{
uint32_t retval;
__asm__ __volatile__ (
"mov\t%0,sp\n\t"
: "=r" (retval)
:
);
return retval;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -127,7 +110,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 = avr_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3

View File

@ -172,7 +172,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(avr_getsp(), running_task(), filename, lineno);
#endif
#ifdef CONFIG_ARCH_USBDUMP

View File

@ -178,7 +178,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(renesas_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View File

@ -62,24 +62,6 @@ static uint8_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: m16c_getsp
****************************************************************************/
static inline uint16_t m16c_getsp(void)
{
uint16_t sp;
__asm__ __volatile__
(
"\tstc sp, %0\n\t"
: "=r" (sp)
:
: "memory"
);
return sp;
}
/****************************************************************************
* Name: m16c_getusersp
****************************************************************************/
@ -152,7 +134,7 @@ static inline void m16c_registerdump(void)
void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint16_t sp = m16c_getsp();
uint16_t sp = renesas_getsp();
uint16_t ustackbase;
uint16_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3

View File

@ -48,19 +48,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
uint16_t up_getsp(void)
{
uint16_t sp;
__asm__ __volatile__("\tmvfc usp, %0\n\t": "=r" (sp):: "memory"); /* check */
return sp;
}
/****************************************************************************
* Name: rx65n_getusersp
****************************************************************************/
@ -141,7 +128,7 @@ static inline void rx65n_registerdump(void)
void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = renesas_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3

View File

@ -61,24 +61,6 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: sh1_getsp
****************************************************************************/
static inline uint32_t sh1_getsp(void)
{
uint32_t sp;
__asm__ __volatile__
(
"mov r15, %0\n\t"
: "=&z" (sp)
:
: "memory"
);
return sp;
}
/****************************************************************************
* Name: sh1_stackdump
****************************************************************************/
@ -142,7 +124,7 @@ static inline void sh1_registerdump(void)
void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = sh1_getsp();
uint32_t sp = renesas_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3

View File

@ -80,21 +80,6 @@
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
static inline uint32_t up_getsp(void)
{
register uint32_t sp;
__asm__
(
"\tadd %0, x0, x2\n"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -200,7 +185,7 @@ static inline void up_registerdump(void)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint32_t sp = up_getsp();
uint32_t sp = riscv_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
@ -396,7 +381,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(riscv_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);

View File

@ -82,21 +82,6 @@
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: up_getsp
****************************************************************************/
static inline uint64_t up_getsp(void)
{
register uint64_t sp;
__asm__
(
"\tadd %0, x0, x2\n"
: "=r"(sp)
);
return sp;
}
/****************************************************************************
* Name: up_stackdump
****************************************************************************/
@ -211,7 +196,7 @@ static inline void up_registerdump(void)
static void up_dumpstate(void)
{
struct tcb_s *rtcb = running_task();
uint64_t sp = up_getsp();
uint64_t sp = riscv_getsp();
uintptr_t ustackbase;
uintptr_t ustacksize;
#if CONFIG_ARCH_INTERRUPTSTACK > 7
@ -427,7 +412,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(riscv_getsp(), running_task(), filename, lineno);
#endif
_up_assert(EXIT_FAILURE);