You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/07/27 12:48:41 UTC

[incubator-nuttx] 02/06: arch/stack: rename do_stack_check with arch prefix

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 5c8fd461261f6e4a792fff9320ea199bc262564e
Author: Jiuzhu Dong <do...@xiaomi.com>
AuthorDate: Mon Jul 25 08:32:38 2022 +0000

    arch/stack: rename do_stack_check with arch prefix
    
    Signed-off-by: Jiuzhu Dong <do...@xiaomi.com>
---
 arch/arm/src/common/arm_checkstack.c       | 22 +++++++++++-----------
 arch/arm/src/common/arm_internal.h         |  1 +
 arch/arm64/src/common/arm64_checkstack.c   | 24 +++++++++++-------------
 arch/arm64/src/common/arm64_internal.h     |  1 +
 arch/avr/src/avr/up_checkstack.c           | 17 ++++++++---------
 arch/avr/src/common/up_internal.h          |  4 ++++
 arch/ceva/src/common/up_checkstack.c       | 20 +++++++++-----------
 arch/ceva/src/common/up_internal.h         |  1 +
 arch/or1k/src/common/up_checkstack.c       | 21 ++++++++++-----------
 arch/or1k/src/common/up_internal.h         |  1 +
 arch/risc-v/src/common/riscv_checkstack.c  | 19 +++++++++----------
 arch/risc-v/src/common/riscv_internal.h    |  1 +
 arch/sim/src/sim/up_checkstack.c           | 19 +++++++++----------
 arch/sim/src/sim/up_internal.h             |  1 +
 arch/sparc/src/common/up_checkstack.c      | 18 +++++++++---------
 arch/sparc/src/common/up_internal.h        |  1 +
 arch/xtensa/src/common/xtensa.h            |  1 +
 arch/xtensa/src/common/xtensa_checkstack.c | 19 +++++++++----------
 18 files changed, 97 insertions(+), 94 deletions(-)

diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c
index 5f69d62e91..1a54ae8853 100644
--- a/arch/arm/src/common/arm_checkstack.c
+++ b/arch/arm/src/common/arm_checkstack.c
@@ -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,11 +221,11 @@ ssize_t up_check_stack_remain(void)
 size_t up_check_intstack(void)
 {
 #ifdef CONFIG_SMP
-  return do_stackcheck((void *)arm_intstack_alloc(),
-                        STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
+  return arm_stack_check((void *)arm_intstack_alloc(),
+                         STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
 #else
-  return do_stackcheck((void *)&g_intstackalloc,
-                        STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
+  return arm_stack_check((void *)&g_intstackalloc,
+                         STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
 #endif
 }
 
diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h
index fca29ff51a..02c0b53852 100644
--- a/arch/arm/src/common/arm_internal.h
+++ b/arch/arm/src/common/arm_internal.h
@@ -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
 
diff --git a/arch/arm64/src/common/arm64_checkstack.c b/arch/arm64/src/common/arm64_checkstack.c
index 006568702a..6940b5644d 100644
--- a/arch/arm64/src/common/arm64_checkstack.c
+++ b/arch/arm64/src/common/arm64_checkstack.c
@@ -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,11 +220,11 @@ ssize_t up_check_stack_remain(void)
 size_t up_check_intstack(void)
 {
 #ifdef CONFIG_SMP
-  return do_stackcheck((void *)arm64_intstack_alloc(),
-                        STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
+  return arm64_stack_check((void *)arm64_intstack_alloc(),
+                           STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
 #else
-  return do_stackcheck((void *)&g_interrupt_stack,
-                        STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
+  return arm64_stack_check((void *)&g_interrupt_stack,
+                           STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
 #endif
 }
 
diff --git a/arch/arm64/src/common/arm64_internal.h b/arch/arm64/src/common/arm64_internal.h
index d92523b821..ca8f6c653e 100644
--- a/arch/arm64/src/common/arm64_internal.h
+++ b/arch/arm64/src/common/arm64_internal.h
@@ -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
 
diff --git a/arch/avr/src/avr/up_checkstack.c b/arch/avr/src/avr/up_checkstack.c
index 256b153e72..b54421773b 100644
--- a/arch/avr/src/avr/up_checkstack.c
+++ b/arch/avr/src/avr/up_checkstack.c
@@ -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)
diff --git a/arch/avr/src/common/up_internal.h b/arch/avr/src/common/up_internal.h
index 14dc78ec33..2d9e4cdc19 100644
--- a/arch/avr/src/common/up_internal.h
+++ b/arch/avr/src/common/up_internal.h
@@ -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 */
diff --git a/arch/ceva/src/common/up_checkstack.c b/arch/ceva/src/common/up_checkstack.c
index 8b70574ca6..f7195913de 100644
--- a/arch/ceva/src/common/up_checkstack.c
+++ b/arch/ceva/src/common/up_checkstack.c
@@ -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,8 +139,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_alloc_ptr,
-                       tcb->adj_stack_size);
+  return ceva_stack_check((uintptr_t)tcb->stack_alloc_ptr,
+                          tcb->adj_stack_size);
 }
 
 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)
 {
-  return do_stackcheck((uintptr_t)&g_intstackalloc,
-                       &g_intstackbase - &g_intstackalloc);
+  return ceva_stack_check((uintptr_t)&g_intstackalloc,
+                          &g_intstackbase - &g_intstackalloc);
 }
 
 size_t up_check_intstack_remain(void)
diff --git a/arch/ceva/src/common/up_internal.h b/arch/ceva/src/common/up_internal.h
index 695f3b4a59..c8be910d69 100644
--- a/arch/ceva/src/common/up_internal.h
+++ b/arch/ceva/src/common/up_internal.h
@@ -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
 
diff --git a/arch/or1k/src/common/up_checkstack.c b/arch/or1k/src/common/up_checkstack.c
index 8b06ee38a9..c564709b2d 100644
--- a/arch/or1k/src/common/up_checkstack.c
+++ b/arch/or1k/src/common/up_checkstack.c
@@ -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,8 +137,8 @@ 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,
-                       (CONFIG_ARCH_INTERRUPTSTACK & ~3));
+  return or1k_stack_check((uintptr_t)&g_intstackalloc,
+                          (CONFIG_ARCH_INTERRUPTSTACK & ~3));
 }
 
 size_t up_check_intstack_remain(void)
diff --git a/arch/or1k/src/common/up_internal.h b/arch/or1k/src/common/up_internal.h
index f7e7600219..1ad2b140ca 100644
--- a/arch/or1k/src/common/up_internal.h
+++ b/arch/or1k/src/common/up_internal.h
@@ -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
 
diff --git a/arch/risc-v/src/common/riscv_checkstack.c b/arch/risc-v/src/common/riscv_checkstack.c
index b5d34440cd..c3160c9a9a 100644
--- a/arch/risc-v/src/common/riscv_checkstack.c
+++ b/arch/risc-v/src/common/riscv_checkstack.c
@@ -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,8 +177,8 @@ 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,
-                       (CONFIG_ARCH_INTERRUPTSTACK & ~15));
+  return riscv_stack_check((uintptr_t)&g_intstackalloc,
+                           (CONFIG_ARCH_INTERRUPTSTACK & ~15));
 }
 
 size_t up_check_intstack_remain(void)
diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h
index 472967db10..861c412cd2 100644
--- a/arch/risc-v/src/common/riscv_internal.h
+++ b/arch/risc-v/src/common/riscv_internal.h
@@ -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
 
diff --git a/arch/sim/src/sim/up_checkstack.c b/arch/sim/src/sim/up_checkstack.c
index 0e26086e0a..a933a5e81f 100644
--- a/arch/sim/src/sim/up_checkstack.c
+++ b/arch/sim/src/sim/up_checkstack.c
@@ -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)
diff --git a/arch/sim/src/sim/up_internal.h b/arch/sim/src/sim/up_internal.h
index 1c1d21af17..86acc24e39 100644
--- a/arch/sim/src/sim/up_internal.h
+++ b/arch/sim/src/sim/up_internal.h
@@ -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
 
diff --git a/arch/sparc/src/common/up_checkstack.c b/arch/sparc/src/common/up_checkstack.c
index ee56466510..27d495979c 100644
--- a/arch/sparc/src/common/up_checkstack.c
+++ b/arch/sparc/src/common/up_checkstack.c
@@ -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,8 +221,8 @@ 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,
-                       STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
+  return sparc_stack_check((uintptr_t)&g_intstackalloc,
+                           STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
 }
 
 size_t up_check_intstack_remain(void)
diff --git a/arch/sparc/src/common/up_internal.h b/arch/sparc/src/common/up_internal.h
index 00f88847da..e88a9a64ff 100644
--- a/arch/sparc/src/common/up_internal.h
+++ b/arch/sparc/src/common/up_internal.h
@@ -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
 
diff --git a/arch/xtensa/src/common/xtensa.h b/arch/xtensa/src/common/xtensa.h
index 4b7a02d4a0..528fe81d4f 100644
--- a/arch/xtensa/src/common/xtensa.h
+++ b/arch/xtensa/src/common/xtensa.h
@@ -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
 
diff --git a/arch/xtensa/src/common/xtensa_checkstack.c b/arch/xtensa/src/common/xtensa_checkstack.c
index 3a7e1881db..5e543e8553 100644
--- a/arch/xtensa/src/common/xtensa_checkstack.c
+++ b/arch/xtensa/src/common/xtensa_checkstack.c
@@ -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
 }