ARMv7-A: Improvements to assertion output for kernel mode
This commit is contained in:
parent
f9ec764553
commit
8c3528183b
@ -194,6 +194,9 @@ static void up_dumpstate(void)
|
|||||||
uint32_t istackbase;
|
uint32_t istackbase;
|
||||||
uint32_t istacksize;
|
uint32_t istacksize;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_ARCH_KERNEL_STACK
|
||||||
|
uint32_t kstackbase = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get the limits on the user stack memory */
|
/* Get the limits on the user stack memory */
|
||||||
|
|
||||||
@ -208,47 +211,23 @@ static void up_dumpstate(void)
|
|||||||
ustacksize = (uint32_t)rtcb->adj_stack_size;
|
ustacksize = (uint32_t)rtcb->adj_stack_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the limits on the interrupt stack memory */
|
lldbg("Current sp: %08x\n", sp);
|
||||||
|
|
||||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||||
|
/* Get the limits on the interrupt stack memory */
|
||||||
|
|
||||||
istackbase = (uint32_t)&g_intstackbase;
|
istackbase = (uint32_t)&g_intstackbase;
|
||||||
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3);
|
||||||
|
|
||||||
/* Show interrupt stack info */
|
/* Show interrupt stack info */
|
||||||
|
|
||||||
lldbg("sp: %08x\n", sp);
|
lldbg("Interrupt stack:\n");
|
||||||
lldbg("IRQ stack:\n");
|
|
||||||
lldbg(" base: %08x\n", istackbase);
|
lldbg(" base: %08x\n", istackbase);
|
||||||
lldbg(" size: %08x\n", istacksize);
|
lldbg(" size: %08x\n", istacksize);
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
#ifdef CONFIG_DEBUG_STACK
|
||||||
lldbg(" used: %08x\n", up_check_intstack());
|
lldbg(" used: %08x\n", up_check_intstack());
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
/* Does the current stack pointer lie within the interrupt
|
|
||||||
* stack?
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (sp > istackbase || sp <= istackbase - istacksize)
|
|
||||||
{
|
|
||||||
if (up_interrupt_context())
|
|
||||||
{
|
|
||||||
lldbg("ERROR: Stack pointer is not within interrupt stack\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sp <= istackbase && sp > istackbase - istacksize)
|
|
||||||
{
|
|
||||||
/* Yes.. dump the interrupt stack */
|
|
||||||
|
|
||||||
up_stackdump(sp, istackbase);
|
|
||||||
|
|
||||||
/* Extract the user stack pointer which should lie
|
|
||||||
* at the base of the interrupt stack.
|
|
||||||
*/
|
|
||||||
|
|
||||||
sp = g_intstackbase;
|
|
||||||
lldbg("sp: %08x\n", sp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Show user stack info */
|
/* Show user stack info */
|
||||||
|
|
||||||
@ -259,33 +238,60 @@ static void up_dumpstate(void)
|
|||||||
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
lldbg(" used: %08x\n", up_check_tcbstack(rtcb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#ifdef CONFIG_ARCH_KERNEL_STACK
|
||||||
lldbg("sp: %08x\n", sp);
|
/* This this thread have a kernel stack allocated? */
|
||||||
lldbg("stack base: %08x\n", ustackbase);
|
|
||||||
lldbg("stack size: %08x\n", ustacksize);
|
if (rtcb->xcp.kstack)
|
||||||
#ifdef CONFIG_DEBUG_STACK
|
{
|
||||||
lldbg("stack used: %08x\n", up_check_tcbstack(rtcb));
|
uint32_t kstackbase = (uint32_t)rtcb->xcp.kstack + CONFIG_ARCH_KERNEL_STACKSIZE - 4;
|
||||||
|
|
||||||
|
lldbg("Kernel stack:\n");
|
||||||
|
lldbg(" base: %08x\n", kstackbase);
|
||||||
|
lldbg(" size: %08x\n", CONFIG_ARCH_KERNEL_STACKSIZE);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||||
|
/* Does the current stack pointer lie within the interrupt stack? */
|
||||||
|
|
||||||
|
if (sp > istackbase - istacksize && sp < istackbase)
|
||||||
|
{
|
||||||
|
/* Yes.. dump the interrupt stack */
|
||||||
|
|
||||||
|
lldbg("Interrupt Stack\n", sp);
|
||||||
|
up_stackdump(sp, istackbase);
|
||||||
|
|
||||||
|
/* Extract the user stack pointer which should lie
|
||||||
|
* at the base of the interrupt stack.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sp = g_intstackbase;
|
||||||
|
lldbg("User sp: %08x\n", sp);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Dump the user stack if the stack pointer lies within the allocated user
|
/* Dump the user stack if the stack pointer lies within the allocated user
|
||||||
* stack memory.
|
* stack memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (sp > ustackbase || sp <= ustackbase - ustacksize)
|
if (sp > ustackbase - ustacksize && sp < ustackbase)
|
||||||
{
|
|
||||||
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
|
|
||||||
if (!up_interrupt_context())
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
lldbg("ERROR: Stack pointer is not within allocated stack\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
lldbg("User Stack\n", sp);
|
||||||
up_stackdump(sp, ustackbase);
|
up_stackdump(sp, ustackbase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_KERNEL_STACK
|
||||||
|
/* Dump the user stack if the stack pointer lies within the allocated
|
||||||
|
* kernel stack memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (sp >= (uint32_t)rtcb->xcp.kstack && sp < kstackbase)
|
||||||
|
{
|
||||||
|
lldbg("Kernel Stack\n", sp);
|
||||||
|
up_stackdump(sp, kstackbase);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Then dump the registers (if available) */
|
/* Then dump the registers (if available) */
|
||||||
|
|
||||||
up_registerdump();
|
up_registerdump();
|
||||||
|
Loading…
Reference in New Issue
Block a user