arch/stack: rename do_stack_check with arch prefix

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2022-07-25 08:32:38 +00:00 committed by Xiang Xiao
parent 79597d0caf
commit 5c8fd46126
18 changed files with 97 additions and 94 deletions

View File

@ -43,7 +43,11 @@
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm_stack_check
*
* Description:
* Determine (approximately) how much stack has been used by searching the
@ -59,7 +63,7 @@
*
****************************************************************************/
static size_t do_stackcheck(void *stackbase, size_t nbytes)
size_t arm_stack_check(void *stackbase, size_t nbytes)
{
uintptr_t start;
uintptr_t end;
@ -134,10 +138,6 @@ static size_t do_stackcheck(void *stackbase, size_t nbytes)
return mark << 2;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm_stack_color
*
@ -199,7 +199,7 @@ void arm_stack_color(void *stackbase, size_t nbytes)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck(tcb->stack_base_ptr, tcb->adj_stack_size);
return arm_stack_check(tcb->stack_base_ptr, tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@ -221,10 +221,10 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(void)
{
#ifdef CONFIG_SMP
return do_stackcheck((void *)arm_intstack_alloc(),
return arm_stack_check((void *)arm_intstack_alloc(),
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#else
return do_stackcheck((void *)&g_intstackalloc,
return arm_stack_check((void *)&g_intstackalloc,
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#endif
}

View File

@ -440,6 +440,7 @@ void arm_usbuninitialize(void);
/* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION
size_t arm_stack_check(void *stackbase, size_t nbytes);
void arm_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -46,14 +46,16 @@
* Private Function Prototypes
****************************************************************************/
static size_t do_stackcheck(void *stackbase, size_t nbytes);
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm64_stack_check
*
* Description:
* Determine (approximately) how much stack has been used by searching the
@ -69,7 +71,7 @@ static size_t do_stackcheck(void *stackbase, size_t nbytes);
*
****************************************************************************/
static size_t do_stackcheck(void *stackbase, size_t nbytes)
size_t arm64_stack_check(void *stackbase, size_t nbytes)
{
uintptr_t start;
uintptr_t end;
@ -144,10 +146,6 @@ static size_t do_stackcheck(void *stackbase, size_t nbytes)
return mark << 2;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm64_stack_color
*
@ -200,7 +198,7 @@ void arm64_stack_color(void *stackbase, size_t nbytes)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck(tcb->stack_base_ptr, tcb->adj_stack_size);
return arm64_stack_check(tcb->stack_base_ptr, tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@ -222,10 +220,10 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(void)
{
#ifdef CONFIG_SMP
return do_stackcheck((void *)arm64_intstack_alloc(),
return arm64_stack_check((void *)arm64_intstack_alloc(),
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#else
return do_stackcheck((void *)&g_interrupt_stack,
return arm64_stack_check((void *)&g_interrupt_stack,
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#endif
}

View File

@ -352,6 +352,7 @@ void arm64_usbuninitialize(void);
/* Debug */
#ifdef CONFIG_STACK_COLORATION
size_t arm64_stack_check(void *stackbase, size_t nbytes);
void arm64_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -45,10 +45,12 @@
* Private Functions
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Name: avr_stack_check
*
* Description:
* Determine (approximately) how much stack has been used be searching the
@ -64,7 +66,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size);
*
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t avr_stack_check(uintptr_t alloc, size_t size)
{
FAR uint8_t *ptr;
size_t mark;
@ -124,10 +126,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_check_stack and friends
*
@ -146,7 +144,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t up_check_tcbstack(FAR struct tcb_s *tcb)
{
return do_stackcheck((uintptr_t)tcb->stack_base_ptr, tcb->adj_stack_size);
return avr_stack_check((uintptr_t)tcb->stack_base_ptr,
tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(FAR struct tcb_s *tcb)
@ -168,7 +167,7 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(void)
{
uintptr_t start = (uintptr_t)g_intstackalloc;
return do_stackcheck(start, CONFIG_ARCH_INTERRUPTSTACK & ~3);
return avr_stack_check(start, CONFIG_ARCH_INTERRUPTSTACK & ~3);
}
size_t up_check_intstack_remain(void)

View File

@ -172,5 +172,9 @@ void up_usbuninitialize(void);
# define up_usbuninitialize()
#endif
#ifdef CONFIG_STACK_COLORATION
size_t avr_stack_check(uintptr_t alloc, size_t size);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_AVR_SRC_COMMON_UP_INTERNAL_H */

View File

@ -38,10 +38,12 @@
* Private Function Prototypes
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Name: ceva_stack_check
*
* Description:
* Determine (approximately) how much stack has been used be searching the
@ -57,7 +59,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size);
*
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t ceva_stack_check(uintptr_t alloc, size_t size)
{
uint32_t *ptr;
size_t nwords;
@ -119,10 +121,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark * sizeof(uint32_t);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_check_stack and friends
*
@ -141,7 +139,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck((uintptr_t)tcb->stack_alloc_ptr,
return ceva_stack_check((uintptr_t)tcb->stack_alloc_ptr,
tcb->adj_stack_size);
}
@ -162,7 +160,7 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(void)
{
return do_stackcheck((uintptr_t)&g_intstackalloc,
return ceva_stack_check((uintptr_t)&g_intstackalloc,
&g_intstackbase - &g_intstackalloc);
}

View File

@ -311,6 +311,7 @@ void up_usbuninitialize(void);
#endif
#ifdef CONFIG_STACK_COLORATION
size_t ceva_stack_check(uintptr_t alloc, size_t size);
void up_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -42,14 +42,16 @@
* Private Function Prototypes
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Private Function
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: or1k_stack_check
*
* Description:
* Determine (approximately) how much stack has been used be searching the
@ -65,7 +67,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size);
*
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t or1k_stack_check(uintptr_t alloc, size_t size)
{
uintptr_t start;
uintptr_t end;
@ -95,10 +97,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark << 2;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_check_stack and friends
*
@ -117,7 +115,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck((uintptr_t)tcb->stack_base_ptr, tcb->adj_stack_size);
return or1k_stack_check((uintptr_t)tcb->stack_base_ptr,
tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@ -138,7 +137,7 @@ ssize_t up_check_stack_remain(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void)
{
return do_stackcheck((uintptr_t)&g_intstackalloc,
return or1k_stack_check((uintptr_t)&g_intstackalloc,
(CONFIG_ARCH_INTERRUPTSTACK & ~3));
}

View File

@ -329,6 +329,7 @@ void up_usbuninitialize(void);
/* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION
size_t or1k_stack_check(uintptr_t alloc, size_t size);
void up_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -41,10 +41,12 @@
* Private Function Prototypes
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Name: riscv_stack_check
*
* Description:
* Determine (approximately) how much stack has been used be searching the
@ -60,7 +62,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size);
*
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t riscv_stack_check(uintptr_t alloc, size_t size)
{
uintptr_t start;
uintptr_t end;
@ -135,10 +137,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark << 2;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_check_stack and friends
*
@ -157,7 +155,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck((uintptr_t)tcb->stack_base_ptr, tcb->adj_stack_size);
return riscv_stack_check((uintptr_t)tcb->stack_base_ptr,
tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@ -178,7 +177,7 @@ ssize_t up_check_stack_remain(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 15
size_t up_check_intstack(void)
{
return do_stackcheck((uintptr_t)&g_intstackalloc,
return riscv_stack_check((uintptr_t)&g_intstackalloc,
(CONFIG_ARCH_INTERRUPTSTACK & ~15));
}

View File

@ -267,6 +267,7 @@ int riscv_misaligned(int irq, void *context, void *arg);
/* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION
size_t riscv_stack_check(uintptr_t alloc, size_t size);
void riscv_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -40,10 +40,12 @@
* Private Function Prototypes
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Name: sim_stack_check
*
* Description:
* Determine (approximately) how much stack has been used be searching the
@ -59,7 +61,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size);
*
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t sim_stack_check(void *alloc, size_t size)
{
uintptr_t start;
uintptr_t end;
@ -73,8 +75,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
/* Get aligned addresses of the top and bottom of the stack */
start = (alloc + 3) & ~3;
end = (alloc + size) & ~3;
start = ((uintptr_t)alloc + 3) & ~3;
end = ((uintptr_t)alloc + size) & ~3;
/* Get the adjusted size based on the top and bottom of the stack */
@ -134,10 +136,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark << 2;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_check_stack and friends
*
@ -156,7 +154,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck((uintptr_t)tcb->stack_base_ptr, tcb->adj_stack_size);
return sim_stack_check((void *)(uintptr_t)tcb->stack_base_ptr,
tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)

View File

@ -361,6 +361,7 @@ int sim_spi_uninitialize(struct spi_dev_s *dev);
/* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION
size_t sim_stack_check(void *alloc, size_t size);
void up_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -44,7 +44,11 @@
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: sparc_stack_check
*
* Description:
* Determine (approximately) how much stack has been used by searching the
@ -60,7 +64,7 @@
*
****************************************************************************/
static size_t do_stackcheck(void *stackbase, size_t nbytes)
size_t sparc_stack_check(void *stackbase, size_t nbytes)
{
uintptr_t start;
uintptr_t end;
@ -135,10 +139,6 @@ static size_t do_stackcheck(void *stackbase, size_t nbytes)
return mark << 2;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_stack_color
*
@ -200,7 +200,7 @@ void up_stack_color(void *stackbase, size_t nbytes)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck(tcb->stack_base_ptr, tcb->adj_stack_size);
return sparc_stack_check(tcb->stack_base_ptr, tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@ -221,7 +221,7 @@ ssize_t up_check_stack_remain(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void)
{
return do_stackcheck((uintptr_t)&g_intstackalloc,
return sparc_stack_check((uintptr_t)&g_intstackalloc,
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
}

View File

@ -259,6 +259,7 @@ void up_usbuninitialize(void);
/* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION
size_t sparc_stack_check(void *stackbase, size_t nbytes);
void up_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -346,6 +346,7 @@ int xtensa_swint(int irq, void *context, void *arg);
/* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION
size_t xtensa_stack_check(uintptr_t alloc, size_t size);
void xtensa_stack_color(void *stackbase, size_t nbytes);
#endif

View File

@ -42,10 +42,12 @@
* Private Function Prototypes
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: do_stackcheck
* Name: xtensa_stack_check
*
* Description:
* Determine (approximately) how much stack has been used be searching the
@ -61,7 +63,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size);
*
****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t xtensa_stack_check(uintptr_t alloc, size_t size)
{
uintptr_t start;
uintptr_t end;
@ -138,10 +140,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark << 2;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_check_stack and friends
*
@ -160,7 +158,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t up_check_tcbstack(struct tcb_s *tcb)
{
return do_stackcheck((uintptr_t)tcb->stack_base_ptr, tcb->adj_stack_size);
return xtensa_stack_check((uintptr_t)tcb->stack_base_ptr,
tcb->adj_stack_size);
}
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@ -182,9 +181,9 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(void)
{
#ifdef CONFIG_SMP
return do_stackcheck(xtensa_intstack_alloc(), INTSTACK_SIZE);
return xtensa_stack_check(xtensa_intstack_alloc(), INTSTACK_SIZE);
#else
return do_stackcheck((uintptr_t)&g_intstackalloc, INTSTACK_SIZE);
return xtensa_stack_check((uintptr_t)&g_intstackalloc, INTSTACK_SIZE);
#endif
}