xiaoxiang781216 commented on code in PR #7875:
URL: https://github.com/apache/nuttx/pull/7875#discussion_r1049242442


##########
include/nuttx/arch.h:
##########
@@ -1776,6 +1776,21 @@ int up_timer_tick_start(clock_t ticks);
  * The actual implementation may be a MACRO or an inline function.
  */
 
+/****************************************************************************
+ * Name: up_getusrsp
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   User stack pointer.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
+FAR uintptr_t up_getusrsp(void);

Review Comment:
   remove FAR



##########
include/nuttx/arch.h:
##########
@@ -2288,6 +2303,10 @@ size_t  up_check_intstack_remain(void);
 #endif
 #endif
 
+#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
+FAR uintptr_t up_get_intstackbase(void);

Review Comment:
   remove FAR



##########
arch/xtensa/src/common/xtensa_assert.c:
##########
@@ -61,8 +52,31 @@ static void xtensa_assert(void)
 
 void up_assert(const char *filename, int lineno)
 {
+  struct tcb_s *rtcb = running_task();
+
   board_autoled_on(LED_ASSERTION);
-  xtensa_assert();
+
+#ifdef CONFIG_SMP
+  /* Show the CPU number */
+
+  _alert("CPU%d:\n", up_cpu_index());

Review Comment:
   move to common code or remove



##########
include/nuttx/arch.h:
##########
@@ -1776,6 +1776,21 @@ int up_timer_tick_start(clock_t ticks);
  * The actual implementation may be a MACRO or an inline function.
  */
 
+/****************************************************************************
+ * Name: up_getusrsp
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   User stack pointer.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   usr sp doesn't depend on the interrupt stack



##########
arch/x86_64/src/intel64/intel64_regdump.c:
##########
@@ -34,6 +34,17 @@
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return g_intstacktop;

Review Comment:
   the implementation is wrong?



##########
arch/z80/src/common/z80_assert.c:
##########
@@ -37,5 +37,4 @@
 void up_assert(const char *filename, int lineno)
 {
   Z80_REGISTER_DUMP();
-  z80_stackdump();

Review Comment:
   where is up_getusrsp implemented



##########
arch/sparc/src/sparc_v8/Make.defs:
##########
@@ -28,9 +28,5 @@ CMN_CSRCS += sparc_v8_initialstate.c sparc_v8_irq.c
 CMN_CSRCS += sparc_v8_releasepending.c sparc_v8_schedulesigaction.c
 CMN_CSRCS += sparc_v8_sigdeliver.c sparc_v8_swint1.c sparc_v8_systemreset.c
 CMN_CSRCS += sparc_v8_switchcontext.c
+CMN_CSRCS += sparc_v8_registerdump.c

Review Comment:
   merge to previous line



##########
arch/sparc/src/sparc_v8/sparc_v8_registerdump.c:
##########
@@ -23,68 +23,59 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
-#include <nuttx/syslog/syslog.h>
 
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
 #include <debug.h>
 
-#include "chip.h"
-#include "sched/sched.h"
-#include "z16_internal.h"
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <arch/board/board.h>
 
-#ifdef CONFIG_ARCH_STACKDUMP
+#include "sched/sched.h"
+#include "sparc_internal.h"
 
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_getsp
+ * Name: up_getusrsp
  ****************************************************************************/
 
-/* To be provided */
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/sparc/src/common/Make.defs:
##########
@@ -26,6 +26,7 @@ CMN_CSRCS += sparc_lowputs.c sparc_mdelay.c
 CMN_CSRCS += sparc_modifyreg8.c sparc_modifyreg16.c sparc_modifyreg32.c
 CMN_CSRCS += sparc_nputs.c sparc_releasestack.c
 CMN_CSRCS += sparc_stackframe.c sparc_udelay.c sparc_usestack.c
+CMN_CSRCS += sparc_getintstack.c

Review Comment:
   merge to line 27



##########
arch/sim/src/sim/sim_assert.c:
##########
@@ -75,12 +75,6 @@ void up_assert(const char *filename, int lineno)
 {
   struct tcb_s *rtcb = running_task();
 
-  /* Show back trace */
-
-#ifdef CONFIG_SCHED_BACKTRACE
-  sched_dumpstack(rtcb->pid);
-#endif
-
   /* Flush any buffered SYSLOG data (from the above) */
 
   syslog_flush();

Review Comment:
   remove



##########
arch/z16/src/z16f/Make.defs:
##########
@@ -22,7 +22,7 @@ HEAD_SSRC = z16f_head.S
 
 CMN_CSRCS  = z16_allocateheap.c z16_initialize.c z16_schedulesigaction.c
 CMN_CSRCS += z16_assert.c z16_initialstate.c z16_sigdeliver.c
-CMN_CSRCS += z16_stackdump.c z16_copystate.c

Review Comment:
   should we remove z16_stackdump.c



##########
arch/xtensa/src/common/xtensa_checkstack.c:
##########
@@ -178,13 +178,10 @@ ssize_t up_check_stack_remain(void)
 }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 15
+

Review Comment:
   revert, don't need change



##########
arch/renesas/src/sh1/sh1_registerdump.c:
##########
@@ -0,0 +1,72 @@
+/****************************************************************************
+ * arch/renesas/src/sh1/sh1_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+
+#include "renesas_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return g_intstacktop;

Review Comment:
   the implementation is wrong



##########
arch/z80/src/ez80/Make.defs:
##########
@@ -25,10 +25,6 @@ CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
 CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c
 CMN_CSRCS += z80_nputs.c
 
-ifeq ($(CONFIG_ARCH_STACKDUMP),y)
-CMN_CSRCS += z80_stackdump.c

Review Comment:
   should we remove z80_stackdump.c and z80_stackdump prototype in 
z80_internal.h



##########
arch/x86_64/src/intel64/intel64_regdump.c:
##########
@@ -34,6 +34,17 @@
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/renesas/src/rx65n/rx65n_registerdump.c:
##########
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * arch/renesas/src/rx65n/rx65n_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <inttypes.h>
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+
+#include "renesas_internal.h"
+#include "chip.h"
+#include "arch/rx65n/irq.h"
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/xtensa/src/common/xtensa_getintstack.c:
##########
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * arch/xtensa/src/common/xtensa_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "xtensa.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+

Review Comment:
   remove blank line



##########
arch/z16/src/common/z16_registerdump.c:
##########
@@ -48,28 +37,19 @@ static chipreg_t s_last_regs[XCPTCONTEXT_REGS];
  * Name: z16_registerdump
  ****************************************************************************/
 
