arch: up_getusrsp change to inline and implement in irq.h

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen 2024-12-31 17:00:17 +08:00 committed by Xiang Xiao
parent 1358942132
commit 89455bc9a1
53 changed files with 205 additions and 263 deletions

View file

@ -362,6 +362,12 @@ static always_inline_function uint32_t up_getsp(void)
return sp;
}
static always_inline_function uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = (uint32_t *)regs;
return ptr[REG_SP];
}
static always_inline_function bool up_interrupt_context(void)
{
return getipsr() != 0;

View file

@ -473,6 +473,12 @@ static inline_function uint32_t up_getsp(void)
return sp;
}
static inline_function uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = (uint32_t *)regs;
return ptr[REG_SP];
}
noinstrument_function
static inline_function void up_set_interrupt_context(bool flag)
{

View file

@ -512,6 +512,12 @@ static always_inline_function uint32_t up_getsp(void)
return sp;
}
static always_inline_function uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = (uint32_t *)regs;
return ptr[REG_SP];
}
static always_inline_function bool up_interrupt_context(void)
{
return getipsr() != 0;

View file

@ -468,6 +468,12 @@ static inline_function uint32_t up_getsp(void)
return sp;
}
static inline_function uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = (uint32_t *)regs;
return ptr[REG_SP];
}
noinstrument_function
static inline_function void up_set_interrupt_context(bool flag)
{

View file

@ -487,6 +487,12 @@ static always_inline_function uint32_t up_getsp(void)
return sp;
}
static always_inline_function uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = (uint32_t *)regs;
return ptr[REG_SP];
}
static always_inline_function bool up_interrupt_context(void)
{
return getipsr() != 0;

View file

@ -468,6 +468,12 @@ static inline_function uint32_t up_getsp(void)
return sp;
}
static inline_function uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = (uint32_t *)regs;
return ptr[REG_SP];
}
noinstrument_function
static inline_function void up_set_interrupt_context(bool flag)
{

View file

@ -262,6 +262,12 @@ static inline_function uint32_t up_getsp(void)
return sp;
}
static inline_function uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = (uint32_t *)regs;
return ptr[REG_SP];
}
noinstrument_function
static inline_function bool up_interrupt_context(void)
{

View file

@ -43,16 +43,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -462,6 +462,14 @@ static inline_function void up_irq_restore(irqstate_t flags)
#define up_getusrpc(regs) \
(((uintptr_t *)((regs) ? (regs) : running_regs()))[REG_ELR])
#ifndef CONFIG_BUILD_KERNEL
# define up_getusrsp(regs) \
((uintptr_t)((uint64_t *)(regs))[REG_SP_ELX])
#else
# define up_getusrsp(regs) \
((uintptr_t)((uint64_t *)(regs))[REG_SP_EL0])
#endif
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -46,19 +46,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
#ifndef CONFIG_BUILD_KERNEL
return ((uint64_t *)regs)[REG_SP_ELX];
#else
return ((uint64_t *)regs)[REG_SP_EL0];
#endif
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -126,6 +126,13 @@ static inline_function void up_set_current_regs(FAR uint8_t *regs)
#define up_interrupt_context() (up_current_regs() != NULL)
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint8_t *)(regs))[REG_R13])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -40,16 +40,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint8_t *ptr = regs;
return ptr[REG_R13];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -40,16 +40,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint8_t *ptr = regs;
return ptr[REG_R13];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -175,6 +175,13 @@ static inline_function bool up_interrupt_context(void)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t*)(regs))[REG_SP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -37,16 +37,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -127,6 +127,16 @@ static inline_function void up_set_current_regs(FAR uint8_t *regs)
#define up_interrupt_context() (up_current_regs() != NULL)
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
static inline_function uintptr_t up_getusrsp(void *regs)
{
uint8_t *ptr = regs;
return (uintptr_t)(ptr[REG_SPH] << 8 | ptr[REG_SPL]);
}
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

View file

@ -38,16 +38,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint8_t *ptr = regs;
return (uintptr_t)(ptr[REG_SPH] << 8 | ptr[REG_SPL]);
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -138,6 +138,13 @@ static inline_function void up_set_current_regs(uint32_t *regs)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_EPC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t*)(regs))[REG_SP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -40,16 +40,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -227,5 +227,12 @@ struct xcptcontext
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_EPC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t *)(regs))[REG_SP])
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_MISOC_INCLUDE_LM32_IRQ_H */

View file

@ -308,5 +308,12 @@ struct xcptcontext
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_CSR_MEPC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t *)(regs))[REG_X2])
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_MISOC_INCLUDE_MINERVA_IRQ_H */

View file

@ -39,16 +39,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -39,16 +39,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_X2];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -157,6 +157,13 @@ static inline_function bool up_interrupt_context(void)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t *)(regs))[REG_R13])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -38,16 +38,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_R13];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -350,6 +350,16 @@ static inline_function irqstate_t up_irq_enable(void)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
static inline_function uintptr_t up_getusrsp(void *regs)
{
uint8_t *ptr = regs;
return (uintptr_t)(ptr[REG_SP] << 8 | ptr[REG_SP + 1]);
}
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -1088,6 +1088,13 @@ static inline_function void up_irq_restore(irqstate_t flags)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t *)(regs))[REG_SP])
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_RENESAS_INCLUDE_RX65N_IRQ_H */

