arch: Rename g_intstackbase to g_intstacktop
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
97e6d35c3a
commit
8640d82ce0
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()];
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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()];
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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()];
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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()];
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -47,7 +47,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
.global g_intstackbase
|
||||
.global g_intstackalloc
|
||||
.global g_intstacktop
|
||||
.global g_nestlevel
|
||||
#endif
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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) */
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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) */
|
||||
|
@ -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
|
||||
|
@ -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) */
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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()];
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user