-void z16_registerdump(void)
+void z16_registerdump(FAR volatile uint32_t *regs)

Review Comment:
   should we implement up_getusrsp here



##########
arch/misoc/src/minerva/minerva_registerdump.c:
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * arch/misoc/src/minerva/minerva_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "minerva.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return g_intstacktop;

Review Comment:
   wrong implementation?



##########
arch/xtensa/src/common/xtensa_getintstack.c:
##########
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * arch/xtensa/src/common/xtensa_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "xtensa.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+#ifdef CONFIG_SMP
+  return (uintptr_t)xtensa_intstack_alloc();
+#else
+  return (uintptr_t)g_intstackalloc;
+#endif
+}
+

Review Comment:
   remove the blank line



##########
arch/x86_64/src/common/x86_64_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/x86_64/src/common/x86_64_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "x86_64_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   add blank line after #endif, and remove blank line after #if and before 
#endif



##########
arch/or1k/src/common/or1k_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/or1k/src/common/or1k_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "or1k_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+

Review Comment:
   remove line 40 and 45



##########
arch/xtensa/src/common/xtensa_registerdump.c:
##########
@@ -0,0 +1,89 @@
+/****************************************************************************
+ * arch/xtensa/src/common/xtensa_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/tls.h>
+#include <nuttx/arch.h>
+#include <nuttx/syslog/syslog.h>
+
+#include <arch/xtensa/xtensa_corebits.h>
+#include <arch/board/board.h>
+#include <arch/chip/core-isa.h>
+
+#include "sched/sched.h"
+#include "xtensa.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check of CONFIG_ARCH_INTERRUPTSTACK



##########
arch/x86/src/i486/i486_regdump.c:
##########
@@ -33,6 +33,17 @@
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return g_intstacktop;

Review Comment:
   the implementation is wrong?



##########
arch/x86_64/src/common/x86_64_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/x86_64/src/common/x86_64_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "x86_64_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)

Review Comment:
   where is up_getusrsp implemented?



##########
arch/x86/src/common/x86_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/x86/src/common/x86_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "x86_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   same comment as x86_64_getintstack.c



##########
arch/misoc/src/lm32/lm32_registerdump.c:
##########
@@ -0,0 +1,94 @@
+/****************************************************************************
+ * arch/misoc/src/lm32/lm32_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/syslog/syslog.h>
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "lm32.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return g_intstacktop;

Review Comment:
   wrong



##########
arch/mips/src/mips32/mips_registerdump.c:
##########
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * arch/mips/src/mips32/mips_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/syslog/syslog.h>
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "mips_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/misoc/src/minerva/minerva_registerdump.c:
##########
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * arch/misoc/src/minerva/minerva_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "minerva.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/misoc/src/lm32/lm32_registerdump.c:
##########
@@ -0,0 +1,94 @@
+/****************************************************************************
+ * arch/misoc/src/lm32/lm32_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/syslog/syslog.h>
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "lm32.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/hc/src/m9s12/m9s12_registerdump.c:
##########
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * arch/hc/src/m9s12/m9s12_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "hc_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return g_intstacktop;

Review Comment:
   wrong



##########
arch/mips/src/mips32/mips_registerdump.c:
##########
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * arch/mips/src/mips32/mips_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/syslog/syslog.h>
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "mips_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return g_intstacktop;

Review Comment:
   wrong



##########
arch/sparc/src/common/sparc_checkstack.c:
##########
@@ -219,6 +219,7 @@ ssize_t up_check_stack_remain(void)
 }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 7
+

Review Comment:
   revert the change



##########
arch/sparc/src/common/sparc_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/sparc/src/common/sparc_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "sparc_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)sparc_intstack_alloc();
+}
+

Review Comment:
   apply the similar comment



##########
arch/mips/src/common/mips_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/mips/src/common/mips_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "mips_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   apply the similar change



##########
arch/hc/src/m9s12/m9s12_registerdump.c:
##########
@@ -0,0 +1,83 @@
+/****************************************************************************
+ * arch/hc/src/m9s12/m9s12_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+
+#include <arch/board/board.h>
+
+#include "sched/sched.h"
+#include "hc_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove



##########
arch/sparc/src/sparc_v8/sparc_v8_registerdump.c:
##########
@@ -23,68 +23,59 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
-#include <nuttx/syslog/syslog.h>
 
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
 #include <debug.h>
 
-#include "chip.h"
-#include "sched/sched.h"
-#include "z16_internal.h"
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <arch/board/board.h>
 
-#ifdef CONFIG_ARCH_STACKDUMP
+#include "sched/sched.h"
+#include "sparc_internal.h"
 
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_getsp
+ * Name: up_getusrsp
  ****************************************************************************/
 
-/* To be provided */
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
+{
+  return CURRENT_REGS[REG_I6];
+}
+#endif
 
 /****************************************************************************
- * Name: z16_stackdump
+ * Name: sparc_registerdump
  ****************************************************************************/
 
