arch: Fix the stack boundary calculation and check
All supported arch uses a push-down stack: The stack grows toward lower addresses in memory. The stack pointer register points to the lowest, valid working address (the "top" of the stack). Items on the stack are referenced as positive(include zero) word offsets from sp. Which means that for stack in the [begin, begin + size): 1.The initial SP point to begin + size 2.push equals sub and then store 3.pop equals load and then add Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
15932fa9ea
commit
3f67c67aaf
@ -194,7 +194,7 @@ static void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp < istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -240,7 +240,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -642,7 +642,7 @@ __start:
|
||||
.Linitparms:
|
||||
.long _sbss
|
||||
.long _ebss
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
#if !defined(CONFIG_PAGING) && !defined(CONFIG_BOOT_RUNFROMFLASH)
|
||||
|
||||
|
@ -145,7 +145,7 @@ __start:
|
||||
.Lbssinit:
|
||||
.long _sbss
|
||||
.long _ebss
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
#ifdef CONFIG_BOOT_RUNFROMFLASH
|
||||
.Ldatainit:
|
||||
|
@ -429,8 +429,7 @@ arm_vectorfiq:
|
||||
g_intstackalloc:
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
g_intstackbase:
|
||||
.skip 4
|
||||
.size g_intstackbase, 4
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
|
||||
#endif
|
||||
|
@ -232,7 +232,7 @@ static void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp < istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -266,7 +266,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp <= ustackbase && sp > ustackbase - ustacksize)
|
||||
if (sp < ustackbase && sp >= ustackbase - ustacksize)
|
||||
{
|
||||
up_stackdump(sp, ustackbase);
|
||||
}
|
||||
@ -288,7 +288,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -50,7 +50,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define IDLE_STACK ((unsigned)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define IDLE_STACK ((unsigned)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
#ifndef ARMV6M_PERIPHERAL_INTERRUPTS
|
||||
# error ARMV6M_PERIPHERAL_INTERRUPTS must be defined to the number of I/O interrupts to be supported
|
||||
|
@ -263,7 +263,7 @@ 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 - istacksize && sp < istackbase)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -292,7 +292,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase - ustacksize && sp < ustackbase)
|
||||
if (sp >= ustackbase - ustacksize && sp < ustackbase)
|
||||
{
|
||||
_alert("User Stack\n", sp);
|
||||
up_stackdump(sp, ustackbase);
|
||||
|
@ -736,11 +736,11 @@ arm_data_initialize:
|
||||
|
||||
.Lstackpointer:
|
||||
#ifdef CONFIG_BOOT_SDRAM_DATA
|
||||
.long IDLE_STACK_VBASE+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long IDLE_STACK_VBASE+CONFIG_IDLETHREAD_STACKSIZE
|
||||
#elif defined(CONFIG_SMP)
|
||||
.long _enoinit+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _enoinit+CONFIG_IDLETHREAD_STACKSIZE
|
||||
#else
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
#endif
|
||||
.size .Lstackpointer, . -.Lstackpointer
|
||||
|
||||
|
@ -762,9 +762,9 @@ arm_data_initialize:
|
||||
|
||||
.Lstackpointer:
|
||||
#ifdef CONFIG_BOOT_SDRAM_DATA
|
||||
.long IDLE_STACK_VBASE+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long IDLE_STACK_VBASE+CONFIG_IDLETHREAD_STACKSIZE
|
||||
#else
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
#endif
|
||||
.size .Lstackpointer, . -.Lstackpointer
|
||||
|
||||
|
@ -979,8 +979,7 @@ arm_vectorfiq:
|
||||
g_intstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||
g_intstackbase:
|
||||
.skip 4
|
||||
.size g_intstackbase, 4
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
|
||||
/****************************************************************************
|
||||
@ -995,8 +994,7 @@ g_intstackbase:
|
||||
g_fiqstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||
g_fiqstackbase:
|
||||
.skip 4
|
||||
.size g_fiqstackbase, 4
|
||||
.size g_fiqstackbase, 0
|
||||
.size g_fiqstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
|
||||
#endif /* !CONFIG_SMP && CONFIG_ARCH_INTERRUPTSTACK > 7 */
|
||||
|
@ -244,7 +244,7 @@ static void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp < istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -278,7 +278,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp <= ustackbase && sp > ustackbase - ustacksize)
|
||||
if (sp < ustackbase && sp >= ustackbase - ustacksize)
|
||||
{
|
||||
up_stackdump(sp, ustackbase);
|
||||
}
|
||||
@ -303,7 +303,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within the allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -45,7 +45,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define IDLE_STACK ((unsigned)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define IDLE_STACK ((unsigned)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
#ifndef ARMV7M_PERIPHERAL_INTERRUPTS
|
||||
# error ARMV7M_PERIPHERAL_INTERRUPTS must be defined to the number of I/O interrupts to be supported
|
||||
|
@ -245,7 +245,7 @@ static void up_dumpstate(void)
|
||||
if (rtcb->xcp.kstack)
|
||||
{
|
||||
kstackbase = (uint32_t)rtcb->xcp.kstack +
|
||||
CONFIG_ARCH_KERNEL_STACKSIZE - 4;
|
||||
CONFIG_ARCH_KERNEL_STACKSIZE;
|
||||
|
||||
_alert("Kernel stack:\n");
|
||||
_alert(" base: %08x\n", kstackbase);
|
||||
@ -256,7 +256,7 @@ 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 - istacksize && sp < istackbase)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -285,7 +285,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase - ustacksize && sp < ustackbase)
|
||||
if (sp >= ustackbase - ustacksize && sp < ustackbase)
|
||||
{
|
||||
_alert("User Stack\n", sp);
|
||||
up_stackdump(sp, ustackbase);
|
||||
|
@ -933,8 +933,7 @@ arm_vectorfiq:
|
||||
g_intstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||
g_intstackbase:
|
||||
.skip 4
|
||||
.size g_intstackbase, 4
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
|
||||
/****************************************************************************
|
||||
@ -949,8 +948,7 @@ g_intstackbase:
|
||||
g_fiqstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||
g_fiqstackbase:
|
||||
.skip 4
|
||||
.size g_fiqstackbase, 4
|
||||
.size g_fiqstackbase, 0
|
||||
.size g_fiqstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
|
||||
#endif /* CONFIG_ARCH_INTERRUPTSTACK > 7 */
|
||||
|
@ -244,7 +244,7 @@ static void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp < istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -278,7 +278,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp <= ustackbase && sp > ustackbase - ustacksize)
|
||||
if (sp < ustackbase && sp >= ustackbase - ustacksize)
|
||||
{
|
||||
up_stackdump(sp, ustackbase);
|
||||
}
|
||||
@ -303,7 +303,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within the allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -45,7 +45,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define IDLE_STACK ((unsigned)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define IDLE_STACK ((unsigned)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
#ifndef ARMV8M_PERIPHERAL_INTERRUPTS
|
||||
# error ARMV8M_PERIPHERAL_INTERRUPTS must be defined to the number of I/O interrupts to be supported
|
||||
|
@ -463,8 +463,7 @@ arm_vectoraddrexcptn:
|
||||
g_intstackalloc:
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
g_intstackbase:
|
||||
.skip 4
|
||||
.size g_intstackbase, 4
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
#endif
|
||||
.end
|
||||
|
@ -271,10 +271,10 @@ void __start(void)
|
||||
|
||||
__asm__ __volatile__("\tmsr msp, %0\n" :
|
||||
: "r" ((uint32_t)&_ebss +
|
||||
CONFIG_IDLETHREAD_STACKSIZE - 4));
|
||||
CONFIG_IDLETHREAD_STACKSIZE));
|
||||
__asm__ __volatile__("\tmsr psp, %0\n" :
|
||||
: "r" ((uint32_t)&_ebss +
|
||||
CONFIG_IDLETHREAD_STACKSIZE - 4));
|
||||
CONFIG_IDLETHREAD_STACKSIZE));
|
||||
|
||||
#ifndef CONFIG_CXD56_SUBCORE
|
||||
cpuid = getreg32(CPU_ID);
|
||||
|
@ -54,9 +54,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -47,9 +47,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -66,9 +66,6 @@
|
||||
* here.
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE - 4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function prototypes
|
||||
****************************************************************************/
|
||||
|
@ -77,9 +77,7 @@ static void go_nx_start(void *pv, unsigned int nbytes)
|
||||
* NOTE: ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -58,8 +58,7 @@
|
||||
* 0x2000:3fff - End of SRAM and end of heap (assuming 16KB of SRAM)
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -76,9 +76,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -51,9 +51,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -593,7 +593,7 @@ __start:
|
||||
|
||||
LC0: .long _sbss
|
||||
.long _ebss
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
LC2: .long _eronly /* Where .data defaults are stored in FLASH */
|
||||
.long _sdata /* Where .data needs to reside in SDRAM */
|
||||
|
@ -210,7 +210,7 @@ __start:
|
||||
|
||||
LC0: .long _sbss
|
||||
.long _ebss
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
LC2: .long _eronly /* Where .data defaults are stored in FLASH */
|
||||
.long _sdata /* Where .data needs to reside in SDRAM */
|
||||
|
@ -59,8 +59,7 @@
|
||||
* 0x2001:7fff - End of SRAM and end of heap (assuming 96KB of SRAM)
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE - 4)
|
||||
#define HEAP_BASE ((uint32_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define IDLE_STACK ((uint32_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: showprogress
|
||||
|
@ -55,8 +55,7 @@
|
||||
* 0x2000:3fff - End of SRAM and end of heap (assuming 16KB of SRAM)
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -43,8 +43,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -89,9 +89,7 @@
|
||||
* NOTE: ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: showprogress
|
||||
|
@ -50,9 +50,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -55,8 +55,7 @@
|
||||
* 0x2000:ffff - End of SRAM and end of heap (assuming 64KB of SRAM)
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -52,9 +52,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -61,7 +61,6 @@
|
||||
* 0x2005:ffff - End of internal SRAM and end of heap (a
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -49,9 +49,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -42,8 +42,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -61,7 +61,6 @@
|
||||
* 0x2005:ffff - End of internal SRAM and end of heap (a
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -62,7 +62,6 @@
|
||||
* 0x2005:ffff - End of internal SRAM and end of heap (a
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -62,7 +62,6 @@
|
||||
#define SRAM2_START STM32L4_SRAM2_BASE
|
||||
#define SRAM2_END (SRAM2_START + STM32L4_SRAM2_SIZE)
|
||||
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
|
||||
|
@ -64,7 +64,6 @@
|
||||
#define SRAM2_START STM32L5_SRAM2_BASE
|
||||
#define SRAM2_END (SRAM2_START + STM32L5_SRAM2_SIZE)
|
||||
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE - 4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/* g_idle_topstack: _sbss is the start of the BSS region as defined by the
|
||||
|
@ -589,7 +589,7 @@ dtor_end:
|
||||
|
||||
LC0: .long _sbss
|
||||
.long _ebss
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
LC2: .long _eronly /* Where .data defaults are stored in FLASH */
|
||||
.long _sdata /* Where .data needs to reside in SDRAM */
|
||||
|
@ -54,9 +54,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -53,9 +53,7 @@
|
||||
* ARM EABI requires 64 bit stack alignment.
|
||||
*/
|
||||
|
||||
#define IDLE_STACKSIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + IDLE_STACKSIZE)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -74,7 +74,6 @@ static void go_nx_start(void *pv, unsigned int nbytes)
|
||||
* 0x2002:ffff - End of internal SRAM and end of heap (a
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uintptr_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -148,13 +148,13 @@ excpt_common:
|
||||
* Name: up_interruptstack
|
||||
****************************************************************************************************/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 0
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
.bss
|
||||
.align 4
|
||||
.globl up_interruptstack
|
||||
.type up_interruptstack, object
|
||||
up_interruptstack:
|
||||
.skip CONFIG_ARCH_INTERRUPTSTACK
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
.Lintstackbase:
|
||||
.size up_interruptstack, .-up_interruptstack
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
/* Stack is allocated just after uninitialized data and just before the heap */
|
||||
|
||||
#define STACKBASE (_enoinit+CONFIG_IDLETHREAD_STACKSIZE-1)
|
||||
#define STACKBASE (_enoinit+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/* The RAMPZ register is only available for CPUs with more than 64Kb of FLASH.
|
||||
* Only the AT90USB646, 647, 1286, and 1287 are supported by this file.
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
/* Stack is allocated just after uninitialized data and just before the heap */
|
||||
|
||||
#define STACKBASE (_enoinit+CONFIG_IDLETHREAD_STACKSIZE-1)
|
||||
#define STACKBASE (_enoinit+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/* The RAMPZ register is only available for CPUs with more than 64Kb of FLASH.
|
||||
* At present, only the ATMega128 is supported so RAMPZ should always be
|
||||
|
@ -189,7 +189,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* stack are referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size - 1;
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -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 - 1;
|
||||
istackbase = (uint16_t)&g_intstackbase;
|
||||
istacksize = CONFIG_ARCH_INTERRUPTSTACK;
|
||||
|
||||
/* Show interrupt stack info */
|
||||
@ -162,7 +162,7 @@ void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -196,7 +196,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp <= ustackbase && sp > ustackbase - ustacksize)
|
||||
if (sp < ustackbase && sp >= ustackbase - ustacksize)
|
||||
{
|
||||
up_stackdump(sp, ustackbase);
|
||||
}
|
||||
@ -217,7 +217,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -105,7 +105,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size - 1;
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -195,14 +195,14 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* the stack are referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The AVR32 stack must be aligned at word (4 byte) boundaries. If
|
||||
* necessary top_of_stack must be rounded down to the next boundary
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (size_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (size_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -116,7 +116,7 @@ void up_dumpstate(void)
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint32_t)&g_intstackbase;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
|
||||
/* Show interrupt stack info */
|
||||
|
||||
@ -132,7 +132,7 @@ void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -166,7 +166,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp <= ustackbase && sp > ustackbase - ustacksize)
|
||||
if (sp < ustackbase && sp >= ustackbase - ustacksize)
|
||||
{
|
||||
up_stackdump(sp, ustackbase);
|
||||
}
|
||||
@ -187,7 +187,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -121,7 +121,7 @@ __start:
|
||||
lda.w pc, nx_start
|
||||
|
||||
.Lstackbase:
|
||||
.word _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.word _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
.Lup_lowinit:
|
||||
.word up_lowinit
|
||||
.size __start, .-__start
|
||||
|
@ -106,7 +106,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (size_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The AVR32 stack must be aligned at word (4 byte)
|
||||
* boundaries. If necessary top_of_stack must be rounded
|
||||
@ -114,7 +114,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (size_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (size_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -191,7 +191,7 @@ static void up_dumpstate(void)
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint16_t)&g_intstackbase;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
|
||||
/* Show interrupt stack info */
|
||||
|
||||
@ -204,7 +204,7 @@ static void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -238,7 +238,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -226,7 +226,7 @@ __start:
|
||||
.Lebss:
|
||||
.hword _ebss
|
||||
.Lstackbase:
|
||||
.hword _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.hword _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
.Leronly:
|
||||
.hword _eronly /* Where .data defaults are stored in FLASH */
|
||||
.Lsdata:
|
||||
|
@ -212,7 +212,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* the stack are referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The MIPS stack must be aligned at word (4 byte) boundaries; for
|
||||
* floating point use, the stack must be aligned to 8-byte addresses.
|
||||
@ -228,7 +228,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* The size need not be aligned.
|
||||
*/
|
||||
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -125,7 +125,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The MIPS stack must be aligned at word (4 byte) or double word (8 byte)
|
||||
* boundaries. If necessary top_of_stack must be rounded down to the
|
||||
@ -140,7 +140,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* The size need not be aligned.
|
||||
*/
|
||||
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -146,7 +146,7 @@ void up_dumpstate(void)
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint32_t)&g_intstackbase;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
|
||||
/* Show interrupt stack info */
|
||||
|
||||
@ -159,7 +159,7 @@ void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -193,7 +193,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -78,7 +78,7 @@
|
||||
*/
|
||||
|
||||
#define PIC32MX_STACK_BASE _ebss
|
||||
#define PIC32MX_STACK_TOP _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
#define PIC32MX_STACK_TOP _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
# define PIC32MX_INTSTACK_BASE PIC32MX_STACK_TOP
|
||||
@ -668,7 +668,7 @@ devconfig0:
|
||||
.sdata
|
||||
.type g_intstackbase, object
|
||||
g_intstackbase:
|
||||
.long PIC32MX_INTSTACK_TOP-4
|
||||
.long PIC32MX_INTSTACK_TOP
|
||||
.size g_intstackbase, .-g_intstackbase
|
||||
|
||||
/* g_nextlevel is the exception nesting level... the interrupt stack is not
|
||||
|
@ -81,7 +81,7 @@
|
||||
*/
|
||||
|
||||
#define PIC32MZ_STACK_BASE _ebss
|
||||
#define PIC32MZ_STACK_TOP _ebss + CONFIG_IDLETHREAD_STACKSIZE - 4
|
||||
#define PIC32MZ_STACK_TOP _ebss + CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
# define PIC32MZ_INTSTACK_BASE PIC32MZ_STACK_TOP
|
||||
@ -925,7 +925,7 @@ adevcfg0:
|
||||
.sdata
|
||||
.type g_intstackbase, object
|
||||
g_intstackbase:
|
||||
.long PIC32MZ_INTSTACK_TOP-4
|
||||
.long PIC32MZ_INTSTACK_TOP
|
||||
.size g_intstackbase, .-g_intstackbase
|
||||
|
||||
/* g_nextlevel is the exception nesting level... the interrupt stack is not
|
||||
|
@ -227,7 +227,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* the stack are referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The LM32 stack must be aligned at word (4 byte) boundaries; for
|
||||
* floating point use, the stack must be aligned to 8-byte addresses.
|
||||
@ -236,7 +236,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -148,7 +148,7 @@ void lm32_dumpstate(void)
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint32_t)&g_intstackbase;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
|
||||
/* Show interrupt stack info */
|
||||
|
||||
@ -161,7 +161,7 @@ void lm32_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -195,7 +195,7 @@ void lm32_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -103,14 +103,14 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The i486 stack must be aligned at word (4 byte) boundaries. If necessary
|
||||
* top_of_stack must be rounded down to the next boundary
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -220,7 +220,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* the stack are referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t) tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The MINERVA stack must be aligned at word (4 byte) boundaries; for
|
||||
* floating point use, the stack must be aligned to 8-byte addresses.
|
||||
@ -229,7 +229,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
size_of_stack = top_of_stack - (uint32_t) tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -155,7 +155,7 @@ void minerva_dumpstate(void)
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint32_t) & g_intstackbase;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
|
||||
/* Show interrupt stack info */
|
||||
|
||||
@ -166,7 +166,7 @@ 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 */
|
||||
|
||||
@ -200,7 +200,7 @@ void minerva_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -103,14 +103,14 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The i486 stack must be aligned at word (4 byte) boundaries. If necessary
|
||||
* top_of_stack must be rounded down to the next boundary
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -40,8 +40,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
#if CONFIG_MM_PGSIZE != 4096
|
||||
# error Only pages sizes of 4096 are currently supported (CONFIG_ARCH_ADDRENV)
|
||||
|
@ -124,7 +124,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
|
||||
/* Return the heap settings */
|
||||
|
||||
*heap_start = (FAR void *)g_idle_topstack + 4;
|
||||
*heap_start = (FAR void *)g_idle_topstack;
|
||||
*heap_size = CONFIG_RAM_END - *(uint32_t *)heap_start;
|
||||
|
||||
board_autoled_on(LED_HEAPALLOCATE);
|
||||
|
@ -232,7 +232,7 @@ static void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -266,7 +266,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp <= ustackbase && sp > ustackbase - ustacksize)
|
||||
if (sp < ustackbase && sp >= ustackbase - ustacksize)
|
||||
{
|
||||
up_stackdump(sp, ustackbase);
|
||||
}
|
||||
@ -288,7 +288,7 @@ static void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
up_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -194,9 +194,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
size_t top_of_stack;
|
||||
size_t size_of_stack;
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -103,14 +103,14 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The i486 stack must be aligned at word (4 byte) boundaries. If necessary
|
||||
* top_of_stack must be rounded down to the next boundary
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -42,8 +42,7 @@
|
||||
* 0x0000:0000 - Beginning of DRAM.
|
||||
*/
|
||||
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
|
||||
#define HEAP_BASE ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -251,7 +251,7 @@ _reset_vector:
|
||||
|
||||
l.movhi r1,hi(_ebss);
|
||||
l.ori r1,r1,lo(_ebss);
|
||||
l.addi r1,r1,CONFIG_IDLETHREAD_STACKSIZE-4;
|
||||
l.addi r1,r1,CONFIG_IDLETHREAD_STACKSIZE;
|
||||
l.ori r2,r1,0;
|
||||
l.nop
|
||||
|
||||
|
@ -193,7 +193,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The SH stack must be aligned at word (4 byte)
|
||||
* boundaries. If necessary top_of_stack must be rounded
|
||||
@ -201,7 +201,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -105,14 +105,14 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* stack are referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The SH stack must be aligned at word (4 byte) boundaries. If necessary
|
||||
* top_of_stack must be rounded down to the next boundary
|
||||
*/
|
||||
|
||||
top_of_stack &= ~3;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -165,7 +165,7 @@ void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -197,7 +197,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
m16c_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -149,7 +149,7 @@ void up_dumpstate(void)
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = ebss; /* check how to declare ebss, as of now declared in chip.h */
|
||||
|
||||
istacksize = CONFIG_ARCH_INTERRUPTSTACK;
|
||||
istacksize = CONFIG_ARCH_INTERRUPTSTACK & ~3;
|
||||
|
||||
/* Show interrupt stack info */
|
||||
|
||||
@ -162,7 +162,7 @@ void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -194,7 +194,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
rx65n_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -178,7 +178,7 @@ _loop_here:
|
||||
.type _g_idle_topstack, @object
|
||||
|
||||
_g_idle_topstack:
|
||||
.long _ebss + CONFIG_ARCH_INTERRUPTSTACK + CONFIG_IDLETHREAD_STACKSIZE
|
||||
.long _ebss + (CONFIG_ARCH_INTERRUPTSTACK & ~3) + CONFIG_IDLETHREAD_STACKSIZE
|
||||
.size _g_idle_topstack, . - _g_idle_topstack
|
||||
.end
|
||||
|
||||
|
@ -792,10 +792,9 @@ _uprx65_groupal1_handler:
|
||||
.global _g_intstackbase
|
||||
.type _g_intstackbase, object
|
||||
_g_intstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4)
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
_g_intstackbase:
|
||||
.skip 2
|
||||
.size _g_intstackbase, 4
|
||||
.size _g_intstackbase, 0
|
||||
.size _g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
#endif
|
||||
|
||||
|
@ -130,7 +130,7 @@ void up_dumpstate(void)
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
istackbase = (uint32_t)&g_intstackbase;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4;
|
||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
|
||||
/* Show interrupt stack info */
|
||||
|
||||
@ -143,7 +143,7 @@ void up_dumpstate(void)
|
||||
* stack?
|
||||
*/
|
||||
|
||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
||||
if (sp < istackbase && sp >= istackbase - istacksize)
|
||||
{
|
||||
/* Yes.. dump the interrupt stack */
|
||||
|
||||
@ -177,7 +177,7 @@ void up_dumpstate(void)
|
||||
* stack memory.
|
||||
*/
|
||||
|
||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
||||
if (sp >= ustackbase || sp < ustackbase - ustacksize)
|
||||
{
|
||||
_alert("ERROR: Stack pointer is not within allocated stack\n");
|
||||
sh1_stackdump(ustackbase - ustacksize, ustackbase);
|
||||
|
@ -178,9 +178,9 @@ __vector_table:
|
||||
*/
|
||||
|
||||
.long __start /* 0-1: Power-on reset (hard, NMI high) PC & SP */
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
.long __start /* 2-3: Manual reset (soft, NMI low) PC & SP */
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
|
||||
.rept SH1_NCMN_VECTORS-4
|
||||
.long _up_invalid_handler
|
||||
@ -344,7 +344,7 @@ __start:
|
||||
|
||||
.align 2
|
||||
.Lstack:
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE-4
|
||||
.long _ebss+CONFIG_IDLETHREAD_STACKSIZE
|
||||
.Lwcr1:
|
||||
.long 0x5ffffa2
|
||||
.Lbcr:
|
||||
|
@ -501,10 +501,9 @@ _up_fullcontextrestore:
|
||||
.globl _g_intstackbase
|
||||
.type _g_intstackbase, object
|
||||
_g_intstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4)
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
_g_intstackbase:
|
||||
.skip 2
|
||||
.size _g_intstackbase, 4
|
||||
.size _g_intstackbase, 0
|
||||
.size _g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
#endif
|
||||
.end
|
||||
|
@ -158,9 +158,8 @@ exception_common:
|
||||
.type g_intstackalloc, object
|
||||
.type g_intstackbase, object
|
||||
g_intstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK & ~3))
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
g_intstackbase:
|
||||
.skip 4
|
||||
.size g_intstackbase, 4
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
#endif
|
||||
|
@ -83,7 +83,7 @@ void up_irqinitialize(void)
|
||||
|
||||
size_t intstack_size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||
riscv_stack_color((FAR void *)((uintptr_t)&g_intstackbase - intstack_size),
|
||||
intstack_size);
|
||||
intstack_size);
|
||||
#endif
|
||||
|
||||
/* currents_regs is non-NULL only while processing an interrupt */
|
||||
|
@ -191,7 +191,7 @@ exception_common:
|
||||
|
||||
mv a1, sp /* context = sp */
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
/* Load mhartid (cpuid) */
|
||||
|
||||
csrr s0, mhartid
|
||||
@ -203,7 +203,7 @@ exception_common:
|
||||
j 4f
|
||||
3:
|
||||
la sp, g_intstackbase
|
||||
addi sp, sp, -((CONFIG_ARCH_INTERRUPTSTACK) & ~7)
|
||||
addi sp, sp, -(CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
4:
|
||||
|
||||
#endif
|
||||
@ -272,9 +272,8 @@ exception_common:
|
||||
.type g_intstackalloc, object
|
||||
.type g_intstackbase, object
|
||||
g_intstackalloc:
|
||||
.skip (((CONFIG_ARCH_INTERRUPTSTACK * 2) & ~7))
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||
g_intstackbase:
|
||||
.skip 8
|
||||
.size g_intstackbase, 8
|
||||
.size g_intstackalloc, ((CONFIG_ARCH_INTERRUPTSTACK * 2) & ~7)
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
#endif
|
||||
|
@ -75,7 +75,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);
|
||||
intstack_size);
|
||||
#endif
|
||||
|
||||
/* Set priority for all global interrupts to 1 (lowest) */
|
||||
|
@ -44,10 +44,7 @@ extern uintptr_t *_default_stack_limit;
|
||||
#define C906_IDLESTACK_BASE _default_stack_limit
|
||||
#endif
|
||||
|
||||
#define C906_IDLESTACK_SIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
|
||||
#define C906_IDLESTACK0_TOP (C906_IDLESTACK_BASE + C906_IDLESTACK_SIZE)
|
||||
|
||||
#define C906_IDLESTACK0_TOP (C906_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define C906_IDLESTACK_TOP (C906_IDLESTACK0_TOP)
|
||||
|
||||
#endif /* _ARCH_RISCV_SRC_C906_C906_MEMORYMAP_H */
|
||||
|
@ -208,7 +208,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* the stack are referenced as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The RISC-V stack must be aligned at word (4 byte) boundaries; for
|
||||
* floating point use, the stack must be aligned to 8-byte addresses.
|
||||
@ -217,7 +217,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -118,7 +118,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
* as positive word offsets from sp.
|
||||
*/
|
||||
|
||||
top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size - 4;
|
||||
top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size;
|
||||
|
||||
/* The RISC-V stack must be aligned at word (4 byte) or double word
|
||||
* (8 byte) boundaries. If necessary top_of_stack must be rounded down to
|
||||
@ -126,7 +126,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_alloc_ptr + 4;
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_alloc_ptr;
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
|
@ -42,14 +42,14 @@
|
||||
|
||||
.section .noinit
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
.align 4
|
||||
.type g_intstackalloc, @object
|
||||
.type g_intstackbase, @object
|
||||
g_intstackalloc:
|
||||
.skip CONFIG_ARCH_INTERRUPTSTACK
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
g_intstackbase:
|
||||
.size g_intstackalloc, CONFIG_ARCH_INTERRUPTSTACK
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -111,7 +111,7 @@ _interrupt_handler:
|
||||
csrr a0, mcause /* exception cause */
|
||||
mv a1, sp /* context = sp */
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
lui sp, %hi(g_intstackbase)
|
||||
addi sp, sp, %lo(g_intstackbase)
|
||||
#endif
|
||||
|
@ -37,7 +37,6 @@
|
||||
#define ESP32C3_IDLESTACK_BASE g_idlestack
|
||||
#endif
|
||||
|
||||
#define ESP32C3_IDLESTACK_SIZE (CONFIG_IDLETHREAD_STACKSIZE & ~3)
|
||||
#define ESP32C3_IDLESTACK_TOP (ESP32C3_IDLESTACK_BASE + ESP32C3_IDLESTACK_SIZE)
|
||||
#define ESP32C3_IDLESTACK_TOP (ESP32C3_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
#endif /* _ARCH_RISCV_SRC_ESP32C3_ESP32C3_MEMORYMAP_H */
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
/* Address of the IDLE thread */
|
||||
|
||||
uint8_t g_idlestack[ESP32C3_IDLESTACK_SIZE]
|
||||
uint8_t g_idlestack[CONFIG_IDLETHREAD_STACKSIZE]
|
||||
__attribute__((aligned(16), section(".noinit")));
|
||||
uint32_t g_idle_topstack = ESP32C3_IDLESTACK_TOP;
|
||||
|
||||
|
@ -196,9 +196,8 @@ exception_common:
|
||||
.type g_intstackalloc, object
|
||||
.type g_intstackbase, object
|
||||
g_intstackalloc:
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK & ~3))
|
||||
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
g_intstackbase:
|
||||
.skip 4
|
||||
.size g_intstackbase, 4
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)
|
||||
#endif
|
||||
|
@ -62,7 +62,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);
|
||||
intstack_size);
|
||||
#endif
|
||||
|
||||
/* Set priority for all global interrupts to 1 (lowest) */
|
||||
|
@ -44,7 +44,6 @@
|
||||
#define FE310_IDLESTACK_BASE _ebss
|
||||
#endif
|
||||
|
||||
#define FE310_IDLESTACK_SIZE (CONFIG_IDLETHREAD_STACKSIZE & ~3)
|
||||
#define FE310_IDLESTACK_TOP (FE310_IDLESTACK_BASE + FE310_IDLESTACK_SIZE)
|
||||
#define FE310_IDLESTACK_TOP (FE310_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
#endif /* _ARCH_RISCV_SRC_FE310_FE310_MEMORYMAP_H */
|
||||
|
@ -143,7 +143,7 @@ normal_irq:
|
||||
|
||||
mv a1, sp /* context = sp */
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||
/* Load mhartid (cpuid) */
|
||||
|
||||
csrr s0, mhartid
|
||||
@ -155,7 +155,7 @@ normal_irq:
|
||||
j 4f
|
||||
3:
|
||||
la sp, g_intstackbase
|
||||
addi sp, sp, -((CONFIG_ARCH_INTERRUPTSTACK) & ~7)
|
||||
addi sp, sp, -(CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
4:
|
||||
|
||||
#endif
|
||||
@ -223,9 +223,8 @@ normal_irq:
|
||||
.type g_intstackalloc, object
|
||||
.type g_intstackbase, object
|
||||
g_intstackalloc:
|
||||
.skip (((CONFIG_ARCH_INTERRUPTSTACK * 2) & ~7))
|
||||
.skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
|
||||
g_intstackbase:
|
||||
.skip 8
|
||||
.size g_intstackbase, 8
|
||||
.size g_intstackalloc, ((CONFIG_ARCH_INTERRUPTSTACK * 2) & ~7)
|
||||
.size g_intstackbase, 0
|
||||
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||
#endif
|
||||
|
@ -83,7 +83,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);
|
||||
intstack_size);
|
||||
#endif
|
||||
|
||||
/* Set priority for all global interrupts to 1 (lowest) */
|
||||
|
@ -43,10 +43,8 @@
|
||||
#define K210_IDLESTACK_BASE _ebss
|
||||
#endif
|
||||
|
||||
#define K210_IDLESTACK_SIZE (CONFIG_IDLETHREAD_STACKSIZE & ~7)
|
||||
|
||||
#define K210_IDLESTACK0_TOP (K210_IDLESTACK_BASE + K210_IDLESTACK_SIZE)
|
||||
#define K210_IDLESTACK1_TOP (K210_IDLESTACK0_TOP + K210_IDLESTACK_SIZE)
|
||||
#define K210_IDLESTACK0_TOP (K210_IDLESTACK_BASE + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
#define K210_IDLESTACK1_TOP (K210_IDLESTACK0_TOP + CONFIG_IDLETHREAD_STACKSIZE)
|
||||
|
||||
#define K210_IDLESTACK_TOP (K210_IDLESTACK1_TOP)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user