mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
xtensa:backtrace: flush to stack when in interrupt
The registers may be in window when in interrupt. Flush window stack to stack first. And fix warning in build. Change-Id: I45f3a8e6aa4f8baa1d54871a02bd6defc8915144
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
|
||||
/* Convert return address to a valid pc */
|
||||
|
||||
#define MAKE_PC_FROM_RA(ra) ((ra) & 0x3fffffff)
|
||||
#define MAKE_PC_FROM_RA(ra) (uintptr_t *)((ra) & 0x3fffffff)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@@ -52,6 +52,13 @@ struct xtensa_windowregs_s
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void inline get_window_regs(struct xtensa_windowregs_s *frame)
|
||||
inline_function;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@@ -66,7 +73,6 @@ struct xtensa_windowregs_s
|
||||
|
||||
#ifndef __XTENSA_CALL0_ABI__
|
||||
static void get_window_regs(struct xtensa_windowregs_s *frame)
|
||||
inline_function
|
||||
{
|
||||
__asm__ __volatile__("\trsr %0, WINDOWSTART\n": "=r"(frame->windowstart));
|
||||
__asm__ __volatile__("\trsr %0, WINDOWBASE\n": "=r"(frame->windowbase));
|
||||
@@ -125,7 +131,7 @@ static int backtrace_window(FAR uintptr_t *base, FAR uintptr_t *limit,
|
||||
ra = frame->areg[index * 4];
|
||||
sp = frame->areg[index * 4 + 1];
|
||||
|
||||
if (sp > limit || sp < base || ra == 0)
|
||||
if (sp > (uint32_t)limit || sp < (uint32_t)base || ra == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -219,6 +225,8 @@ int up_backtrace(FAR struct tcb_s *tcb, FAR void **buffer, int size)
|
||||
{
|
||||
if (up_interrupt_context())
|
||||
{
|
||||
xtensa_window_spill();
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
uintptr_t istackbase;
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
Reference in New Issue
Block a user