-void z16_stackdump(void)
+void sparc_registerdump(volatile uint32_t *regs)
 {
-  FAR struct tcb_s *rtcb = running_task();
-  chipreg_t sp = up_getsp();
-  chipreg_t stack_base = (chipreg_t)rtcb->stack_base_ptr;
-  chipreg_t stack_size = (chipreg_t)rtcb->adj_stack_size;
-  chipreg_t stack;
-  chipreg_t stack_top;
-
-  _alert("stack_base: %08x\n", stack_base);
-  _alert("stack_size: %08x\n", stack_size);
-  _alert("sp:         %08x\n", sp);
-
-  if (sp >= stack_base && sp < stack_base + stack_size)
-    {
-      stack = sp;
-    }
-  else
-    {
-      _err("ERROR: Stack pointer is not within allocated stack\n");
-      stack = stack_base;
-    }
-
-  stack_top = stack_base + stack_size;
-
-  /* Flush any buffered SYSLOG data to avoid overwrite */
-
-  syslog_flush();
+  /* Are user registers available from interrupt processing? */
 
-  for (stack = stack & ~(8 * sizeof(chipreg_t) - 1);
-       stack < (stack_top & ~(8 * sizeof(chipreg_t) - 1));
-       stack += 8 * sizeof(chipreg_t))
+  if (regs)
     {
-      chipreg_t *ptr = (chipreg_t *)stack;
-      _alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
-             stack, ptr[0], ptr[1], ptr[2], ptr[3],
-             ptr[4], ptr[5], ptr[6], ptr[7]);
+      _alert("R%d: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+            0,
+            regs[REG_R16], regs[REG_R17],
+            regs[REG_R18], regs[REG_R19],
+            regs[REG_R20], regs[REG_R21],
+            regs[REG_R22], regs[REG_R23]);
+
+      _alert("R%d: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+            8,
+            regs[REG_R24], regs[REG_R25],
+            regs[REG_R26], regs[REG_R27],
+            regs[REG_R28], regs[REG_R29],
+            regs[REG_R30], regs[REG_R31]);
+
+      _alert("SR: %08x\n", regs[REG_R14]);
     }
 }
 

Review Comment:
   remove the blank line too



##########
arch/risc-v/src/common/riscv_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   apply the similar comment



##########
arch/renesas/src/sh1/sh1_registerdump.c:
##########
@@ -0,0 +1,72 @@
+/****************************************************************************
+ * arch/renesas/src/sh1/sh1_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+
+#include "renesas_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/risc-v/src/common/riscv_checkstack.c:
##########
@@ -197,6 +197,7 @@ ssize_t up_check_stack_remain(void)
 }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 15
+

Review Comment:
   revert



##########
arch/risc-v/src/common/riscv_registerdump.c:
##########
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include "sched/sched.h"
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/risc-v/src/common/riscv_assert.c:
##########
@@ -41,304 +40,25 @@
  * Private Functions
  ****************************************************************************/
 