View file

@ -571,6 +571,13 @@ static inline_function void up_irq_restore(irqstate_t flags)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t *)(regs))[REG_SP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -39,16 +39,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint8_t *ptr = regs;
return (uintptr_t)(ptr[REG_SP] << 8 | ptr[REG_SP + 1]);
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -41,16 +41,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -38,16 +38,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -830,6 +830,13 @@ noinstrument_function static inline_function bool up_interrupt_context(void)
#define up_getusrpc(regs) \
(((uintptr_t *)((regs) ? (regs) : running_regs()))[REG_EPC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
(((uintptr_t*)(regs))[REG_SP])
#undef EXTERN
#if defined(__cplusplus)
}

View file

@ -39,16 +39,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uintptr_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -183,6 +183,13 @@ static inline_function bool up_interrupt_context(void)
#define up_getusrpc(regs) \
(((xcpt_reg_t *)((regs) ? (regs) : up_current_regs()))[JB_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((xcpt_reg_t *)(regs))[JB_SP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -34,16 +34,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
xcpt_reg_t *ptr = regs;
return ptr[JB_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -175,6 +175,13 @@ static inline_function bool up_interrupt_context(void)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t *)(regs))[REG_I6])
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

View file

@ -39,16 +39,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_I6];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -186,6 +186,26 @@ static inline_function bool up_interrupt_context(void)
return ret;
}
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
static inline_function uintptr_t up_getusrsp(void *regs)
{
uintptr_t *csa = regs;
while (((uintptr_t)csa & PCXI_UL) == 0)
{
csa = tricore_csa2addr((uintptr_t)csa);
csa = (uintptr_t *)csa[0];
}
csa = tricore_csa2addr((uintptr_t)csa);
return csa[REG_SP];
}
#endif /* __ASSEMBLY__ */
#undef EXTERN

View file

@ -39,25 +39,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uintptr_t *csa = regs;
while (((uintptr_t)csa & PCXI_UL) == 0)
{
csa = tricore_csa2addr((uintptr_t)csa);
csa = (uintptr_t *)csa[0];
}
csa = tricore_csa2addr((uintptr_t)csa);
return csa[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -120,6 +120,13 @@ static inline_function void up_set_current_regs(uint32_t *regs)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : up_current_regs()))[REG_EIP])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint32_t *)(regs))[REG_ESP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -35,16 +35,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint32_t *ptr = regs;
return ptr[REG_ESP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -182,6 +182,13 @@ static inline_function void up_set_interrupt_context(bool flag)
#define up_getusrpc(regs) \
(((uint64_t *)((regs) ? (regs) : running_regs()))[REG_RIP])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((uint64_t *)(regs))[REG_RSP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -37,16 +37,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uint64_t *ptr = regs;
return ptr[REG_RSP];
}
/****************************************************************************
* Name: x86_64_registerdump
****************************************************************************/

View file

@ -468,6 +468,13 @@ noinstrument_function static inline_function bool up_interrupt_context(void)
#define up_getusrpc(regs) \
(((uint32_t *)((regs) ? (regs) : running_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
(((uintptr_t*)(regs))[REG_A1])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -39,16 +39,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void *regs)
{
uintptr_t *ptr = regs;
return ptr[REG_A1];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -112,6 +112,13 @@ static inline_function void up_set_current_regs(FAR chipreg_t *regs)
#define up_getusrpc(regs) \
(((FAR chipreg_t *)((regs) ? (regs) : up_current_regs()))[REG_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((FAR uint32_t*)(regs))[REG_SP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -35,16 +35,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(FAR void *regs)
{
FAR uint32_t *ptr = regs;
return ptr[REG_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -57,6 +57,13 @@ uintptr_t up_getsp(void);
#define up_getusrpc(regs) \
(((FAR chipreg_t *)((regs) ? (regs) : up_current_regs()))[XCPT_PC])
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
#define up_getusrsp(regs) \
((uintptr_t)((FAR chipreg_t*)(regs))[XCPT_SP])
#undef EXTERN
#ifdef __cplusplus
}

View file

@ -38,16 +38,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(FAR void *regs)
{
FAR chipreg_t *ptr = regs;
return ptr[XCPT_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -38,16 +38,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(FAR void *regs)
{
FAR chipreg_t *ptr = regs;
return ptr[XCPT_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -57,16 +57,6 @@ static inline void z8_dumpstate(chipreg_t sp, chipreg_t pc, uint8_t irqctl,
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(FAR void *regs)
{
FAR chipreg_t *ptr = regs;
return ptr[XCPT_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -38,16 +38,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(FAR void *regs)
{
FAR chipreg_t *ptr = regs;
return ptr[XCPT_SP];
}
/****************************************************************************
* Name: up_dump_register
****************************************************************************/

View file

@ -2112,7 +2112,9 @@ int up_timer_tick_start(clock_t ticks);
*
****************************************************************************/
uintptr_t up_getusrsp(FAR void *regs);
/* static inline_function uintptr_t up_getusrsp(void *regs);
* The actual implementation should be provided in irq.h per arch.
*/
/****************************************************************************
* TLS support