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
+11 -11
View File
@@ -43,7 +43,11 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used by searching the * 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 start;
uintptr_t end; uintptr_t end;
@@ -134,10 +138,6 @@ static size_t do_stackcheck(void *stackbase, size_t nbytes)
return mark << 2; return mark << 2;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arm_stack_color * 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) 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) ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@@ -221,11 +221,11 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(void) size_t up_check_intstack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
return do_stackcheck((void *)arm_intstack_alloc(), return arm_stack_check((void *)arm_intstack_alloc(),
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#else #else
return do_stackcheck((void *)&g_intstackalloc, return arm_stack_check((void *)&g_intstackalloc,
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#endif #endif
} }
+1
View File
@@ -440,6 +440,7 @@ void arm_usbuninitialize(void);
/* Debug ********************************************************************/ /* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t arm_stack_check(void *stackbase, size_t nbytes);
void arm_stack_color(void *stackbase, size_t nbytes); void arm_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+11 -13
View File
@@ -46,14 +46,16 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static size_t do_stackcheck(void *stackbase, size_t nbytes);
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm64_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used by searching the * 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 start;
uintptr_t end; uintptr_t end;
@@ -144,10 +146,6 @@ static size_t do_stackcheck(void *stackbase, size_t nbytes)
return mark << 2; return mark << 2;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arm64_stack_color * 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) 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) ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@@ -222,11 +220,11 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(void) size_t up_check_intstack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
return do_stackcheck((void *)arm64_intstack_alloc(), return arm64_stack_check((void *)arm64_intstack_alloc(),
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#else #else
return do_stackcheck((void *)&g_interrupt_stack, return arm64_stack_check((void *)&g_interrupt_stack,
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
#endif #endif
} }
+1
View File
@@ -352,6 +352,7 @@ void arm64_usbuninitialize(void);
/* Debug */ /* Debug */
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t arm64_stack_check(void *stackbase, size_t nbytes);
void arm64_stack_color(void *stackbase, size_t nbytes); void arm64_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+8 -9
View File
@@ -45,10 +45,12 @@
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size); /****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Name: avr_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used be searching the * 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; FAR uint8_t *ptr;
size_t mark; size_t mark;
@@ -124,10 +126,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark; return mark;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_check_stack and friends * 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) 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) 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) size_t up_check_intstack(void)
{ {
uintptr_t start = (uintptr_t)g_intstackalloc; 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) size_t up_check_intstack_remain(void)
+4
View File
@@ -172,5 +172,9 @@ void up_usbuninitialize(void);
# define up_usbuninitialize() # define up_usbuninitialize()
#endif #endif
#ifdef CONFIG_STACK_COLORATION
size_t avr_stack_check(uintptr_t alloc, size_t size);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __ARCH_AVR_SRC_COMMON_UP_INTERNAL_H */ #endif /* __ARCH_AVR_SRC_COMMON_UP_INTERNAL_H */
+9 -11
View File
@@ -38,10 +38,12 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size); /****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Name: ceva_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used be searching the * 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; uint32_t *ptr;
size_t nwords; size_t nwords;
@@ -119,10 +121,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark * sizeof(uint32_t); return mark * sizeof(uint32_t);
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_check_stack and friends * Name: up_check_stack and friends
* *
@@ -141,8 +139,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
size_t up_check_tcbstack(struct tcb_s *tcb) 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); tcb->adj_stack_size);
} }
ssize_t up_check_tcbstack_remain(struct tcb_s *tcb) ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@@ -162,8 +160,8 @@ ssize_t up_check_stack_remain(void)
size_t up_check_intstack(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); &g_intstackbase - &g_intstackalloc);
} }
size_t up_check_intstack_remain(void) size_t up_check_intstack_remain(void)
+1
View File
@@ -311,6 +311,7 @@ void up_usbuninitialize(void);
#endif #endif
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t ceva_stack_check(uintptr_t alloc, size_t size);
void up_stack_color(void *stackbase, size_t nbytes); void up_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+10 -11
View File
@@ -42,14 +42,16 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size);
/**************************************************************************** /****************************************************************************
* Private Function * Private Function
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Public Functions
****************************************************************************/
/****************************************************************************
* Name: or1k_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used be searching the * 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 start;
uintptr_t end; uintptr_t end;
@@ -95,10 +97,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark << 2; return mark << 2;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_check_stack and friends * 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) 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) ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@@ -138,8 +137,8 @@ ssize_t up_check_stack_remain(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void) 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)); (CONFIG_ARCH_INTERRUPTSTACK & ~3));
} }
size_t up_check_intstack_remain(void) size_t up_check_intstack_remain(void)
+1
View File
@@ -329,6 +329,7 @@ void up_usbuninitialize(void);
/* Debug ********************************************************************/ /* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t or1k_stack_check(uintptr_t alloc, size_t size);
void up_stack_color(void *stackbase, size_t nbytes); void up_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+9 -10
View File
@@ -41,10 +41,12 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size); /****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Name: riscv_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used be searching the * 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 start;
uintptr_t end; uintptr_t end;
@@ -135,10 +137,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark << 2; return mark << 2;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_check_stack and friends * 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) 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) ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@@ -178,8 +177,8 @@ ssize_t up_check_stack_remain(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 15 #if CONFIG_ARCH_INTERRUPTSTACK > 15
size_t up_check_intstack(void) 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)); (CONFIG_ARCH_INTERRUPTSTACK & ~15));
} }
size_t up_check_intstack_remain(void) size_t up_check_intstack_remain(void)
+1
View File
@@ -267,6 +267,7 @@ int riscv_misaligned(int irq, void *context, void *arg);
/* Debug ********************************************************************/ /* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t riscv_stack_check(uintptr_t alloc, size_t size);
void riscv_stack_color(void *stackbase, size_t nbytes); void riscv_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+9 -10
View File
@@ -40,10 +40,12 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size); /****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Name: sim_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used be searching the * 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 start;
uintptr_t end; 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 */ /* Get aligned addresses of the top and bottom of the stack */
start = (alloc + 3) & ~3; start = ((uintptr_t)alloc + 3) & ~3;
end = (alloc + size) & ~3; end = ((uintptr_t)alloc + size) & ~3;
/* Get the adjusted size based on the top and bottom of the stack */ /* 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; return mark << 2;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_check_stack and friends * 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) 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) ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
+1
View File
@@ -361,6 +361,7 @@ int sim_spi_uninitialize(struct spi_dev_s *dev);
/* Debug ********************************************************************/ /* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t sim_stack_check(void *alloc, size_t size);
void up_stack_color(void *stackbase, size_t nbytes); void up_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+9 -9
View File
@@ -44,7 +44,11 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Public Functions
****************************************************************************/
/****************************************************************************
* Name: sparc_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used by searching the * 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 start;
uintptr_t end; uintptr_t end;
@@ -135,10 +139,6 @@ static size_t do_stackcheck(void *stackbase, size_t nbytes)
return mark << 2; return mark << 2;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_stack_color * 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) 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) ssize_t up_check_tcbstack_remain(struct tcb_s *tcb)
@@ -221,8 +221,8 @@ ssize_t up_check_stack_remain(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void) 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)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
} }
size_t up_check_intstack_remain(void) size_t up_check_intstack_remain(void)
+1
View File
@@ -259,6 +259,7 @@ void up_usbuninitialize(void);
/* Debug ********************************************************************/ /* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t sparc_stack_check(void *stackbase, size_t nbytes);
void up_stack_color(void *stackbase, size_t nbytes); void up_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+1
View File
@@ -346,6 +346,7 @@ int xtensa_swint(int irq, void *context, void *arg);
/* Debug ********************************************************************/ /* Debug ********************************************************************/
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
size_t xtensa_stack_check(uintptr_t alloc, size_t size);
void xtensa_stack_color(void *stackbase, size_t nbytes); void xtensa_stack_color(void *stackbase, size_t nbytes);
#endif #endif
+9 -10
View File
@@ -42,10 +42,12 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static size_t do_stackcheck(uintptr_t alloc, size_t size); /****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: do_stackcheck * Name: xtensa_stack_check
* *
* Description: * Description:
* Determine (approximately) how much stack has been used be searching the * 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 start;
uintptr_t end; uintptr_t end;
@@ -138,10 +140,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
return mark << 2; return mark << 2;
} }
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_check_stack and friends * 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) 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) 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) size_t up_check_intstack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
return do_stackcheck(xtensa_intstack_alloc(), INTSTACK_SIZE); return xtensa_stack_check(xtensa_intstack_alloc(), INTSTACK_SIZE);
#else #else
return do_stackcheck((uintptr_t)&g_intstackalloc, INTSTACK_SIZE); return xtensa_stack_check((uintptr_t)&g_intstackalloc, INTSTACK_SIZE);
#endif #endif
} }