-#ifdef CONFIG_ARCH_STACKDUMP
-
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
 static uint8_t s_last_regs[XCPTCONTEXT_SIZE];
 
 /****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: riscv_stackdump
- ****************************************************************************/
-
-static void riscv_stackdump(uintptr_t sp, uintptr_t stack_top)
-{
-  uintptr_t stack;
-
-  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
-    {
-      uint32_t *ptr = (uint32_t *)stack;
-      _alert("%" PRIxREG ": %08" PRIx32 " %08" PRIx32 " %08" PRIx32
-             " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
-             " %08" PRIx32 "\n",
-             stack, ptr[0], ptr[1], ptr[2], ptr[3],
-             ptr[4], ptr[5], ptr[6], ptr[7]);
-    }
-}
-
-/****************************************************************************
- * Name: riscv_registerdump
- ****************************************************************************/
-
-static inline void riscv_registerdump(volatile uintptr_t *regs)
-{
-  /* Are user registers available from interrupt processing? */
-
-  _alert("EPC: %" PRIxREG "\n", regs[REG_EPC]);
-  _alert("A0: %" PRIxREG " A1: %" PRIxREG " A2: %" PRIxREG
-         " A3: %" PRIxREG "\n",
-         regs[REG_A0], regs[REG_A1], regs[REG_A2], regs[REG_A3]);
-  _alert("A4: %" PRIxREG " A5: %" PRIxREG " A6: %" PRIxREG
-         " A7: %" PRIxREG "\n",
-         regs[REG_A4], regs[REG_A5], regs[REG_A6], regs[REG_A7]);
-  _alert("T0: %" PRIxREG " T1: %" PRIxREG " T2: %" PRIxREG
-         " T3: %" PRIxREG "\n",
-         regs[REG_T0], regs[REG_T1], regs[REG_T2], regs[REG_T3]);
-  _alert("T4: %" PRIxREG " T5: %" PRIxREG " T6: %" PRIxREG "\n",
-         regs[REG_T4], regs[REG_T5], regs[REG_T6]);
-  _alert("S0: %" PRIxREG " S1: %" PRIxREG " S2: %" PRIxREG
-         " S3: %" PRIxREG "\n",
-         regs[REG_S0], regs[REG_S1], regs[REG_S2], regs[REG_S3]);
-  _alert("S4: %" PRIxREG " S5: %" PRIxREG " S6: %" PRIxREG
-         " S7: %" PRIxREG "\n",
-         regs[REG_S4], regs[REG_S5], regs[REG_S6], regs[REG_S7]);
-  _alert("S8: %" PRIxREG " S9: %" PRIxREG " S10: %" PRIxREG
-         " S11: %" PRIxREG "\n",
-         regs[REG_S8], regs[REG_S9], regs[REG_S10], regs[REG_S11]);
-#ifdef RISCV_SAVE_GP
-  _alert("GP: %" PRIxREG " SP: %" PRIxREG " FP: %" PRIxREG
-         " TP: %" PRIxREG " RA: %" PRIxREG "\n",
-         regs[REG_GP], regs[REG_SP], regs[REG_FP], regs[REG_TP],
-         regs[REG_RA]);
-#else
-  _alert("SP: %" PRIxREG " FP: %" PRIxREG " TP: %" PRIxREG
-         " RA: %" PRIxREG "\n",
-         regs[REG_SP], regs[REG_FP], regs[REG_TP], regs[REG_RA]);
-#endif
-}
-
-/****************************************************************************
- * Name: riscv_dump_task
- ****************************************************************************/
-
-static void riscv_dump_task(struct tcb_s *tcb, void *arg)
-{
-  char args[64] = "";
-#ifdef CONFIG_STACK_COLORATION
-  uint32_t stack_filled = 0;
-  uint32_t stack_used;
-#endif
-#ifdef CONFIG_SCHED_CPULOAD
-  struct cpuload_s cpuload;
-  uint32_t fracpart;
-  uint32_t intpart;
-  uint32_t tmp;
-
-  clock_cpuload(tcb->pid, &cpuload);
-
-  if (cpuload.total > 0)
-    {
-      tmp      = (1000 * cpuload.active) / cpuload.total;
-      intpart  = tmp / 10;
-      fracpart = tmp - 10 * intpart;
-    }
-  else
-    {
-      intpart  = 0;
-      fracpart = 0;
-    }
-#endif
-
-#ifdef CONFIG_STACK_COLORATION
-  stack_used = up_check_tcbstack(tcb);
-  if (tcb->adj_stack_size > 0 && stack_used > 0)
-    {
-      /* Use fixed-point math with one decimal place */
-
-      stack_filled = 10 * 100 * stack_used / tcb->adj_stack_size;
-    }
-#endif
-
-#ifndef CONFIG_DISABLE_PTHREAD
-  if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
-    {
-      struct pthread_tcb_s *ptcb = (struct pthread_tcb_s *)tcb;
-
-      snprintf(args, sizeof(args), " %p", ptcb->arg);
-    }
-  else
-#endif
-    {
-      char **argv = tcb->group->tg_info->argv + 1;
-      size_t npos = 0;
-
-      while (*argv != NULL && npos < sizeof(args))
-        {
-          npos += snprintf(args + npos, sizeof(args) - npos, " %s", *argv++);
-        }
-    }
-
-  /* Dump interesting properties of this task */
-
-  _alert("  %4d   %4d"
-#ifdef CONFIG_SMP
-         "  %4d"
-#endif
-         "   %7lu"
-#ifdef CONFIG_STACK_COLORATION
-         "   %7lu   %3" PRId32 ".%1" PRId32 "%%%c"
-#endif
-#ifdef CONFIG_SCHED_CPULOAD
-         "   %3" PRId32 ".%01" PRId32 "%%"
-#endif
-         "   %s%s\n"
-         , tcb->pid, tcb->sched_priority
-#ifdef CONFIG_SMP
-         , tcb->cpu
-#endif
-         , (unsigned long)tcb->adj_stack_size
-#ifdef CONFIG_STACK_COLORATION
-         , (unsigned long)up_check_tcbstack(tcb)
-         , stack_filled / 10, stack_filled % 10
-         , (stack_filled >= 10 * 80 ? '!' : ' ')
-#endif
-#ifdef CONFIG_SCHED_CPULOAD
-         , intpart, fracpart
-#endif
-#if CONFIG_TASK_NAME_SIZE > 0
-         , tcb->name
-#else
-         , "<noname>"
-#endif
-         , args
-        );
-}
-
-/****************************************************************************
- * Name: riscv_dump_backtrace
- ****************************************************************************/
-
-#ifdef CONFIG_SCHED_BACKTRACE
-static void riscv_dump_backtrace(struct tcb_s *tcb, void *arg)
-{
-  /* Show back trace */
-
-  sched_dumpstack(tcb->pid);
-}
-#endif
-
-/****************************************************************************
- * Name: riscv_showtasks
- ****************************************************************************/
-
-static inline void riscv_showtasks(void)
-{
-#if CONFIG_ARCH_INTERRUPTSTACK > 15
-#  ifdef CONFIG_STACK_COLORATION
-  uint32_t stack_used = up_check_intstack();
-  uint32_t stack_filled = 0;
-
-  if ((CONFIG_ARCH_INTERRUPTSTACK & ~15) > 0 && stack_used > 0)
-    {
-      /* Use fixed-point math with one decimal place */
-
-      stack_filled = 10 * 100 *
-                     stack_used / (CONFIG_ARCH_INTERRUPTSTACK & ~15);
-    }
-#  endif
-#endif
-
-  /* Dump interesting properties of each task in the crash environment */
-
-  _alert("   PID    PRI"
-#ifdef CONFIG_SMP
-         "   CPU"
-#endif
-         "     STACK"
-#ifdef CONFIG_STACK_COLORATION
-         "      USED   FILLED "
-#endif
-#ifdef CONFIG_SCHED_CPULOAD
-         "      CPU"
-#endif
-         "   COMMAND\n");
-
-#if CONFIG_ARCH_INTERRUPTSTACK > 15
-  _alert("  ----   ----"
-#  ifdef CONFIG_SMP
-         "  ----"
-#  endif
-         "   %7u"
-#  ifdef CONFIG_STACK_COLORATION
-         "   %7" PRId32 "   %3" PRId32 ".%1" PRId32 "%%%c"
-#  endif
-#  ifdef CONFIG_SCHED_CPULOAD
-         "     ----"
-#  endif
-         "   irq\n"
-         , (CONFIG_ARCH_INTERRUPTSTACK & ~15)
-#  ifdef CONFIG_STACK_COLORATION
-         , stack_used
-         , stack_filled / 10, stack_filled % 10,
-         (stack_filled >= 10 * 80 ? '!' : ' ')
-#  endif
-        );
-#endif
-
-  nxsched_foreach(riscv_dump_task, NULL);
-#ifdef CONFIG_SCHED_BACKTRACE
-  nxsched_foreach(riscv_dump_backtrace, NULL);
-#endif
-}
-
-/****************************************************************************
- * Name: riscv_dump_stack
+ * Public Functions
  ****************************************************************************/
 
