You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2021/04/16 03:41:52 UTC
[incubator-nuttx] 01/02: arch: Rename g_intstackbase to
g_intstacktop
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 8640d82ce09459ecda77af72f136ec06204955ac
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Apr 12 20:40:11 2021 +0800
arch: Rename g_intstackbase to g_intstacktop
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
arch/arm/src/arm/arm_assert.c | 14 ++++-----
arch/arm/src/arm/arm_vectors.S | 16 +++++-----
arch/arm/src/armv6-m/arm_assert.c | 14 ++++-----
arch/arm/src/armv6-m/arm_exception.S | 8 ++---
arch/arm/src/armv7-a/arm_assert.c | 26 ++++++++--------
arch/arm/src/armv7-a/arm_vectors.S | 36 +++++++++++------------
arch/arm/src/armv7-m/arm_assert.c | 16 +++++-----
arch/arm/src/armv7-m/gnu/arm_exception.S | 8 ++---
arch/arm/src/armv7-m/gnu/arm_lazyexception.S | 8 ++---
arch/arm/src/armv7-r/arm_assert.c | 24 +++++++--------
arch/arm/src/armv7-r/arm_vectors.S | 32 ++++++++++----------
arch/arm/src/armv8-m/arm_assert.c | 16 +++++-----
arch/arm/src/armv8-m/arm_exception.S | 8 ++---
arch/arm/src/armv8-m/arm_lazyexception.S | 8 ++---
arch/arm/src/c5471/c5471_vectors.S | 16 +++++-----
arch/arm/src/common/arm_internal.h | 2 +-
arch/arm/src/cxd56xx/cxd56_irq.c | 8 ++---
arch/arm/src/cxd56xx/cxd56_irq.h | 2 +-
arch/arm/src/imx6/imx_irq.c | 8 ++---
arch/arm/src/imx6/imx_irq.h | 2 +-
arch/arm/src/lc823450/lc823450_irq.c | 8 ++---
arch/arm/src/lc823450/lc823450_irq.h | 2 +-
arch/arm/src/rp2040/rp2040_irq.c | 8 ++---
arch/arm/src/rp2040/rp2040_irq.h | 2 +-
arch/avr/src/at90usb/at90usb_exceptions.S | 14 +++++----
arch/avr/src/atmega/atmega_exceptions.S | 14 +++++----
arch/avr/src/avr/excptmacros.h | 3 +-
arch/avr/src/avr/up_checkstack.c | 5 ++--
arch/avr/src/avr/up_dumpstate.c | 12 ++++----
arch/avr/src/avr32/up_dumpstate.c | 12 ++++----
arch/avr/src/avr32/up_exceptions.S | 18 +++++++-----
arch/avr/src/avr32/up_initialstate.c | 2 +-
arch/avr/src/common/up_internal.h | 3 +-
arch/hc/src/common/up_internal.h | 3 +-
arch/hc/src/m9s12/m9s12_assert.c | 14 ++++-----
arch/hc/src/m9s12/m9s12_vectors.S | 8 ++---
arch/mips/src/common/mips_internal.h | 3 +-
arch/mips/src/mips32/mips_dumpstate.c | 14 ++++-----
arch/mips/src/pic32mx/excptmacros.h | 5 ++--
arch/mips/src/pic32mx/pic32mx_head.S | 16 ++++++----
arch/mips/src/pic32mz/pic32mz_excptmacros.h | 3 +-
arch/mips/src/pic32mz/pic32mz_head.S | 16 ++++++----
arch/misoc/src/lm32/lm32_dumpstate.c | 14 ++++-----
arch/misoc/src/minerva/minerva_dumpstate.c | 14 ++++-----
arch/or1k/src/common/up_assert.c | 14 ++++-----
arch/or1k/src/common/up_internal.h | 2 +-
arch/renesas/src/m16c/chip.h | 3 +-
arch/renesas/src/m16c/m16c_dumpstate.c | 10 +++----
arch/renesas/src/rx65n/rx65n_dumpstate.c | 10 +++----
arch/renesas/src/rx65n/rx65n_vector.S | 10 +++----
arch/renesas/src/sh1/chip.h | 3 +-
arch/renesas/src/sh1/sh1_dumpstate.c | 14 ++++-----
arch/renesas/src/sh1/sh1_initialstate.c | 2 +-
arch/renesas/src/sh1/sh1_vector.S | 16 +++++-----
arch/risc-v/src/bl602/bl602_head.S | 14 ++++-----
arch/risc-v/src/bl602/bl602_irq.c | 3 +-
arch/risc-v/src/bl602/bl602_start.c | 2 +-
arch/risc-v/src/c906/c906_head.S | 14 ++++-----
arch/risc-v/src/c906/c906_irq.c | 3 +-
arch/risc-v/src/common/riscv_internal.h | 2 +-
arch/risc-v/src/esp32c3/esp32c3_interrupt.S | 10 +++----
arch/risc-v/src/fe310/fe310_head.S | 14 ++++-----
arch/risc-v/src/fe310/fe310_irq.c | 3 +-
arch/risc-v/src/k210/k210_head.S | 14 ++++-----
arch/risc-v/src/k210/k210_irq.c | 3 +-
arch/risc-v/src/litex/litex_head.S | 14 ++++-----
arch/risc-v/src/litex/litex_irq.c | 3 +-
arch/risc-v/src/rv32im/riscv_assert.c | 14 ++++-----
arch/risc-v/src/rv64gc/riscv_assert.c | 12 ++++----
arch/x86/src/common/up_assert.c | 14 ++++-----
arch/x86/src/common/up_internal.h | 3 +-
arch/x86_64/src/common/up_assert.c | 12 ++++----
arch/x86_64/src/common/up_internal.h | 3 +-
arch/xtensa/src/common/xtensa.h | 2 +-
arch/xtensa/src/common/xtensa_dumpstate.c | 14 ++++-----
arch/xtensa/src/common/xtensa_int_handlers.S | 8 ++---
arch/xtensa/src/esp32/chip_macros.h | 2 +-
arch/xtensa/src/esp32/esp32_irq.c | 6 ++--
boards/arm/cxd56xx/common/src/cxd56_crashdump.c | 2 +-
boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c | 2 +-
boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c | 2 +-
81 files changed, 393 insertions(+), 371 deletions(-)
diff --git a/arch/arm/src/arm/arm_assert.c b/arch/arm/src/arm/arm_assert.c
index 9a325fc..8988035 100644
--- a/arch/arm/src/arm/arm_assert.c
+++ b/arch/arm/src/arm/arm_assert.c
@@ -73,11 +73,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -86,7 +86,7 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
}
}
#else
-# define up_stackdump(sp,stack_base)
+# define up_stackdump(sp,stack_top)
#endif
/****************************************************************************
@@ -177,7 +177,7 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -194,17 +194,17 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
_alert("Interrupt Stack\n", sp);
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/arm/src/arm/arm_vectors.S b/arch/arm/src/arm/arm_vectors.S
index f7d58bb..96271d4 100644
--- a/arch/arm/src/arm/arm_vectors.S
+++ b/arch/arm/src/arm/arm_vectors.S
@@ -109,7 +109,7 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Call arm_decodeirq() on the interrupt stack */
- ldr sp, .Lirqstackbase /* SP = interrupt stack base */
+ ldr sp, .Lirqstacktop /* SP = interrupt stack top */
str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */
bl arm_decodeirq /* Call the handler */
ldr sp, [sp] /* Restore the user stack pointer */
@@ -126,8 +126,8 @@ arm_vectorirq:
ldmia sp, {r0-r15}^ /* Return */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-.Lirqstackbase:
- .word g_intstackbase
+.Lirqstacktop:
+ .word g_intstacktop
#endif
.size arm_vectorirq, . - arm_vectorirq
@@ -414,7 +414,7 @@ arm_vectorfiq:
.size arm_vectorfiq, . - arm_vectorfiq
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
@@ -423,13 +423,13 @@ arm_vectorfiq:
.globl g_intstackalloc
.type g_intstackalloc, object
- .globl g_intstackbase
- .type g_intstackbase, object
+ .globl g_intstacktop
+ .type g_intstacktop, object
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
diff --git a/arch/arm/src/armv6-m/arm_assert.c b/arch/arm/src/armv6-m/arm_assert.c
index 1ed5710..8c617a8 100644
--- a/arch/arm/src/armv6-m/arm_assert.c
+++ b/arch/arm/src/armv6-m/arm_assert.c
@@ -72,11 +72,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -85,7 +85,7 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
}
}
#else
-# define up_stackdump(sp,stack_base)
+# define up_stackdump(sp,stack_top)
#endif
/****************************************************************************
@@ -215,7 +215,7 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -232,16 +232,16 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/arm/src/armv6-m/arm_exception.S b/arch/arm/src/armv6-m/arm_exception.S
index 37b1a8c..a2200be 100644
--- a/arch/arm/src/armv6-m/arm_exception.S
+++ b/arch/arm/src/armv6-m/arm_exception.S
@@ -142,7 +142,7 @@ exception_common:
*/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- ldr r7, =g_intstackbase /* R7=Base of the interrupt stack */
+ ldr r7, =g_intstacktop /* R7=Top of the interrupt stack */
mov sp, r7 /* Set the new stack point */
push {r1} /* Save the MSP on the interrupt stack */
bl arm_doirq /* R0=IRQ, R1=register save area on stack */
@@ -248,7 +248,7 @@ exception_common:
.size exception_common, .-exception_common
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Shouldn't happen
@@ -258,11 +258,11 @@ exception_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
.bss
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.balign 4
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-g_intstackbase:
+g_intstacktop:
.size g_intstackalloc, .-g_intstackalloc
#endif
diff --git a/arch/arm/src/armv7-a/arm_assert.c b/arch/arm/src/armv7-a/arm_assert.c
index 5470903..b74c224 100644
--- a/arch/arm/src/armv7-a/arm_assert.c
+++ b/arch/arm/src/armv7-a/arm_assert.c
@@ -75,11 +75,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -88,7 +88,7 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
}
}
#else
-# define up_stackdump(sp,stack_base)
+# define up_stackdump(sp,stack_top)
#endif
/****************************************************************************
@@ -221,9 +221,9 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#ifdef CONFIG_SMP
- istackbase = (uint32_t)arm_intstack_base();
+ istackbase = (uint32_t)arm_intstack_alloc();
#else
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
#endif
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
@@ -251,8 +251,7 @@ static void up_dumpstate(void)
if (rtcb->xcp.kstack)
{
- kstackbase = (uint32_t)rtcb->xcp.kstack +
- CONFIG_ARCH_KERNEL_STACKSIZE;
+ kstackbase = (uint32_t)rtcb->xcp.kstack;
_alert("Kernel stack:\n");
_alert(" base: %08x\n", kstackbase);
@@ -263,17 +262,17 @@ static void up_dumpstate(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 7
/* Does the current stack pointer lie within the interrupt stack? */
- if (sp >= istackbase - istacksize && sp < istackbase)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
_alert("Interrupt Stack\n", sp);
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
#endif
@@ -303,10 +302,11 @@ static void up_dumpstate(void)
* kernel stack memory.
*/
- else if (sp >= (uint32_t)rtcb->xcp.kstack && sp < kstackbase)
+ else if (sp >= kstackbase &&
+ sp < kstackbase + CONFIG_ARCH_KERNEL_STACKSIZE)
{
_alert("Kernel Stack\n", sp);
- up_stackdump(sp, kstackbase);
+ up_stackdump(sp, kstackbase + CONFIG_ARCH_KERNEL_STACKSIZE);
}
#endif
else
@@ -314,7 +314,7 @@ static void up_dumpstate(void)
_alert("ERROR: Stack pointer is not within the allocated stack\n");
up_stackdump(ustackbase - ustacksize, ustackbase);
#ifdef CONFIG_ARCH_KERNEL_STACK
- up_stackdump((uint32_t)rtcb->xcp.kstack, kstackbase);
+ up_stackdump(kstackbase, kstackbase + CONFIG_ARCH_KERNEL_STACKSIZE);
#endif
}
diff --git a/arch/arm/src/armv7-a/arm_vectors.S b/arch/arm/src/armv7-a/arm_vectors.S
index 45a2670..50f30f3 100644
--- a/arch/arm/src/armv7-a/arm_vectors.S
+++ b/arch/arm/src/armv7-a/arm_vectors.S
@@ -69,7 +69,7 @@
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.macro setirqstack, tmp1, tmp2
- ldr sp, .Lirqstackbase /* SP = IRQ stack top */
+ ldr sp, .Lirqstacktop /* SP = IRQ stack top */
.endm
#endif
@@ -84,7 +84,7 @@
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.macro setfiqstack, tmp1, tmp2
- ldr sp, .Lfiqstackbase /* SP = FIQ stack top */
+ ldr sp, .Lfiqstacktop /* SP = FIQ stack top */
.endm
#endif
@@ -204,7 +204,7 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
/* Call arm_decodeirq() on the interrupt stack */
- setirqstack r1, r3 /* SP = interrupt stack base */
+ setirqstack r1, r3 /* SP = interrupt stack top */
str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */
mov r4, sp /* Save the SP in a preserved register */
bic sp, sp, #7 /* Force 8-byte alignment */
@@ -257,8 +257,8 @@ arm_vectorirq:
ldmia r0, {r0-r15}^ /* Return */
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-.Lirqstackbase:
- .word g_intstackbase
+.Lirqstacktop:
+ .word g_intstacktop
#endif
.size arm_vectorirq, . - arm_vectorirq
@@ -903,7 +903,7 @@ arm_vectorfiq:
mov r0, sp /* Get r0=xcp */
#if CONFIG_ARCH_INTERRUPTSTACK > 7
- setfiqstack r1, r4 /* SP = interrupt stack base */
+ setfiqstack r1, r4 /* SP = interrupt stack top */
str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */
mov r4, sp /* Save the SP in a preserved register */
bic sp, sp, #7 /* Force 8-byte alignment */
@@ -954,8 +954,8 @@ arm_vectorfiq:
ldmia r0, {r0-r15}^ /* Return */
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-.Lfiqstackbase:
- .word g_fiqstackbase
+.Lfiqstacktop:
+ .word g_fiqstacktop
#endif
#else
@@ -964,7 +964,7 @@ arm_vectorfiq:
.size arm_vectorfiq, . - arm_vectorfiq
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
****************************************************************************/
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
@@ -973,28 +973,28 @@ arm_vectorfiq:
.globl g_intstackalloc
.type g_intstackalloc, object
- .globl g_intstackbase
- .type g_intstackbase, object
+ .globl g_intstacktop
+ .type g_intstacktop, object
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
/****************************************************************************
- * Name: g_fiqstackalloc/g_fiqstackbase
+ * Name: g_fiqstackalloc/g_fiqstacktop
****************************************************************************/
.globl g_fiqstackalloc
.type g_fiqstackalloc, object
- .globl g_fiqstackbase
- .type g_fiqstackbase, object
+ .globl g_fiqstacktop
+ .type g_fiqstacktop, object
g_fiqstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_fiqstackbase:
- .size g_fiqstackbase, 0
+g_fiqstacktop:
+ .size g_fiqstacktop, 0
.size g_fiqstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
#endif /* !CONFIG_SMP && CONFIG_ARCH_INTERRUPTSTACK > 7 */
diff --git a/arch/arm/src/armv7-m/arm_assert.c b/arch/arm/src/armv7-m/arm_assert.c
index 67276a0..01cfe7a 100644
--- a/arch/arm/src/armv7-m/arm_assert.c
+++ b/arch/arm/src/armv7-m/arm_assert.c
@@ -75,11 +75,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -88,7 +88,7 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
}
}
#else
-# define up_stackdump(sp,stack_base)
+# define up_stackdump(sp,stack_top)
#endif
/****************************************************************************
@@ -224,9 +224,9 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#ifdef CONFIG_SMP
- istackbase = (uint32_t)arm_intstack_base();
+ istackbase = (uint32_t)arm_intstack_alloc();
#else
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
#endif
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
@@ -244,16 +244,16 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/arm/src/armv7-m/gnu/arm_exception.S b/arch/arm/src/armv7-m/gnu/arm_exception.S
index 2700745..db23b85 100644
--- a/arch/arm/src/armv7-m/gnu/arm_exception.S
+++ b/arch/arm/src/armv7-m/gnu/arm_exception.S
@@ -107,7 +107,7 @@
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.macro setintstack, tmp1, tmp2
- ldr sp, =g_intstackbase
+ ldr sp, =g_intstacktop
.endm
#endif
@@ -311,7 +311,7 @@ exception_common:
.size exception_common, .-exception_common
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Shouldn't happen
@@ -321,11 +321,11 @@ exception_common:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.balign 8
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_intstackbase:
+g_intstacktop:
.size g_intstackalloc, .-g_intstackalloc
#endif
diff --git a/arch/arm/src/armv7-m/gnu/arm_lazyexception.S b/arch/arm/src/armv7-m/gnu/arm_lazyexception.S
index dce9154..968c77a 100644
--- a/arch/arm/src/armv7-m/gnu/arm_lazyexception.S
+++ b/arch/arm/src/armv7-m/gnu/arm_lazyexception.S
@@ -88,7 +88,7 @@
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.macro setintstack, tmp1, tmp2
- ldr sp, =g_intstackbase
+ ldr sp, =g_intstacktop
.endm
#endif
@@ -329,7 +329,7 @@ exception_common:
.size exception_common, .-exception_common
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Shouldn't happen
@@ -339,11 +339,11 @@ exception_common:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.balign 8
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_intstackbase:
+g_intstacktop:
.size g_intstackalloc, .-g_intstackalloc
#endif
diff --git a/arch/arm/src/armv7-r/arm_assert.c b/arch/arm/src/armv7-r/arm_assert.c
index d8ff0f3..70cb80f 100644
--- a/arch/arm/src/armv7-r/arm_assert.c
+++ b/arch/arm/src/armv7-r/arm_assert.c
@@ -72,11 +72,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -85,7 +85,7 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
}
}
#else
-# define up_stackdump(sp,stack_base)
+# define up_stackdump(sp,stack_top)
#endif
/****************************************************************************
@@ -217,7 +217,7 @@ static void up_dumpstate(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 7
/* Get the limits on the interrupt stack memory */
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
/* Show interrupt stack info */
@@ -244,8 +244,7 @@ static void up_dumpstate(void)
if (rtcb->xcp.kstack)
{
- kstackbase = (uint32_t)rtcb->xcp.kstack +
- CONFIG_ARCH_KERNEL_STACKSIZE;
+ kstackbase = (uint32_t)rtcb->xcp.kstack;
_alert("Kernel stack:\n");
_alert(" base: %08x\n", kstackbase);
@@ -256,17 +255,17 @@ static void up_dumpstate(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 7
/* Does the current stack pointer lie within the interrupt stack? */
- if (sp >= istackbase - istacksize && sp < istackbase)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
_alert("Interrupt Stack\n", sp);
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
#endif
@@ -296,10 +295,11 @@ static void up_dumpstate(void)
* kernel stack memory.
*/
- else if (sp >= (uint32_t)rtcb->xcp.kstack && sp < kstackbase)
+ else if (sp >= kstackbase &&
+ sp < kstackbase + CONFIG_ARCH_KERNEL_STACKSIZE)
{
_alert("Kernel Stack\n", sp);
- up_stackdump(sp, kstackbase);
+ up_stackdump(sp, kstackbase + CONFIG_ARCH_KERNEL_STACKSIZE);
}
#endif
else
@@ -307,7 +307,7 @@ static void up_dumpstate(void)
_alert("ERROR: Stack pointer is not within the allocated stack\n");
up_stackdump(ustackbase - ustacksize, ustackbase);
#ifdef CONFIG_ARCH_KERNEL_STACK
- up_stackdump((uint32_t)rtcb->xcp.kstack, kstackbase);
+ up_stackdump(kstackbase, kstackbase + CONFIG_ARCH_KERNEL_STACKSIZE);
#endif
}
diff --git a/arch/arm/src/armv7-r/arm_vectors.S b/arch/arm/src/armv7-r/arm_vectors.S
index 992b30a..8f1bdd7 100644
--- a/arch/arm/src/armv7-r/arm_vectors.S
+++ b/arch/arm/src/armv7-r/arm_vectors.S
@@ -158,7 +158,7 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
/* Call arm_decodeirq() on the interrupt stack */
- ldr sp, .Lirqstackbase /* SP = interrupt stack base */
+ ldr sp, .Lirqstacktop /* SP = interrupt stack top */
str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */
mov r4, sp /* Save the SP in a preserved register */
bic sp, sp, #7 /* Force 8-byte alignment */
@@ -211,8 +211,8 @@ arm_vectorirq:
ldmia r0, {r0-r15}^ /* Return */
#if CONFIG_ARCH_INTERRUPTSTACK > 7
-.Lirqstackbase:
- .word g_intstackbase
+.Lirqstacktop:
+ .word g_intstacktop
#endif
.size arm_vectorirq, . - arm_vectorirq
@@ -857,7 +857,7 @@ arm_vectorfiq:
mov r0, sp /* Get r0=xcp */
#if CONFIG_ARCH_INTERRUPTSTACK > 7
- ldr sp, .Lfiqstackbase /* SP = interrupt stack base */
+ ldr sp, .Lfiqstacktop /* SP = interrupt stack top */
str r0, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */
mov r4, sp /* Save the SP in a preserved register */
bic sp, sp, #7 /* Force 8-byte alignment */
@@ -908,8 +908,8 @@ arm_vectorfiq:
ldmia r0, {r0-r15}^ /* Return */
#if CONFIG_ARCH_INTERRUPTSTACK > 7
-.Lfiqstackbase:
- .word g_fiqstackbase
+.Lfiqstacktop:
+ .word g_fiqstacktop
#endif
#else
@@ -918,7 +918,7 @@ arm_vectorfiq:
.size arm_vectorfiq, . - arm_vectorfiq
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7
@@ -927,28 +927,28 @@ arm_vectorfiq:
.globl g_intstackalloc
.type g_intstackalloc, object
- .globl g_intstackbase
- .type g_intstackbase, object
+ .globl g_intstacktop
+ .type g_intstacktop, object
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
/****************************************************************************
- * Name: g_fiqstackalloc/g_fiqstackbase
+ * Name: g_fiqstackalloc/g_fiqstacktop
****************************************************************************/
.globl g_fiqstackalloc
.type g_fiqstackalloc, object
- .globl g_fiqstackbase
- .type g_fiqstackbase, object
+ .globl g_fiqstacktop
+ .type g_fiqstacktop, object
g_fiqstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_fiqstackbase:
- .size g_fiqstackbase, 0
+g_fiqstacktop:
+ .size g_fiqstacktop, 0
.size g_fiqstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
#endif /* CONFIG_ARCH_INTERRUPTSTACK > 7 */
diff --git a/arch/arm/src/armv8-m/arm_assert.c b/arch/arm/src/armv8-m/arm_assert.c
index b768bca..71b78f8 100644
--- a/arch/arm/src/armv8-m/arm_assert.c
+++ b/arch/arm/src/armv8-m/arm_assert.c
@@ -75,11 +75,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -88,7 +88,7 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
}
}
#else
-# define up_stackdump(sp,stack_base)
+# define up_stackdump(sp,stack_top)
#endif
/****************************************************************************
@@ -224,9 +224,9 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#ifdef CONFIG_SMP
- istackbase = (uint32_t)arm_intstack_base();
+ istackbase = (uint32_t)arm_intstack_alloc();
#else
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
#endif
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
@@ -244,16 +244,16 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/arm/src/armv8-m/arm_exception.S b/arch/arm/src/armv8-m/arm_exception.S
index e9f18f0..6a3a958 100644
--- a/arch/arm/src/armv8-m/arm_exception.S
+++ b/arch/arm/src/armv8-m/arm_exception.S
@@ -111,7 +111,7 @@
ldr \tmp1, =g_intstackalloc
msr msplim, \tmp1
#endif
- ldr sp, =g_intstackbase
+ ldr sp, =g_intstacktop
.endm
#endif
@@ -347,7 +347,7 @@ exception_common:
.size exception_common, .-exception_common
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Shouldn't happen
@@ -357,11 +357,11 @@ exception_common:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.balign 8
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_intstackbase:
+g_intstacktop:
.size g_intstackalloc, .-g_intstackalloc
#endif
diff --git a/arch/arm/src/armv8-m/arm_lazyexception.S b/arch/arm/src/armv8-m/arm_lazyexception.S
index 49c44a0..fd6ed95 100644
--- a/arch/arm/src/armv8-m/arm_lazyexception.S
+++ b/arch/arm/src/armv8-m/arm_lazyexception.S
@@ -92,7 +92,7 @@
ldr \tmp1, =g_intstackalloc
msr msplim, \tmp1
#endif
- ldr sp, =g_intstackbase
+ ldr sp, =g_intstacktop
.endm
#endif
@@ -362,7 +362,7 @@ exception_common:
.size exception_common, .-exception_common
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Shouldn't happen
@@ -372,11 +372,11 @@ exception_common:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.balign 8
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_intstackbase:
+g_intstacktop:
.size g_intstackalloc, .-g_intstackalloc
#endif
diff --git a/arch/arm/src/c5471/c5471_vectors.S b/arch/arm/src/c5471/c5471_vectors.S
index 58b0a6f..1b45452 100644
--- a/arch/arm/src/c5471/c5471_vectors.S
+++ b/arch/arm/src/c5471/c5471_vectors.S
@@ -145,7 +145,7 @@ arm_vectorirq:
mov r1, sp /* Get r1=xcp */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- ldr sp, .Lirqstackbase /* SP = interrupt stack base */
+ ldr sp, .Lirqstacktop /* SP = interrupt stack top */
str r1, [sp, #-4]! /* Save the xcp address at SP-4 then update SP */
bl arm_doirq /* Call the handler */
ldr sp, [sp] /* Restore the user stack pointer */
@@ -162,8 +162,8 @@ arm_vectorirq:
.Lirqtmp:
.word g_irqtmp
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-.Lirqstackbase:
- .word g_intstackbase
+.Lirqstacktop:
+ .word g_intstacktop
#endif
.align 5
@@ -446,7 +446,7 @@ arm_vectoraddrexcptn:
b arm_vectoraddrexcptn
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Shouldn't happen
@@ -457,13 +457,13 @@ arm_vectoraddrexcptn:
.bss
.balign 4
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.type g_intstackalloc, object
- .type g_intstackbase, object
+ .type g_intstacktop, object
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
.end
diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h
index e834972..6a9c01d 100644
--- a/arch/arm/src/common/arm_internal.h
+++ b/arch/arm/src/common/arm_internal.h
@@ -218,7 +218,7 @@ EXTERN const uintptr_t g_idle_topstack;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
EXTERN uint32_t g_intstackalloc; /* Allocated stack base */
-EXTERN uint32_t g_intstackbase; /* Initial top of interrupt stack */
+EXTERN uint32_t g_intstacktop; /* Initial top of interrupt stack */
#endif
/* These 'addresses' of these values are setup by the linker script. They
diff --git a/arch/arm/src/cxd56xx/cxd56_irq.c b/arch/arm/src/cxd56xx/cxd56_irq.c
index 4d0e985..2ef2d73 100644
--- a/arch/arm/src/cxd56xx/cxd56_irq.c
+++ b/arch/arm/src/cxd56xx/cxd56_irq.c
@@ -629,16 +629,16 @@ int up_prioritize_irq(int irq, int priority)
#endif
/****************************************************************************
- * Name: arm_intstack_base
+ * Name: arm_intstack_top
*
* Description:
- * Return a pointer to the "base" the correct interrupt stack allocation
- * for the current CPU. NOTE: Here, the base means "top" of the stack
+ * Return a pointer to the top the correct interrupt stack allocation
+ * for the current CPU.
*
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-uintptr_t arm_intstack_base(void)
+uintptr_t arm_intstack_top(void)
{
return g_cpu_intstack_top[up_cpu_index()];
}
diff --git a/arch/arm/src/cxd56xx/cxd56_irq.h b/arch/arm/src/cxd56xx/cxd56_irq.h
index ce57c47..6093e4a 100644
--- a/arch/arm/src/cxd56xx/cxd56_irq.h
+++ b/arch/arm/src/cxd56xx/cxd56_irq.h
@@ -61,8 +61,8 @@ extern "C"
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-EXTERN uintptr_t arm_intstack_base(void);
EXTERN uintptr_t arm_intstack_alloc(void);
+EXTERN uintptr_t arm_intstack_top(void);
#endif
#undef EXTERN
diff --git a/arch/arm/src/imx6/imx_irq.c b/arch/arm/src/imx6/imx_irq.c
index 8e38b86..d746985 100644
--- a/arch/arm/src/imx6/imx_irq.c
+++ b/arch/arm/src/imx6/imx_irq.c
@@ -173,16 +173,16 @@ void up_irqinitialize(void)
}
/****************************************************************************
- * Name: arm_intstack_base
+ * Name: arm_intstack_top
*
* Description:
- * Return a pointer to the "base" the correct interrupt stack allocation
- * for the current CPU. NOTE: Here, the base means "top" of the stack
+ * Return a pointer to the top the correct interrupt stack allocation
+ * for the current CPU.
*
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-uintptr_t arm_intstack_base(void)
+uintptr_t arm_intstack_top(void)
{
return g_irqstack_top[up_cpu_index()];
}
diff --git a/arch/arm/src/imx6/imx_irq.h b/arch/arm/src/imx6/imx_irq.h
index fc52343..19716d5 100644
--- a/arch/arm/src/imx6/imx_irq.h
+++ b/arch/arm/src/imx6/imx_irq.h
@@ -57,8 +57,8 @@ extern "C"
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-EXTERN uintptr_t arm_intstack_base(void);
EXTERN uintptr_t arm_intstack_alloc(void);
+EXTERN uintptr_t arm_intstack_top(void);
#endif
#undef EXTERN
diff --git a/arch/arm/src/lc823450/lc823450_irq.c b/arch/arm/src/lc823450/lc823450_irq.c
index 436c7ef..38ffeb3 100644
--- a/arch/arm/src/lc823450/lc823450_irq.c
+++ b/arch/arm/src/lc823450/lc823450_irq.c
@@ -861,16 +861,16 @@ int lc823450_irq_register(int irq, struct lc823450_irq_ops *ops)
#endif /* CONFIG_LC823450_VIRQ */
/****************************************************************************
- * Name: arm_intstack_base
+ * Name: arm_intstack_top
*
* Description:
- * Return a pointer to the "base" the correct interrupt stack allocation
- * for the current CPU. NOTE: Here, the base means "top" of the stack
+ * Return a pointer to the top the correct interrupt stack allocation
+ * for the current CPU.
*
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-uintptr_t arm_intstack_base(void)
+uintptr_t arm_intstack_top(void)
{
return g_cpu_intstack_top[up_cpu_index()];
}
diff --git a/arch/arm/src/lc823450/lc823450_irq.h b/arch/arm/src/lc823450/lc823450_irq.h
index 4468c3a..2804691 100644
--- a/arch/arm/src/lc823450/lc823450_irq.h
+++ b/arch/arm/src/lc823450/lc823450_irq.h
@@ -57,8 +57,8 @@ extern "C"
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-EXTERN uintptr_t arm_intstack_base(void);
EXTERN uintptr_t arm_intstack_alloc(void);
+EXTERN uintptr_t arm_intstack_top(void);
#endif
#undef EXTERN
diff --git a/arch/arm/src/rp2040/rp2040_irq.c b/arch/arm/src/rp2040/rp2040_irq.c
index 45f37a0..9e59307 100644
--- a/arch/arm/src/rp2040/rp2040_irq.c
+++ b/arch/arm/src/rp2040/rp2040_irq.c
@@ -470,16 +470,16 @@ int up_prioritize_irq(int irq, int priority)
#endif
/****************************************************************************
- * Name: arm_intstack_base
+ * Name: arm_intstack_top
*
* Description:
- * Return a pointer to the "base" the correct interrupt stack allocation
- * for the current CPU. NOTE: Here, the base means "top" of the stack
+ * Return a pointer to the top the correct interrupt stack allocation
+ * for the current CPU.
*
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-uintptr_t arm_intstack_base(void)
+uintptr_t arm_intstack_top(void)
{
return g_cpu_intstack_top[up_cpu_index()];
}
diff --git a/arch/arm/src/rp2040/rp2040_irq.h b/arch/arm/src/rp2040/rp2040_irq.h
index d989ca5..4c9e834 100644
--- a/arch/arm/src/rp2040/rp2040_irq.h
+++ b/arch/arm/src/rp2040/rp2040_irq.h
@@ -61,8 +61,8 @@ extern "C"
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
-EXTERN uintptr_t arm_intstack_base(void);
EXTERN uintptr_t arm_intstack_alloc(void);
+EXTERN uintptr_t arm_intstack_top(void);
#endif
#undef EXTERN
diff --git a/arch/avr/src/at90usb/at90usb_exceptions.S b/arch/avr/src/at90usb/at90usb_exceptions.S
index 8ead727..89a86fd 100644
--- a/arch/avr/src/at90usb/at90usb_exceptions.S
+++ b/arch/avr/src/at90usb/at90usb_exceptions.S
@@ -145,17 +145,19 @@ excpt_common:
reti
/****************************************************************************************************
- * Name: up_interruptstack
+ * Name: g_intstackalloc
****************************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
.bss
.align 4
- .globl up_interruptstack
- .type up_interruptstack, object
-up_interruptstack:
+ .globl g_intstackalloc
+ .type g_intstackalloc, object
+ .globl g_intstacktop
+ .type g_intstacktop, object
+g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-.Lintstackbase:
- .size up_interruptstack, .-up_interruptstack
+g_intstacktop:
+ .size g_intstackalloc, .-g_intstackalloc
#endif
.end
diff --git a/arch/avr/src/atmega/atmega_exceptions.S b/arch/avr/src/atmega/atmega_exceptions.S
index 2dda57a..faa9e5e 100644
--- a/arch/avr/src/atmega/atmega_exceptions.S
+++ b/arch/avr/src/atmega/atmega_exceptions.S
@@ -234,17 +234,19 @@ excpt_common:
reti
/****************************************************************************************************
- * Name: up_interruptstack
+ * Name: g_intstackalloc
****************************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 0
.bss
.align 4
- .globl up_interruptstack
- .type up_interruptstack, object
-up_interruptstack:
+ .globl g_intstackalloc
+ .type g_intstackalloc, object
+ .globl g_intstacktop
+ .type g_intstacktop, object
+g_intstackalloc:
.skip CONFIG_ARCH_INTERRUPTSTACK
-.Lintstackbase:
- .size up_interruptstack, .-up_interruptstack
+g_intstacktop:
+ .size g_intstackalloc, .-g_intstackalloc
#endif
.end
diff --git a/arch/avr/src/avr/excptmacros.h b/arch/avr/src/avr/excptmacros.h
index 51617b7..d61cf6f 100644
--- a/arch/avr/src/avr/excptmacros.h
+++ b/arch/avr/src/avr/excptmacros.h
@@ -47,7 +47,8 @@
****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- .global g_intstackbase
+ .global g_intstackalloc
+ .global g_intstacktop
.global g_nestlevel
#endif
diff --git a/arch/avr/src/avr/up_checkstack.c b/arch/avr/src/avr/up_checkstack.c
index fcc37d2..5175782 100644
--- a/arch/avr/src/avr/up_checkstack.c
+++ b/arch/avr/src/avr/up_checkstack.c
@@ -167,9 +167,8 @@ ssize_t up_check_stack_remain(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void)
{
- uintptr_t start = (uintptr_t)g_intstackbase -
- (CONFIG_ARCH_INTERRUPTSTACK & ~3);
- return do_stackcheck(start, (CONFIG_ARCH_INTERRUPTSTACK & ~3));
+ uintptr_t start = (uintptr_t)g_intstackalloc;
+ return do_stackcheck(start, CONFIG_ARCH_INTERRUPTSTACK & ~3);
}
size_t up_check_intstack_remain(void)
diff --git a/arch/avr/src/avr/up_dumpstate.c b/arch/avr/src/avr/up_dumpstate.c
index 5dfdbc8..b84a95f 100644
--- a/arch/avr/src/avr/up_dumpstate.c
+++ b/arch/avr/src/avr/up_dumpstate.c
@@ -47,11 +47,11 @@
* Name: up_stackdump
****************************************************************************/
-static void up_stackdump(uint16_t sp, uint16_t stack_base)
+static void up_stackdump(uint16_t sp, uint16_t stack_top)
{
uint16_t stack ;
- for (stack = sp & ~3; stack < stack_base; stack += 12)
+ for (stack = sp & ~3; stack < stack_top; stack += 12)
{
uint8_t *ptr = (uint8_t *)stack;
_alert("%04x: %02x %02x %02x %02x %02x %02x %02x %02x"
@@ -145,7 +145,7 @@ void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 0
- istackbase = (uint16_t)&g_intstackbase;
+ istackbase = (uint16_t)&g_intstackalloc;
istacksize = CONFIG_ARCH_INTERRUPTSTACK;
/* Show interrupt stack info */
@@ -162,16 +162,16 @@ void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/avr/src/avr32/up_dumpstate.c b/arch/avr/src/avr32/up_dumpstate.c
index 6949d88..98f2960 100644
--- a/arch/avr/src/avr32/up_dumpstate.c
+++ b/arch/avr/src/avr32/up_dumpstate.c
@@ -47,11 +47,11 @@
* Name: up_stackdump
****************************************************************************/
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -115,7 +115,7 @@ void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -132,16 +132,16 @@ void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/avr/src/avr32/up_exceptions.S b/arch/avr/src/avr32/up_exceptions.S
index 50b9543..7f9e616 100644
--- a/arch/avr/src/avr32/up_exceptions.S
+++ b/arch/avr/src/avr32/up_exceptions.S
@@ -287,7 +287,7 @@ avr32_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
mov r7, sp
- lddpc sp, .Linstackbaseptr
+ lddpc sp, .Linstacktopptr
#endif
/* Call up_doirq with r12=IRQ number and r11=register save area */
@@ -335,8 +335,8 @@ avr32_common:
.word up_fullcontextrestore
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-.Linstackbaseptr:
- .word .Lintstackbase
+.Linstacktopptr:
+ .word g_intstacktop
#endif
.size vectortab, .-vectortab
@@ -347,11 +347,13 @@ avr32_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
.bss
.align 4
- .globl up_interruptstack
- .type up_interruptstack, object
-up_interruptstack:
+ .globl g_intstackalloc
+ .type g_intstackalloc, object
+ .globl g_intstacktop
+ .type g_intstacktop, object
+g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-.Lintstackbase:
- .size up_interruptstack, .-up_interruptstack
+g_intstacktop:
+ .size g_intstackalloc, .-g_intstackalloc
#endif
.end
diff --git a/arch/avr/src/avr32/up_initialstate.c b/arch/avr/src/avr32/up_initialstate.c
index c516b62..ee33df6 100644
--- a/arch/avr/src/avr32/up_initialstate.c
+++ b/arch/avr/src/avr32/up_initialstate.c
@@ -83,7 +83,7 @@ void up_initial_state(struct tcb_s *tcb)
xcp->regs[REG_LR] = 0;
#endif
- /* Set the initial stack pointer to the "base" of the allocated stack */
+ /* Set the initial stack pointer to the top of the allocated stack */
xcp->regs[REG_SP] = (uint32_t)tcb->adj_stack_ptr;
diff --git a/arch/avr/src/common/up_internal.h b/arch/avr/src/common/up_internal.h
index 7a744b9..5d84aa9 100644
--- a/arch/avr/src/common/up_internal.h
+++ b/arch/avr/src/common/up_internal.h
@@ -71,7 +71,8 @@ typedef void (*up_vector_t)(void);
/* Address of the saved user stack pointer */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-extern void g_intstackbase;
+extern void g_intstackalloc;
+extern void g_intstacktop;
#endif
/* These 'addresses' of these values are setup by the linker script. They
diff --git a/arch/hc/src/common/up_internal.h b/arch/hc/src/common/up_internal.h
index 13eae27..92f6ab4 100644
--- a/arch/hc/src/common/up_internal.h
+++ b/arch/hc/src/common/up_internal.h
@@ -107,7 +107,8 @@ extern uint16_t g_idle_topstack;
/* Address of the saved user stack pointer */
#if CONFIG_ARCH_INTERRUPTSTACK > 1
-extern uint32_t g_intstackbase;
+extern uint32_t g_intstackalloc;
+extern uint32_t g_intstacktop;
#endif
/****************************************************************************
diff --git a/arch/hc/src/m9s12/m9s12_assert.c b/arch/hc/src/m9s12/m9s12_assert.c
index 365da43..8e778f6 100644
--- a/arch/hc/src/m9s12/m9s12_assert.c
+++ b/arch/hc/src/m9s12/m9s12_assert.c
@@ -72,11 +72,11 @@ static uint8_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint16_t sp, uint16_t stack_base)
+static void up_stackdump(uint16_t sp, uint16_t stack_top)
{
uint16_t stack;
- for (stack = sp; stack < stack_base; stack += 16)
+ for (stack = sp; stack < stack_top; stack += 16)
{
uint8_t *ptr = (uint8_t *)stack;
@@ -190,7 +190,7 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint16_t)&g_intstackbase;
+ istackbase = (uint16_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -204,23 +204,23 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
- sp = g_intstackbase;
+ sp = g_intstacktop;
_alert("sp: %04x\n", sp);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/hc/src/m9s12/m9s12_vectors.S b/arch/hc/src/m9s12/m9s12_vectors.S
index 9be7314..5ec06e7 100644
--- a/arch/hc/src/m9s12/m9s12_vectors.S
+++ b/arch/hc/src/m9s12/m9s12_vectors.S
@@ -417,7 +417,7 @@ up_fullcontextrestore:
.comm .Lspsave, 2, 1
/************************************************************************************
- * Name: up_interruptstack/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* If CONFIG_ARCH_INTERRUPTSTACK is defined, this sets aside memory for the
@@ -426,8 +426,8 @@ up_fullcontextrestore:
************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 1
- .comm .up_interruptstack:, CONFIG_ARCH_INTERRUPTSTACK, 1
-up_interruptstack_base:
- .size up_interruptstack, .-up_interruptstack
+ .comm .g_intstackalloc:, CONFIG_ARCH_INTERRUPTSTACK, 1
+g_intstacktop:
+ .size g_intstackalloc, .-g_intstackalloc
#endif
.end
diff --git a/arch/mips/src/common/mips_internal.h b/arch/mips/src/common/mips_internal.h
index 8b4e774..2a41269 100644
--- a/arch/mips/src/common/mips_internal.h
+++ b/arch/mips/src/common/mips_internal.h
@@ -120,7 +120,8 @@ extern uint32_t g_idle_topstack;
/* Address of the saved user stack pointer */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-extern void g_intstackbase;
+extern void g_intstackalloc;
+extern void g_intstacktop;
#endif
/* These 'addresses' of these values are setup by the linker script. They are
diff --git a/arch/mips/src/mips32/mips_dumpstate.c b/arch/mips/src/mips32/mips_dumpstate.c
index 163d1ee..0268698 100644
--- a/arch/mips/src/mips32/mips_dumpstate.c
+++ b/arch/mips/src/mips32/mips_dumpstate.c
@@ -48,11 +48,11 @@
* Name: up_stackdump
****************************************************************************/
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08" PRIx32 ": %08" PRIx32 " %08" PRIx32
@@ -145,7 +145,7 @@ void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -159,23 +159,23 @@ void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
- sp = g_intstackbase;
+ sp = g_intstacktop;
_alert("sp: %08" PRIx32 "\n", sp);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/mips/src/pic32mx/excptmacros.h b/arch/mips/src/pic32mx/excptmacros.h
index 96ccd13..c5697a6 100644
--- a/arch/mips/src/pic32mx/excptmacros.h
+++ b/arch/mips/src/pic32mx/excptmacros.h
@@ -41,7 +41,8 @@
****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- .global g_intstackbase
+ .global g_intstackalloc
+ .global g_intstacktop
#ifdef CONFIG_PIC32MX_NESTED_INTERRUPTS
.global g_nestlevel
#endif
@@ -391,7 +392,7 @@
* interrupt stack first.
*/
- la \tmp3, g_intstackbase
+ la \tmp3, g_intstacktop
lw \tmp4, (\tmp3)
sw sp, (\tmp4)
move sp, \tmp4
diff --git a/arch/mips/src/pic32mx/pic32mx_head.S b/arch/mips/src/pic32mx/pic32mx_head.S
index 3751caa..bbb975c 100644
--- a/arch/mips/src/pic32mx/pic32mx_head.S
+++ b/arch/mips/src/pic32mx/pic32mx_head.S
@@ -102,7 +102,8 @@
.global halt
.global devconfig
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- .global g_intstackbase
+ .global g_intstackalloc
+ .global g_intstacktop
#ifdef CONFIG_PIC32MX_NESTED_INTERRUPTS
.global g_nestlevel
#endif
@@ -661,15 +662,20 @@ devconfig0:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-/* g_instackbase is a pointer to the final, aligned word of the interrupt
+/* g_instacktop is a pointer to the final, aligned word of the interrupt
* stack.
*/
.sdata
- .type g_intstackbase, object
-g_intstackbase:
+ .type g_intstackalloc, object
+g_intstackalloc:
+ .long PIC32MX_INTSTACK_BASE
+ .size g_intstackalloc, .-g_intstackalloc
+
+ .type g_intstacktop, object
+g_intstacktop:
.long PIC32MX_INTSTACK_TOP
- .size g_intstackbase, .-g_intstackbase
+ .size g_intstacktop, .-g_intstacktop
/* g_nextlevel is the exception nesting level... the interrupt stack is not
* available to nested exceptions.
diff --git a/arch/mips/src/pic32mz/pic32mz_excptmacros.h b/arch/mips/src/pic32mz/pic32mz_excptmacros.h
index d07061f..e60f089 100644
--- a/arch/mips/src/pic32mz/pic32mz_excptmacros.h
+++ b/arch/mips/src/pic32mz/pic32mz_excptmacros.h
@@ -41,7 +41,8 @@
****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- .global g_intstackbase
+ .global g_intstackalloc
+ .global g_intstacktop
#ifdef CONFIG_PIC32MZ_NESTED_INTERRUPTS
.global g_nestlevel
#endif
diff --git a/arch/mips/src/pic32mz/pic32mz_head.S b/arch/mips/src/pic32mz/pic32mz_head.S
index 57b5e43..1dffff9 100644
--- a/arch/mips/src/pic32mz/pic32mz_head.S
+++ b/arch/mips/src/pic32mz/pic32mz_head.S
@@ -167,7 +167,8 @@
.global halt
.global devcfg
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- .global g_intstackbase
+ .global g_intstackalloc
+ .global g_intstacktop
#ifdef CONFIG_PIC32MZ_NESTED_INTERRUPTS
.global g_nestlevel
#endif
@@ -918,15 +919,20 @@ adevcfg0:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-/* g_instackbase is a pointer to the final, aligned word of the interrupt
+/* g_instacktop is a pointer to the final, aligned word of the interrupt
* stack.
*/
.sdata
- .type g_intstackbase, object
-g_intstackbase:
+ .type g_intstackalloc, object
+g_intstackalloc:
+ .long PIC32MZ_INTSTACK_BASE
+ .size g_intstackalloc, .-g_intstackalloc
+
+ .type g_intstacktop, object
+g_intstacktop:
.long PIC32MZ_INTSTACK_TOP
- .size g_intstackbase, .-g_intstackbase
+ .size g_intstacktop, .-g_intstacktop
/* g_nextlevel is the exception nesting level... the interrupt stack is not
* available to nested exceptions.
diff --git a/arch/misoc/src/lm32/lm32_dumpstate.c b/arch/misoc/src/lm32/lm32_dumpstate.c
index ad1cb88..fa44403 100644
--- a/arch/misoc/src/lm32/lm32_dumpstate.c
+++ b/arch/misoc/src/lm32/lm32_dumpstate.c
@@ -62,11 +62,11 @@
* Name: up_stackdump
****************************************************************************/
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -147,7 +147,7 @@ void lm32_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -161,23 +161,23 @@ void lm32_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
- sp = g_intstackbase;
+ sp = g_intstacktop;
_alert("sp: %08x\n", sp);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/misoc/src/minerva/minerva_dumpstate.c b/arch/misoc/src/minerva/minerva_dumpstate.c
index 8f8023e..c3de5f9 100644
--- a/arch/misoc/src/minerva/minerva_dumpstate.c
+++ b/arch/misoc/src/minerva/minerva_dumpstate.c
@@ -62,11 +62,11 @@
* Name: up_stackdump
****************************************************************************/
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *) stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -154,7 +154,7 @@ void minerva_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t) & g_intstackbase;
+ istackbase = (uint32_t) &g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -166,23 +166,23 @@ void minerva_dumpstate(void)
/* Does the current stack pointer lie within the interrupt stack? */
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie at the base of the
* interrupt stack.
*/
- sp = g_intstackbase;
+ sp = g_intstacktop;
_alert("sp: %08x\n", sp);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/or1k/src/common/up_assert.c b/arch/or1k/src/common/up_assert.c
index 47fe795..6df9c2c 100644
--- a/arch/or1k/src/common/up_assert.c
+++ b/arch/or1k/src/common/up_assert.c
@@ -71,11 +71,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -84,7 +84,7 @@ static void up_stackdump(uint32_t sp, uint32_t stack_base)
}
}
#else
-# define up_stackdump(sp,stack_base)
+# define up_stackdump(sp,stack_top)
#endif
/****************************************************************************
@@ -215,7 +215,7 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -232,16 +232,16 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/or1k/src/common/up_internal.h b/arch/or1k/src/common/up_internal.h
index 11cae13..150323a 100644
--- a/arch/or1k/src/common/up_internal.h
+++ b/arch/or1k/src/common/up_internal.h
@@ -145,7 +145,7 @@ EXTERN const uint32_t g_idle_topstack;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
EXTERN uint32_t g_intstackalloc; /* Allocated stack base */
-EXTERN uint32_t g_intstackbase; /* Initial top of interrupt stack */
+EXTERN uint32_t g_intstacktop; /* Initial top of interrupt stack */
#endif
/* These 'addresses' of these values are setup by the linker script. They
diff --git a/arch/renesas/src/m16c/chip.h b/arch/renesas/src/m16c/chip.h
index d9282f2..624df1b 100644
--- a/arch/renesas/src/m16c/chip.h
+++ b/arch/renesas/src/m16c/chip.h
@@ -257,7 +257,8 @@ extern uint32_t g_svarvect; /* Start of variable vectors */
#ifndef __ASSEMBLY__
# if CONFIG_ARCH_INTERRUPTSTACK > 3
- extern uint16_t g_intstackbase;
+ extern uint16_t g_intstackalloc;
+ extern uint16_t g_intstacktop;
# endif
#endif
diff --git a/arch/renesas/src/m16c/m16c_dumpstate.c b/arch/renesas/src/m16c/m16c_dumpstate.c
index d876ff0..52dbcf1 100644
--- a/arch/renesas/src/m16c/m16c_dumpstate.c
+++ b/arch/renesas/src/m16c/m16c_dumpstate.c
@@ -63,11 +63,11 @@ static inline uint16_t m16c_getusersp(void)
* Name: m16c_stackdump
****************************************************************************/
-static void m16c_stackdump(uint16_t sp, uint16_t stack_base)
+static void m16c_stackdump(uint16_t sp, uint16_t stack_top)
{
uint16_t stack;
- for (stack = sp & ~7; stack < stack_base; stack += 8)
+ for (stack = sp & ~7; stack < stack_top; stack += 8)
{
uint8_t *ptr = (uint8_t *)stack;
_alert("%04x: %02x %02x %02x %02x %02x %02x %02x %02x\n",
@@ -165,11 +165,11 @@ void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- m16c_stackdump(sp, istackbase);
+ m16c_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer from the register area */
@@ -179,7 +179,7 @@ void up_dumpstate(void)
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- m16c_stackdump(istackbase - istacksize, istackbase);
+ m16c_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/renesas/src/rx65n/rx65n_dumpstate.c b/arch/renesas/src/rx65n/rx65n_dumpstate.c
index 0feab9c..0fa573b 100644
--- a/arch/renesas/src/rx65n/rx65n_dumpstate.c
+++ b/arch/renesas/src/rx65n/rx65n_dumpstate.c
@@ -65,11 +65,11 @@ static inline uint16_t rx65n_getusersp(void)
* Name: rx65n_stackdump
****************************************************************************/
-static void rx65n_stackdump(uint16_t sp, uint16_t stack_base)
+static void rx65n_stackdump(uint16_t sp, uint16_t stack_top)
{
uint16_t stack;
- for (stack = sp & ~7; stack < stack_base; stack += 8) /* check */
+ for (stack = sp & ~7; stack < stack_top; stack += 8) /* check */
{
uint8_t *ptr = (uint8_t *)&stack;
@@ -162,11 +162,11 @@ void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- rx65n_stackdump(sp, istackbase);
+ rx65n_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer from the register area */
@@ -176,7 +176,7 @@ void up_dumpstate(void)
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- rx65n_stackdump(istackbase - istacksize, istackbase);
+ rx65n_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/renesas/src/rx65n/rx65n_vector.S b/arch/renesas/src/rx65n/rx65n_vector.S
index 6029004..0eff9d9 100644
--- a/arch/renesas/src/rx65n/rx65n_vector.S
+++ b/arch/renesas/src/rx65n/rx65n_vector.S
@@ -774,7 +774,7 @@ _uprx65_groupal1_handler:
***************************************************************************/
/****************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Should not happen
@@ -789,12 +789,12 @@ _uprx65_groupal1_handler:
.align 2
.global _g_intstackalloc
.type _g_intstackalloc, object
- .global _g_intstackbase
- .type _g_intstackbase, object
+ .global _g_intstacktop
+ .type _g_intstacktop, object
_g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-_g_intstackbase:
- .size _g_intstackbase, 0
+_g_intstacktop:
+ .size _g_intstacktop, 0
.size _g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
diff --git a/arch/renesas/src/sh1/chip.h b/arch/renesas/src/sh1/chip.h
index 4410a04..1dd0843 100644
--- a/arch/renesas/src/sh1/chip.h
+++ b/arch/renesas/src/sh1/chip.h
@@ -48,7 +48,8 @@
#ifndef __ASSEMBLY__
# if CONFIG_ARCH_INTERRUPTSTACK > 3
- extern uint32_t g_intstackbase;
+ extern uint32_t g_intstackalloc;
+ extern uint32_t g_intstacktop;
# endif
#endif
diff --git a/arch/renesas/src/sh1/sh1_dumpstate.c b/arch/renesas/src/sh1/sh1_dumpstate.c
index 4a74de8..5988d25 100644
--- a/arch/renesas/src/sh1/sh1_dumpstate.c
+++ b/arch/renesas/src/sh1/sh1_dumpstate.c
@@ -50,11 +50,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
* Name: sh1_stackdump
****************************************************************************/
-static void sh1_stackdump(uint32_t sp, uint32_t stack_base)
+static void sh1_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -129,7 +129,7 @@ void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -143,23 +143,23 @@ void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- sh1_stackdump(sp, istackbase);
+ sh1_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
- sp = g_intstackbase;
+ sp = g_intstacktop;
_alert("sp: %08x\n", sp);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- sh1_stackdump(istackbase - istacksize, istackbase);
+ sh1_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/renesas/src/sh1/sh1_initialstate.c b/arch/renesas/src/sh1/sh1_initialstate.c
index 23c518e..e097f6d 100644
--- a/arch/renesas/src/sh1/sh1_initialstate.c
+++ b/arch/renesas/src/sh1/sh1_initialstate.c
@@ -87,7 +87,7 @@ void up_initial_state(struct tcb_s *tcb)
memset(xcp, 0, sizeof(struct xcptcontext));
- /* Set the initial stack pointer to the "base" of the allocated stack */
+ /* Set the initial stack pointer to the "top" of the allocated stack */
xcp->regs[REG_SP] = (uint32_t)tcb->adj_stack_ptr;
diff --git a/arch/renesas/src/sh1/sh1_vector.S b/arch/renesas/src/sh1/sh1_vector.S
index 6f629bb..5fe0a77 100644
--- a/arch/renesas/src/sh1/sh1_vector.S
+++ b/arch/renesas/src/sh1/sh1_vector.S
@@ -323,7 +323,7 @@ _up_vector:
/* Switch to the interrupt stack */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- mov.l .Lintstack, r15 /* SP = interrupt stack base */
+ mov.l .Lirqstacktop, r15 /* SP = interrupt stack top */
mov.l r5, @r15 /* Save the user stack pointer (pre-decremented) */
/* Dispatch the interrupt */
@@ -395,8 +395,8 @@ _up_vector:
nop
.align 2
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-.Lintstack:
- .long _g_intstackbase
+.Lirqstacktop:
+ .long _g_intstacktop
#endif
.Ldoirq:
.long _up_doirq
@@ -486,7 +486,7 @@ _up_fullcontextrestore:
.size _up_fullcontextrestore, .-_up_fullcontextrestore
/************************************************************************************
- * Name: g_intstackalloc/g_intstackbase
+ * Name: g_intstackalloc/g_intstacktop
*
* Description:
* Shouldn't happen
@@ -498,12 +498,12 @@ _up_fullcontextrestore:
.align 2
.globl _g_intstackalloc
.type _g_intstackalloc, object
- .globl _g_intstackbase
- .type _g_intstackbase, object
+ .globl _g_intstacktop
+ .type _g_intstacktop, object
_g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-_g_intstackbase:
- .size _g_intstackbase, 0
+_g_intstacktop:
+ .size _g_intstacktop, 0
.size _g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
.end
diff --git a/arch/risc-v/src/bl602/bl602_head.S b/arch/risc-v/src/bl602/bl602_head.S
index fbc25dc..040ac23 100644
--- a/arch/risc-v/src/bl602/bl602_head.S
+++ b/arch/risc-v/src/bl602/bl602_head.S
@@ -88,8 +88,8 @@ exception_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Switch to interrupt stack */
- lui sp, %hi(g_intstackbase)
- addi sp, sp, %lo(g_intstackbase)
+ lui sp, %hi(g_intstacktop)
+ addi sp, sp, %lo(g_intstacktop)
#ifdef CONFIG_STACK_OVERFLOW_CHECK
la s11, g_intstackalloc
#endif
@@ -147,19 +147,19 @@ exception_common:
mret
/************************************************************************************
- * Name: g_intstackalloc and g_intstackbase
+ * Name: g_intstackalloc and g_intstacktop
************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
.bss
.align 4
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.type g_intstackalloc, object
- .type g_intstackbase, object
+ .type g_intstacktop, object
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
diff --git a/arch/risc-v/src/bl602/bl602_irq.c b/arch/risc-v/src/bl602/bl602_irq.c
index 869f147..4686bd8 100644
--- a/arch/risc-v/src/bl602/bl602_irq.c
+++ b/arch/risc-v/src/bl602/bl602_irq.c
@@ -82,8 +82,7 @@ void up_irqinitialize(void)
/* Colorize the interrupt stack for debug purposes */
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
- riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
- intstack_size);
+ riscv_stack_color((FAR void *)&g_intstackalloc, intstack_size);
#endif
/* currents_regs is non-NULL only while processing an interrupt */
diff --git a/arch/risc-v/src/bl602/bl602_start.c b/arch/risc-v/src/bl602/bl602_start.c
index c87056a..deaea60 100644
--- a/arch/risc-v/src/bl602/bl602_start.c
+++ b/arch/risc-v/src/bl602/bl602_start.c
@@ -114,7 +114,7 @@ __cyg_profile_func_enter(void *this_fn, void *call_site)
__asm__("add %0, x0, sp" : "=r"(sp));
__asm__("add %0, x0, s11" : "=r"(stack_base));
- if (sp <= stack_base)
+ if (sp < stack_base)
{
#if CONFIG_TASK_NAME_SIZE > 0
struct tcb_s *rtcb;
diff --git a/arch/risc-v/src/c906/c906_head.S b/arch/risc-v/src/c906/c906_head.S
index 8a8dc83..e0db739 100644
--- a/arch/risc-v/src/c906/c906_head.S
+++ b/arch/risc-v/src/c906/c906_head.S
@@ -199,10 +199,10 @@ exception_common:
/* Switch to interrupt stack */
bnez s0, 3f
- la sp, g_intstackbase
+ la sp, g_intstacktop
j 4f
3:
- la sp, g_intstackbase
+ la sp, g_intstacktop
addi sp, sp, -(CONFIG_ARCH_INTERRUPTSTACK & ~7)
4:
@@ -261,19 +261,19 @@ exception_common:
mret
/************************************************************************************
- * Name: g_intstackalloc and g_intstackbase
+ * Name: g_intstackalloc and g_intstacktop
************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
.align 8
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.type g_intstackalloc, object
- .type g_intstackbase, object
+ .type g_intstacktop, object
g_intstackalloc:
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
#endif
diff --git a/arch/risc-v/src/c906/c906_irq.c b/arch/risc-v/src/c906/c906_irq.c
index 97de294..eae7ca8 100644
--- a/arch/risc-v/src/c906/c906_irq.c
+++ b/arch/risc-v/src/c906/c906_irq.c
@@ -74,8 +74,7 @@ void up_irqinitialize(void)
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
- riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
- intstack_size);
+ riscv_stack_color((FAR void *)&g_intstackalloc, intstack_size);
#endif
/* Set priority for all global interrupts to 1 (lowest) */
diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h
index 1f0fee9..6c1e4a0 100644
--- a/arch/risc-v/src/common/riscv_internal.h
+++ b/arch/risc-v/src/common/riscv_internal.h
@@ -115,7 +115,7 @@ EXTERN uint32_t g_idle_topstack;
#if CONFIG_ARCH_INTERRUPTSTACK > 3
EXTERN uint32_t g_intstackalloc; /* Allocated stack base */
-EXTERN uint32_t g_intstackbase; /* Initial top of interrupt stack */
+EXTERN uint32_t g_intstacktop; /* Initial top of interrupt stack */
#endif
/* These 'addresses' of these values are setup by the linker script. They
diff --git a/arch/risc-v/src/esp32c3/esp32c3_interrupt.S b/arch/risc-v/src/esp32c3/esp32c3_interrupt.S
index abdb0aa..fcd3e1e 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_interrupt.S
+++ b/arch/risc-v/src/esp32c3/esp32c3_interrupt.S
@@ -34,7 +34,7 @@
.global _interrupt_handler
.global _exception_handler
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
/****************************************************************************
* Section: .noinit
@@ -45,10 +45,10 @@
#if CONFIG_ARCH_INTERRUPTSTACK > 3
.align 4
.type g_intstackalloc, @object
- .type g_intstackbase, @object
+ .type g_intstacktop, @object
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-g_intstackbase:
+g_intstacktop:
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
@@ -112,8 +112,8 @@ _interrupt_handler:
mv a1, sp /* context = sp */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- lui sp, %hi(g_intstackbase)
- addi sp, sp, %lo(g_intstackbase)
+ lui sp, %hi(g_intstacktop)
+ addi sp, sp, %lo(g_intstacktop)
#endif
/* Call interrupt/exception handler in C */
diff --git a/arch/risc-v/src/fe310/fe310_head.S b/arch/risc-v/src/fe310/fe310_head.S
index 713ab35..86f9116 100644
--- a/arch/risc-v/src/fe310/fe310_head.S
+++ b/arch/risc-v/src/fe310/fe310_head.S
@@ -129,8 +129,8 @@ exception_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Switch to interrupt stack */
- lui sp, %hi(g_intstackbase)
- addi sp, sp, %lo(g_intstackbase)
+ lui sp, %hi(g_intstacktop)
+ addi sp, sp, %lo(g_intstacktop)
#endif
/* Call interrupt handler in C */
@@ -185,19 +185,19 @@ exception_common:
mret
/************************************************************************************
- * Name: g_intstackalloc and g_intstackbase
+ * Name: g_intstackalloc and g_intstacktop
************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
.bss
.align 4
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.type g_intstackalloc, object
- .type g_intstackbase, object
+ .type g_intstacktop, object
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
diff --git a/arch/risc-v/src/fe310/fe310_irq.c b/arch/risc-v/src/fe310/fe310_irq.c
index 55b1e2d..7a49608 100644
--- a/arch/risc-v/src/fe310/fe310_irq.c
+++ b/arch/risc-v/src/fe310/fe310_irq.c
@@ -61,8 +61,7 @@ void up_irqinitialize(void)
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
- riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
- intstack_size);
+ riscv_stack_color((FAR void *)&g_intstackalloc, intstack_size);
#endif
/* Set priority for all global interrupts to 1 (lowest) */
diff --git a/arch/risc-v/src/k210/k210_head.S b/arch/risc-v/src/k210/k210_head.S
index bc4bcff..0a5f8ba 100644
--- a/arch/risc-v/src/k210/k210_head.S
+++ b/arch/risc-v/src/k210/k210_head.S
@@ -151,10 +151,10 @@ normal_irq:
/* Switch to interrupt stack */
bnez s0, 3f
- la sp, g_intstackbase
+ la sp, g_intstacktop
j 4f
3:
- la sp, g_intstackbase
+ la sp, g_intstacktop
addi sp, sp, -(CONFIG_ARCH_INTERRUPTSTACK & ~7)
4:
@@ -212,24 +212,24 @@ normal_irq:
mret
/************************************************************************************
- * Name: g_intstackalloc and g_intstackbase
+ * Name: g_intstackalloc and g_intstacktop
************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
.align 8
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.type g_intstackalloc, object
- .type g_intstackbase, object
+ .type g_intstacktop, object
g_intstackalloc:
#ifndef CONFIG_SMP
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
#else
.skip (((CONFIG_ARCH_INTERRUPTSTACK * CONFIG_SMP_NCPUS) + 4) & ~7)
#endif
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
#ifndef CONFIG_SMP
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
#else
diff --git a/arch/risc-v/src/k210/k210_irq.c b/arch/risc-v/src/k210/k210_irq.c
index 82a1671..4c0a484 100644
--- a/arch/risc-v/src/k210/k210_irq.c
+++ b/arch/risc-v/src/k210/k210_irq.c
@@ -82,8 +82,7 @@ void up_irqinitialize(void)
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
- riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
- intstack_size);
+ riscv_stack_color((FAR void *)&g_intstackalloc, intstack_size);
#endif
/* Set priority for all global interrupts to 1 (lowest) */
diff --git a/arch/risc-v/src/litex/litex_head.S b/arch/risc-v/src/litex/litex_head.S
index 162b337..7012f07 100644
--- a/arch/risc-v/src/litex/litex_head.S
+++ b/arch/risc-v/src/litex/litex_head.S
@@ -129,8 +129,8 @@ exception_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Switch to interrupt stack */
- lui sp, %hi(g_intstackbase)
- addi sp, sp, %lo(g_intstackbase)
+ lui sp, %hi(g_intstacktop)
+ addi sp, sp, %lo(g_intstacktop)
#endif
/* Call interrupt handler in C */
@@ -185,19 +185,19 @@ exception_common:
mret
/************************************************************************************
- * Name: g_intstackalloc and g_intstackbase
+ * Name: g_intstackalloc and g_intstacktop
************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3
.bss
.align 4
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.type g_intstackalloc, object
- .type g_intstackbase, object
+ .type g_intstacktop, object
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
-g_intstackbase:
- .size g_intstackbase, 0
+g_intstacktop:
+ .size g_intstacktop, 0
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
#endif
diff --git a/arch/risc-v/src/litex/litex_irq.c b/arch/risc-v/src/litex/litex_irq.c
index 59c760c..1507838 100644
--- a/arch/risc-v/src/litex/litex_irq.c
+++ b/arch/risc-v/src/litex/litex_irq.c
@@ -60,8 +60,7 @@ void up_irqinitialize(void)
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
- riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
- intstack_size);
+ riscv_stack_color((FAR void *)&g_intstackalloc, intstack_size);
#endif
/* litex vexriscv dont have priority and threshold control */
diff --git a/arch/risc-v/src/rv32im/riscv_assert.c b/arch/risc-v/src/rv32im/riscv_assert.c
index e89665b..5b55b6d 100644
--- a/arch/risc-v/src/rv32im/riscv_assert.c
+++ b/arch/risc-v/src/rv32im/riscv_assert.c
@@ -69,11 +69,11 @@
* Name: riscv_stackdump
****************************************************************************/
-static void riscv_stackdump(uint32_t sp, uint32_t stack_base)
+static void riscv_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -190,7 +190,7 @@ static void riscv_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -204,23 +204,23 @@ static void riscv_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- riscv_stackdump(sp, istackbase);
+ riscv_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
- sp = (uint32_t)&g_intstackbase;
+ sp = (uint32_t)&g_intstacktop;
_alert("sp: %08x\n", sp);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- riscv_stackdump(istackbase - istacksize, istackbase);
+ riscv_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/risc-v/src/rv64gc/riscv_assert.c b/arch/risc-v/src/rv64gc/riscv_assert.c
index e6eb128..1ba121b 100644
--- a/arch/risc-v/src/rv64gc/riscv_assert.c
+++ b/arch/risc-v/src/rv64gc/riscv_assert.c
@@ -71,11 +71,11 @@
* Name: up_stackdump
****************************************************************************/
-static void up_stackdump(uint64_t sp, uintptr_t stack_base)
+static void up_stackdump(uint64_t sp, uintptr_t stack_top)
{
uintptr_t stack;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -201,7 +201,7 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 7
- istackbase = (uintptr_t)&g_intstackbase;
+ istackbase = (uintptr_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~7);
/* Show interrupt stack info */
@@ -215,11 +215,11 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer */
@@ -229,7 +229,7 @@ static void up_dumpstate(void)
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/x86/src/common/up_assert.c b/arch/x86/src/common/up_assert.c
index 0841430..2f090d1 100644
--- a/arch/x86/src/common/up_assert.c
+++ b/arch/x86/src/common/up_assert.c
@@ -73,11 +73,11 @@ static uint32_t s_last_regs[XCPTCONTEXT_REGS];
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint32_t sp, uint32_t stack_base)
+static void up_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -151,7 +151,7 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -165,23 +165,23 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
- sp = g_intstackbase;
+ sp = g_intstacktop;
_alert("sp: %08x\n", sp);
}
else if (g_current_regs)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- up_stackdump(istackbase - istacksize, istackbase);
+ up_stackdump(istackbase, istackbase + istacksize);
}
/* Show user stack info */
diff --git a/arch/x86/src/common/up_internal.h b/arch/x86/src/common/up_internal.h
index 6659f5c..e8fd7d3 100644
--- a/arch/x86/src/common/up_internal.h
+++ b/arch/x86/src/common/up_internal.h
@@ -106,7 +106,8 @@ extern uint32_t g_idle_topstack;
/* Address of the saved user stack pointer */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-extern uint32_t g_intstackbase;
+extern uint32_t g_intstackalloc;
+extern uint32_t g_intstacktop;
#endif
/* These 'addresses' of these values are setup by the linker script. They
diff --git a/arch/x86_64/src/common/up_assert.c b/arch/x86_64/src/common/up_assert.c
index ec28519..e4a88fb 100644
--- a/arch/x86_64/src/common/up_assert.c
+++ b/arch/x86_64/src/common/up_assert.c
@@ -65,11 +65,11 @@
****************************************************************************/
#ifdef CONFIG_ARCH_STACKDUMP
-static void up_stackdump(uint64_t sp, uint64_t stack_base)
+static void up_stackdump(uint64_t sp, uint64_t stack_top)
{
uint64_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -129,7 +129,7 @@ static void up_dumpstate(void)
/* Get the limits on the interrupt stack memory */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
- istackbase = (uint64_t)&g_intstackbase;
+ istackbase = (uint64_t)&g_intstackalloc;
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* Show interrupt stack info */
@@ -143,17 +143,17 @@ static void up_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- up_stackdump(sp, istackbase);
+ up_stackdump(sp, istackbase + istacksize);
/* Extract the user stack pointer which should lie
* at the base of the interrupt stack.
*/
- sp = g_intstackbase;
+ sp = g_intstacktop;
_alert("sp: %016x\n", sp);
}
diff --git a/arch/x86_64/src/common/up_internal.h b/arch/x86_64/src/common/up_internal.h
index 9157662..bc1d9ac 100644
--- a/arch/x86_64/src/common/up_internal.h
+++ b/arch/x86_64/src/common/up_internal.h
@@ -125,7 +125,8 @@ extern uint64_t g_idle_topstack;
/* Address of the saved user stack pointer */
#if CONFIG_ARCH_INTERRUPTSTACK > 3
-extern uint64_t g_intstackbase;
+extern uint64_t g_intstackalloc;
+extern uint64_t g_intstacktop;
#endif
/* These 'addresses' of these values are setup by the linker script. They
diff --git a/arch/xtensa/src/common/xtensa.h b/arch/xtensa/src/common/xtensa.h
index d3255c7..70d3ed9 100644
--- a/arch/xtensa/src/common/xtensa.h
+++ b/arch/xtensa/src/common/xtensa.h
@@ -171,7 +171,7 @@ extern volatile uint32_t *g_current_regs[1];
/* The (optional) interrupt stack */
extern uint32_t g_intstackalloc; /* Allocated interrupt stack */
-extern uint32_t g_intstackbase; /* Initial top of interrupt stack */
+extern uint32_t g_intstacktop; /* Initial top of interrupt stack */
#endif
/* Address of the CPU0 IDLE thread */
diff --git a/arch/xtensa/src/common/xtensa_dumpstate.c b/arch/xtensa/src/common/xtensa_dumpstate.c
index 6efb9e0..bd05c45 100644
--- a/arch/xtensa/src/common/xtensa_dumpstate.c
+++ b/arch/xtensa/src/common/xtensa_dumpstate.c
@@ -92,11 +92,11 @@ static inline void up_showtasks(void)
* Name: xtensa_stackdump
****************************************************************************/
-static void xtensa_stackdump(uint32_t sp, uint32_t stack_base)
+static void xtensa_stackdump(uint32_t sp, uint32_t stack_top)
{
uint32_t stack ;
- for (stack = sp & ~0x1f; stack < stack_base; stack += 32)
+ for (stack = sp & ~0x1f; stack < stack_top; stack += 32)
{
uint32_t *ptr = (uint32_t *)stack;
_alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
@@ -298,9 +298,9 @@ void xtensa_dumpstate(void)
#if CONFIG_ARCH_INTERRUPTSTACK > 15
#ifdef CONFIG_SMP
- istackbase = (uint32_t)xtensa_intstack_base();
+ istackbase = (uint32_t)xtensa_intstack_alloc();
#else
- istackbase = (uint32_t)&g_intstackbase;
+ istackbase = (uint32_t)&g_intstackalloc;
#endif
istacksize = INTSTACK_SIZE;
@@ -318,16 +318,16 @@ void xtensa_dumpstate(void)
* stack?
*/
- if (sp < istackbase && sp >= istackbase - istacksize)
+ if (sp >= istackbase && sp < istackbase + istacksize)
{
/* Yes.. dump the interrupt stack */
- xtensa_stackdump(sp, istackbase);
+ xtensa_stackdump(sp, istackbase + istacksize);
}
else if (CURRENT_REGS)
{
_alert("ERROR: Stack pointer is not within the interrupt stack\n");
- xtensa_stackdump(istackbase - istacksize, istackbase);
+ xtensa_stackdump(istackbase, istackbase + istacksize);
}
/* Extract the user stack pointer if we are in an interrupt handler.
diff --git a/arch/xtensa/src/common/xtensa_int_handlers.S b/arch/xtensa/src/common/xtensa_int_handlers.S
index d2123c3..60bcd61 100644
--- a/arch/xtensa/src/common/xtensa_int_handlers.S
+++ b/arch/xtensa/src/common/xtensa_int_handlers.S
@@ -72,12 +72,12 @@
.data
.align 16
.global g_intstackalloc
- .global g_intstackbase
+ .global g_intstacktop
.type g_intstackalloc, @object
- .type g_intstackbase, @object
+ .type g_intstacktop, @object
g_intstackalloc:
.skip INTSTACK_SIZE
-g_intstackbase:
+g_intstacktop:
.size g_intstackalloc, .-g_intstackalloc
#endif
@@ -115,7 +115,7 @@ g_intstackbase:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
.macro setintstack tmp1 tmp2
- movi a1, g_intstackbase
+ movi a1, g_intstacktop
.endm
#endif
diff --git a/arch/xtensa/src/esp32/chip_macros.h b/arch/xtensa/src/esp32/chip_macros.h
index de0bf73..c8f2d85 100644
--- a/arch/xtensa/src/esp32/chip_macros.h
+++ b/arch/xtensa/src/esp32/chip_macros.h
@@ -120,8 +120,8 @@ extern "C"
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
-uintptr_t xtensa_intstack_base(void);
uintptr_t xtensa_intstack_alloc(void);
+uintptr_t xtensa_intstack_top(void);
#endif
#undef EXTERN
diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c
index fe853d9..349abcf 100644
--- a/arch/xtensa/src/esp32/esp32_irq.c
+++ b/arch/xtensa/src/esp32/esp32_irq.c
@@ -179,16 +179,16 @@ void up_irqinitialize(void)
}
/****************************************************************************
- * Name: xtensa_intstack_base
+ * Name: xtensa_intstack_top
*
* Description:
- * Return a pointer to the "base" of the correct interrupt stack for the
+ * Return a pointer to the top of the correct interrupt stack for the
* given CPU.
*
****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
-uintptr_t xtensa_intstack_base(void)
+uintptr_t xtensa_intstack_top(void)
{
return g_cpu_intstack_top[up_cpu_index()];
}
diff --git a/boards/arm/cxd56xx/common/src/cxd56_crashdump.c b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c
index b8e6e15..83117c3 100644
--- a/boards/arm/cxd56xx/common/src/cxd56_crashdump.c
+++ b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c
@@ -187,7 +187,7 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */
- pdump->info.stacks.interrupt.top = (uint32_t)&g_intstackbase;
+ pdump->info.stacks.interrupt.top = (uint32_t)&g_intstacktop;
pdump->info.stacks.interrupt.size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* If In interrupt Context save the interrupt stack data centered
diff --git a/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c b/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c
index 550bca5..df58f75 100644
--- a/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c
+++ b/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c
@@ -455,7 +455,7 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */
- pdump->info.stacks.interrupt.top = (uint32_t)&g_intstackbase;
+ pdump->info.stacks.interrupt.top = (uint32_t)&g_intstacktop;
pdump->info.stacks.interrupt.size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* If In interrupt Context save the interrupt stack data centered
diff --git a/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c b/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c
index 74362bb..87e2f1a 100644
--- a/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c
+++ b/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c
@@ -455,7 +455,7 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
#if CONFIG_ARCH_INTERRUPTSTACK > 3
/* Get the limits on the interrupt stack memory */
- pdump->info.stacks.interrupt.top = (uint32_t)&g_intstackbase;
+ pdump->info.stacks.interrupt.top = (uint32_t)&g_intstacktop;
pdump->info.stacks.interrupt.size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
/* If In interrupt Context save the interrupt stack data centered