-static void riscv_dump_stack(const char *tag, uintptr_t sp,
-                             uintptr_t base, uint32_t size, bool force)
-{
-  uintptr_t top = base + size;
-
-  _alert("%s Stack:\n", tag);
-  _alert("sp:     %08" PRIxPTR "\n", sp);
-  _alert("  base: %08" PRIxPTR "\n", base);
-  _alert("  size: %08" PRIx32 "\n", size);
-
-  if (sp >= base && sp < top)
-    {
-      riscv_stackdump(sp, top);
-    }
-  else
-    {
-      _alert("ERROR: %s Stack pointer is not within the stack\n", tag);
-
-      if (force)
-        {
-#ifdef CONFIG_STACK_COLORATION
-          uint32_t remain;
-
-          remain = size - riscv_stack_check((uintptr_t)base, size);
-          base  += remain;
-          size  -= remain;
-#endif
-
-#if CONFIG_ARCH_STACKDUMP_MAX_LENGTH > 0
-          if (size > CONFIG_ARCH_STACKDUMP_MAX_LENGTH)
-            {
-              size = CONFIG_ARCH_STACKDUMP_MAX_LENGTH;
-            }
-#endif
-
-          riscv_stackdump(base, base + size);
-        }
-    }
-}
-
 /****************************************************************************
- * Name: riscv_dumpstate
+ * Name: up_assert
  ****************************************************************************/
 
-static void riscv_dumpstate(void)
+void up_assert(const char *filename, int lineno)

Review Comment:
   should we remove filename and lineno from up_assert?



##########
arch/renesas/src/rx65n/Make.defs:
##########
@@ -25,12 +25,13 @@ CMN_CSRCS += renesas_createstack.c renesas_doirq.c 
renesas_exit.c renesas_idle.c
 CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
 CMN_CSRCS += renesas_releasepending.c renesas_releasestack.c
 CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c 
renesas_usestack.c
+CMN_CSRCS += renesas_getintstack.c

Review Comment:
   merge to line 26



##########
arch/hc/src/common/hc_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/hc/src/common/hc_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "hc_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   apply the similar change



##########
arch/hc/src/m9s12/Make.defs:
##########
@@ -25,10 +25,11 @@ CMN_CSRCS += hc_doirq.c hc_exit.c hc_idle.c hc_initialize.c
 CMN_CSRCS += hc_mdelay.c hc_modifyreg16.c hc_modifyreg32.c hc_modifyreg8.c
 CMN_CSRCS += hc_nputs.c hc_releasepending.c hc_releasestack.c
 CMN_CSRCS += hc_stackframe.c hc_udelay.c hc_switchcontext.c hc_usestack.c
+CMN_CSRCS += hc_getintstack.c

Review Comment:
   merge to line 27



##########
arch/ceva/src/common/ceva_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/ceva/src/common/ceva_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "ceva_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   apply the similar change



##########
arch/renesas/src/m16c/Make.defs:
##########
@@ -25,11 +25,12 @@ CMN_CSRCS += renesas_createstack.c renesas_doirq.c 
renesas_exit.c renesas_idle.c
 CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
 CMN_CSRCS += renesas_releasepending.c renesas_releasestack.c
 CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c 
renesas_usestack.c
+CMN_CSRCS += renesas_getintstack.c

Review Comment:
   merge to line 26



##########
arch/renesas/src/m16c/m16c_registerdump.c:
##########
@@ -0,0 +1,79 @@
+/****************************************************************************
+ * arch/renesas/src/m16c/m16c_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+
+#include "renesas_internal.h"
+#include "chip.h"
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/ceva/src/common/ceva_registerdump.c:
##########
@@ -24,60 +24,42 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
 #include <debug.h>
 
-#include "sched/sched.h"
-#include "z80_internal.h"
+#include <nuttx/arch.h>
 
-#ifdef CONFIG_ARCH_STACKDUMP
+#include "sched/sched.h"
+#include "ceva_internal.h"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: z80_stackdump
+ * Name: up_getusrsp
  ****************************************************************************/
 
-void z80_stackdump(void)
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/or1k/src/common/or1k_checkstack.c:
##########
@@ -135,6 +135,7 @@ ssize_t up_check_stack_remain(void)
 }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
+

Review Comment:
   revert



##########
arch/avr/src/avr32/avr_registerdump.c:
##########
@@ -0,0 +1,79 @@
+/****************************************************************************
+ * arch/avr/src/avr32/avr_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+
+#include "avr_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/ceva/src/common/ceva_registerdump.c:
##########
@@ -24,60 +24,42 @@
 
 #include <nuttx/config.h>
 
-#include <stdint.h>
 #include <debug.h>
 
-#include "sched/sched.h"
-#include "z80_internal.h"
+#include <nuttx/arch.h>
 
-#ifdef CONFIG_ARCH_STACKDUMP
+#include "sched/sched.h"
+#include "ceva_internal.h"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: z80_stackdump
+ * Name: up_getusrsp
  ****************************************************************************/
 
-void z80_stackdump(void)
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+uintptr_t up_getusrsp(void)
 {
-  FAR struct tcb_s *rtcb = running_task();
-  uintptr_t sp = up_getsp();
-  uintptr_t stack_base = (uintptr_t)rtcb->stack_base_ptr;
-  uintptr_t stack_size = (uintptr_t)rtcb->adj_stack_size;
-  uintptr_t stack;
-  uintptr_t stack_top;
-
-  _alert("stack_base: %06x\n", stack_base);
-  _alert("stack_size: %06x\n", stack_size);
-  _alert("sp:         %06x\n", sp);
-
-  if (sp >= stack_base && sp < stack_base + stack_size)
-    {
-      stack = sp;
-    }
-  else
-    {
-      _alert("ERROR: Stack pointer is not within allocated stack\n");
-      stack = stack_base;
-    }
+  return CURRENT_REGS;

Review Comment:
   wrong



##########
arch/renesas/src/common/renesas_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/renesas/src/common/renesas_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "renesas_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   apply the similar comment



##########
arch/or1k/src/common/or1k_registerdump.c:
##########
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * arch/or1k/src/common/or1k_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+
+#include <arch/board/board.h>
+
+#include "or1k_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/arm64/src/common/arm64_checkstack.c:
##########
@@ -217,15 +217,11 @@ ssize_t up_check_stack_remain(void)
 }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 7
+

Review Comment:
   revert the change



##########
arch/arm/src/common/arm_registerdump.c:
##########
@@ -0,0 +1,100 @@
+/****************************************************************************
+ * arch/arm/src/common/arm_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
+#include "arm_internal.h"
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/arm64/src/common/arm64_registerdump.c:
##########
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * arch/arm64/src/common/arm64_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <stdint.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
+#include "arm64_arch.h"
+#include "arm64_internal.h"
+#include "chip.h"
+
+#ifdef CONFIG_ARCH_FPU
+#include "arm64_fpu.h"
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 7

Review Comment:
   remove the check



##########
arch/avr/src/common/avr_getintstack.c:
##########
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * arch/avr/src/common/avr_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "avr_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+
+uintptr_t up_get_intstackbase(void)
+{
+  return (uintptr_t)g_intstackalloc;
+}
+
+#endif

Review Comment:
   apply the similar change



##########
arch/arm64/src/common/arm64_getintstack.c:
##########
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * arch/arm64/src/common/arm64_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "arm64_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
+

Review Comment:
   remove line 40 and 49



##########
arch/avr/src/avr/avr_registerdump.c:
##########
@@ -0,0 +1,103 @@
+/****************************************************************************
+ * arch/avr/src/avr/avr_registerdump.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/arch.h>
+
+#include "avr_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_getusrsp
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3

Review Comment:
   remove the check



##########
arch/avr/src/avr/avr_checkstack.c:
##########
@@ -164,6 +164,7 @@ ssize_t up_check_stack_remain(void)
 }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
+

Review Comment:
   revert



##########
arch/arm/src/common/arm_checkstack.c:
##########
@@ -240,15 +240,11 @@ ssize_t up_check_stack_remain(void)
 }
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
+

Review Comment:
   revert



##########
arch/arm/src/common/arm_getintstack.c:
##########
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * arch/arm/src/common/arm_getintstack.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#include "arm_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_get_intstackbase
+ ****************************************************************************/
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 3
+

Review Comment:
   remove line 40 and 49



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;

Review Comment:
   ```suggestion
     uintptr_t stack;
   ```



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;
+
+  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
+    {
+      FAR uint32_t *ptr = (uint32_t *)stack;
+      _alert("%" PRIxPTR ": %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 "\n",
+             stack, ptr[0], ptr[1], ptr[2], ptr[3],
+             ptr[4], ptr[5], ptr[6], ptr[7]);
+    }
+}
+
+/****************************************************************************
+ * Name: up_dump_stack
+ ****************************************************************************/
+
+static void up_dump_stack(FAR const char *tag, FAR uintptr_t sp,
+                          FAR uintptr_t base, uint32_t size,
+                          uint32_t used, bool force)
+{
+  FAR uintptr_t top = base + size;
+
+  _alert("%s Stack:\n", tag);
+  _alert("sp:     %08" PRIxPTR "\n", sp);
+  _alert("  base: %08" PRIxPTR "\n", base);
+  _alert("  size: %08" PRIx32 "\n", size);
+
+  if (sp >= base && sp < top)
+    {
+      up_stackdump(sp, top);
+    }
+  else
+    {
+      _alert("ERROR: %s Stack pointer is not within the stack\n", tag);
+
+      if (force)
+        {
+#ifdef CONFIG_STACK_COLORATION
+          uint32_t remain = size - used;
+
+          base  += remain;
+          size  -= remain;
+#endif
+
+#if CONFIG_ARCH_STACKDUMP_MAX_LENGTH > 0
+          if (size > CONFIG_ARCH_STACKDUMP_MAX_LENGTH)
+            {
+              size = CONFIG_ARCH_STACKDUMP_MAX_LENGTH;
+            }
+#endif
+
+          up_stackdump(base, base + size);
+        }
+    }
+}
+
+/****************************************************************************
+ * Name: up_showstacks
+ ****************************************************************************/
+
+static void up_showstacks(void)
+{
+  FAR struct tcb_s *rtcb = running_task();
+  FAR uintptr_t sp = up_getsp();
+
+  /* Get the limits on the interrupt stack memory */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
+  up_dump_stack("IRQ", sp,
+                up_get_intstackbase(),
+                CONFIG_ARCH_INTERRUPTSTACK,
+#  ifdef CONFIG_STACK_COLORATION
+                up_check_intstack(),
+#  else
+                0,
+#  endif
+                up_interrupt_context());
+  if (up_interrupt_context())
+    {
+      sp = up_getusrsp();
+    }
+#endif
+
+  up_dump_stack("User", sp,
+                (uintptr_t)rtcb->stack_base_ptr,
+                (uint32_t)rtcb->adj_stack_size,

Review Comment:
   let's change all uint32_t to size_t for 64bit arch



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)

Review Comment:
   ```suggestion
   static void up_stackdump(uintptr_t sp, uintptr_t stack_top)
   ```



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;
+
+  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
+    {
+      FAR uint32_t *ptr = (uint32_t *)stack;

Review Comment:
   ```suggestion
         FAR uint32_t *ptr = (FAR uint32_t *)stack;
   ```



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;
+
+  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
+    {
+      FAR uint32_t *ptr = (uint32_t *)stack;
+      _alert("%" PRIxPTR ": %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 "\n",
+             stack, ptr[0], ptr[1], ptr[2], ptr[3],
+             ptr[4], ptr[5], ptr[6], ptr[7]);
+    }
+}
+
+/****************************************************************************
+ * Name: up_dump_stack
+ ****************************************************************************/
+
+static void up_dump_stack(FAR const char *tag, FAR uintptr_t sp,
+                          FAR uintptr_t base, uint32_t size,
+                          uint32_t used, bool force)
+{
+  FAR uintptr_t top = base + size;
+
+  _alert("%s Stack:\n", tag);
+  _alert("sp:     %08" PRIxPTR "\n", sp);
+  _alert("  base: %08" PRIxPTR "\n", base);
+  _alert("  size: %08" PRIx32 "\n", size);
+
+  if (sp >= base && sp < top)
+    {
+      up_stackdump(sp, top);
+    }
+  else
+    {
+      _alert("ERROR: %s Stack pointer is not within the stack\n", tag);
+
+      if (force)
+        {
+#ifdef CONFIG_STACK_COLORATION
+          uint32_t remain = size - used;
+
+          base  += remain;
+          size  -= remain;
+#endif
+
+#if CONFIG_ARCH_STACKDUMP_MAX_LENGTH > 0
+          if (size > CONFIG_ARCH_STACKDUMP_MAX_LENGTH)
+            {
+              size = CONFIG_ARCH_STACKDUMP_MAX_LENGTH;
+            }
+#endif
+
+          up_stackdump(base, base + size);
+        }
+    }
+}
+
+/****************************************************************************
+ * Name: up_showstacks
+ ****************************************************************************/
+
+static void up_showstacks(void)
+{
+  FAR struct tcb_s *rtcb = running_task();
+  FAR uintptr_t sp = up_getsp();
+
+  /* Get the limits on the interrupt stack memory */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
+  up_dump_stack("IRQ", sp,
+                up_get_intstackbase(),
+                CONFIG_ARCH_INTERRUPTSTACK,
+#  ifdef CONFIG_STACK_COLORATION
+                up_check_intstack(),
+#  else
+                0,
+#  endif
+                up_interrupt_context());
+  if (up_interrupt_context())
+    {
+      sp = up_getusrsp();
+    }
+#endif
+
+  up_dump_stack("User", sp,
+                (uintptr_t)rtcb->stack_base_ptr,
+                (uint32_t)rtcb->adj_stack_size,
+#ifdef CONFIG_STACK_COLORATION
+                up_check_tcbstack(rtcb),
+#else
+                0,
+#endif
+#ifdef CONFIG_ARCH_KERNEL_STACK
+                 false
+#else
+                 true
+#endif
+                );
+
+#ifdef CONFIG_ARCH_KERNEL_STACK
+  up_dump_stack("Kernel", sp,
+                (uintptr_t)rtcb->xcp.kstack,
+                CONFIG_ARCH_KERNEL_STACKSIZE,
+#  ifdef CONFIG_STACK_COLORATION
+                up_check_tcbstack(rtcb),
+#  else
+                0,
+#  endif
+                false);
+#endif
+}
+
+#endif
+
+/****************************************************************************
+ * Name: up_dump_task
+ ****************************************************************************/
+
+static void up_dump_task(struct tcb_s *tcb, void *arg)
+{
+  char args[64] = "";
+#ifdef CONFIG_STACK_COLORATION
+  uint32_t stack_filled = 0;

Review Comment:
   change all uint32_t to size_t



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;
+
+  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
+    {
+      FAR uint32_t *ptr = (uint32_t *)stack;
+      _alert("%" PRIxPTR ": %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 "\n",
+             stack, ptr[0], ptr[1], ptr[2], ptr[3],
+             ptr[4], ptr[5], ptr[6], ptr[7]);
+    }
+}
+
+/****************************************************************************
+ * Name: up_dump_stack
+ ****************************************************************************/
+
+static void up_dump_stack(FAR const char *tag, FAR uintptr_t sp,
+                          FAR uintptr_t base, uint32_t size,

Review Comment:
   ```suggestion
                             uintptr_t base, uint32_t size,
   ```



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;
+
+  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
+    {
+      FAR uint32_t *ptr = (uint32_t *)stack;
+      _alert("%" PRIxPTR ": %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 "\n",
+             stack, ptr[0], ptr[1], ptr[2], ptr[3],
+             ptr[4], ptr[5], ptr[6], ptr[7]);
+    }
+}
+
+/****************************************************************************
+ * Name: up_dump_stack
+ ****************************************************************************/
+
+static void up_dump_stack(FAR const char *tag, FAR uintptr_t sp,
+                          FAR uintptr_t base, uint32_t size,
+                          uint32_t used, bool force)
+{
+  FAR uintptr_t top = base + size;

Review Comment:
   ```suggestion
     uintptr_t top = base + size;
   ```



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;
+
+  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
+    {
+      FAR uint32_t *ptr = (uint32_t *)stack;
+      _alert("%" PRIxPTR ": %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 "\n",
+             stack, ptr[0], ptr[1], ptr[2], ptr[3],
+             ptr[4], ptr[5], ptr[6], ptr[7]);
+    }
+}
+
+/****************************************************************************
+ * Name: up_dump_stack
+ ****************************************************************************/
+
+static void up_dump_stack(FAR const char *tag, FAR uintptr_t sp,

Review Comment:
   ```suggestion
   static void up_dump_stack(FAR const char *tag, uintptr_t sp,
   ```



##########
sched/misc/assert.c:
##########
@@ -121,6 +128,303 @@ static void assert_end(void)
     }
 }
 
+#ifdef CONFIG_ARCH_STACKDUMP
+
+/****************************************************************************
+ * Name: up_stackdump
+ ****************************************************************************/
+
+static void up_stackdump(FAR uintptr_t sp, FAR uintptr_t stack_top)
+{
+  FAR uintptr_t stack;
+
+  for (stack = sp & ~0x1f; stack < (stack_top & ~0x1f); stack += 32)
+    {
+      FAR uint32_t *ptr = (uint32_t *)stack;
+      _alert("%" PRIxPTR ": %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 " %08" PRIx32 " %08" PRIx32 " %08" PRIx32
+             " %08" PRIx32 "\n",
+             stack, ptr[0], ptr[1], ptr[2], ptr[3],
+             ptr[4], ptr[5], ptr[6], ptr[7]);
+    }
+}
+
+/****************************************************************************
+ * Name: up_dump_stack
+ ****************************************************************************/
+
+static void up_dump_stack(FAR const char *tag, FAR uintptr_t sp,
+                          FAR uintptr_t base, uint32_t size,
+                          uint32_t used, bool force)
+{
+  FAR uintptr_t top = base + size;
+
+  _alert("%s Stack:\n", tag);
+  _alert("sp:     %08" PRIxPTR "\n", sp);
+  _alert("  base: %08" PRIxPTR "\n", base);
+  _alert("  size: %08" PRIx32 "\n", size);
+
+  if (sp >= base && sp < top)
+    {
+      up_stackdump(sp, top);
+    }
+  else
+    {
+      _alert("ERROR: %s Stack pointer is not within the stack\n", tag);
+
+      if (force)
+        {
+#ifdef CONFIG_STACK_COLORATION
+          uint32_t remain = size - used;
+
+          base  += remain;
+          size  -= remain;
+#endif
+
+#if CONFIG_ARCH_STACKDUMP_MAX_LENGTH > 0
+          if (size > CONFIG_ARCH_STACKDUMP_MAX_LENGTH)
+            {
+              size = CONFIG_ARCH_STACKDUMP_MAX_LENGTH;
+            }
+#endif
+
+          up_stackdump(base, base + size);
+        }
+    }
+}
+
+/****************************************************************************
+ * Name: up_showstacks
+ ****************************************************************************/
+
+static void up_showstacks(void)
+{
+  FAR struct tcb_s *rtcb = running_task();
+  FAR uintptr_t sp = up_getsp();
+
+  /* Get the limits on the interrupt stack memory */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
+  up_dump_stack("IRQ", sp,
+                up_get_intstackbase(),
+                CONFIG_ARCH_INTERRUPTSTACK,
+#  ifdef CONFIG_STACK_COLORATION
+                up_check_intstack(),
+#  else
+                0,
+#  endif
+                up_interrupt_context());
+  if (up_interrupt_context())
+    {
+      sp = up_getusrsp();
+    }
+#endif
+
+  up_dump_stack("User", sp,
+                (uintptr_t)rtcb->stack_base_ptr,
+                (uint32_t)rtcb->adj_stack_size,
+#ifdef CONFIG_STACK_COLORATION
+                up_check_tcbstack(rtcb),
+#else
+                0,
+#endif
+#ifdef CONFIG_ARCH_KERNEL_STACK
+                 false
+#else
+                 true
+#endif
+                );
+
+#ifdef CONFIG_ARCH_KERNEL_STACK
+  up_dump_stack("Kernel", sp,
+                (uintptr_t)rtcb->xcp.kstack,
+                CONFIG_ARCH_KERNEL_STACKSIZE,
+#  ifdef CONFIG_STACK_COLORATION
+                up_check_tcbstack(rtcb),
+#  else
+                0,
+#  endif
+                false);
+#endif
+}
+
+#endif
+
+/****************************************************************************
+ * Name: up_dump_task
+ ****************************************************************************/
+
+static void up_dump_task(struct tcb_s *tcb, void *arg)
+{
+  char args[64] = "";
+#ifdef CONFIG_STACK_COLORATION
+  uint32_t stack_filled = 0;
+  uint32_t stack_used;
+#endif
+#ifdef CONFIG_SCHED_CPULOAD
+  struct cpuload_s cpuload;
+  uint32_t fracpart;
+  uint32_t intpart;
+  uint32_t tmp;
+
+  clock_cpuload(tcb->pid, &cpuload);
+
+  if (cpuload.total > 0)
+    {
+      tmp      = (1000 * cpuload.active) / cpuload.total;
+      intpart  = tmp / 10;
+      fracpart = tmp - 10 * intpart;
+    }
+  else
+    {
+      intpart  = 0;
+      fracpart = 0;
+    }
+#endif
+
+#ifdef CONFIG_STACK_COLORATION
+  stack_used = up_check_tcbstack(tcb);
+  if (tcb->adj_stack_size > 0 && stack_used > 0)
+    {
+      /* Use fixed-point math with one decimal place */
+
+      stack_filled = 10 * 100 * stack_used / tcb->adj_stack_size;
+    }
+#endif
+
+#ifndef CONFIG_DISABLE_PTHREAD
+  if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
+    {
+      struct pthread_tcb_s *ptcb = (struct pthread_tcb_s *)tcb;
+
+      snprintf(args, sizeof(args), " %p", ptcb->arg);
+    }
+  else
+#endif
+    {
+      char **argv = tcb->group->tg_info->argv + 1;
+      size_t npos = 0;
+
+      while (*argv != NULL && npos < sizeof(args))
+        {
+          npos += snprintf(args + npos, sizeof(args) - npos, " %s", *argv++);
+        }
+    }
+
+  /* Dump interesting properties of this task */
+
+  _alert("  %4d   %4d"
+#ifdef CONFIG_SMP
+         "  %4d"
+#endif
+         "   %7lu"
+#ifdef CONFIG_STACK_COLORATION
+         "   %7lu   %3" PRId32 ".%1" PRId32 "%%%c"
+#endif
+#ifdef CONFIG_SCHED_CPULOAD
+         "   %3" PRId32 ".%01" PRId32 "%%"
+#endif
+         "   %s%s\n"
+         , tcb->pid, tcb->sched_priority
+#ifdef CONFIG_SMP
+         , tcb->cpu
+#endif
+         , (unsigned long)tcb->adj_stack_size
+#ifdef CONFIG_STACK_COLORATION
+         , (unsigned long)up_check_tcbstack(tcb)
+         , stack_filled / 10, stack_filled % 10
+         , (stack_filled >= 10 * 80 ? '!' : ' ')
+#endif
+#ifdef CONFIG_SCHED_CPULOAD
+         , intpart, fracpart
+#endif
+#if CONFIG_TASK_NAME_SIZE > 0
+         , tcb->name
+#else
+         , "<noname>"
+#endif
+         , args
+        );
+}
+
+/****************************************************************************
+ * Name: up_dump_backtrace
+ ****************************************************************************/
+
+#ifdef CONFIG_SCHED_BACKTRACE
+static void up_dump_backtrace(FAR struct tcb_s *tcb, FAR void *arg)

Review Comment:
   let's remove up_ prefix from all function name



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to