stack: update up_get_intstackbase API to support cpu id

For crash dump all the CPU intstack

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2024-03-28 17:57:03 +08:00
committed by Alan Carvalho de Assis
parent 93beeeeab0
commit 3844efb5b8
50 changed files with 137 additions and 125 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ void up_initial_state(struct tcb_s *tcb)
noinline_function void arm_initialize_stack(void) noinline_function void arm_initialize_stack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
uint32_t stack = (uint32_t)arm_intstack_top(); uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index());
#else #else
uint32_t stack = (uint32_t)g_intstacktop; uint32_t stack = (uint32_t)g_intstacktop;
#endif #endif
+1 -1
View File
@@ -181,7 +181,7 @@ void up_initial_state(struct tcb_s *tcb)
noinline_function void arm_initialize_stack(void) noinline_function void arm_initialize_stack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
uint32_t stack = (uint32_t)arm_intstack_top(); uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index());
#else #else
uint32_t stack = (uint32_t)g_intstacktop; uint32_t stack = (uint32_t)g_intstacktop;
#endif #endif
+2 -2
View File
@@ -187,9 +187,9 @@ void up_initial_state(struct tcb_s *tcb)
noinline_function void arm_initialize_stack(void) noinline_function void arm_initialize_stack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
uint32_t stack = (uint32_t)arm_intstack_top(); uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index());
#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE #ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE
uint32_t stacklim = (uint32_t)arm_intstack_alloc(); uint32_t stacklim = (uint32_t)arm_intstack_alloc(up_cpu_index());
#endif #endif
#else #else
uint32_t stack = (uint32_t)g_intstacktop; uint32_t stack = (uint32_t)g_intstacktop;
+1 -1
View File
@@ -122,7 +122,7 @@ int up_backtrace(struct tcb_s *tcb,
{ {
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
# ifdef CONFIG_SMP # ifdef CONFIG_SMP
istacklimit = (void *)arm_intstack_top(); istacklimit = (void *)arm_intstack_top(up_cpu_index());
# else # else
istacklimit = g_intstacktop; istacklimit = g_intstacktop;
# endif /* CONFIG_SMP */ # endif /* CONFIG_SMP */
+1 -1
View File
@@ -260,7 +260,7 @@ int up_backtrace(struct tcb_s *tcb,
unsigned long top; unsigned long top;
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
# ifdef CONFIG_SMP # ifdef CONFIG_SMP
top = arm_intstack_top(); top = arm_intstack_top(up_cpu_index());
# else # else
top = (unsigned long)g_intstacktop; top = (unsigned long)g_intstacktop;
# endif /* CONFIG_SMP */ # endif /* CONFIG_SMP */
+1 -1
View File
@@ -725,7 +725,7 @@ int up_backtrace(struct tcb_s *tcb,
{ {
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
# ifdef CONFIG_SMP # ifdef CONFIG_SMP
frame.stack_top = arm_intstack_top(); frame.stack_top = arm_intstack_top(up_cpu_index());
# else # else
frame.stack_top = (unsigned long)&g_intstacktop; frame.stack_top = (unsigned long)&g_intstacktop;
# endif /* CONFIG_SMP */ # endif /* CONFIG_SMP */
+2 -2
View File
@@ -224,9 +224,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
} }
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
return arm_stack_check((void *)up_get_intstackbase(), return arm_stack_check((void *)up_get_intstackbase(cpu),
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
} }
#endif #endif
+2 -2
View File
@@ -37,10 +37,10 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
return arm_intstack_alloc(); return arm_intstack_alloc(cpu);
#else #else
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
#endif #endif
+1 -1
View File
@@ -57,7 +57,7 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS];
static inline void arm_color_intstack(void) static inline void arm_color_intstack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
uint32_t *ptr = (uint32_t *)arm_intstack_alloc(); uint32_t *ptr = (uint32_t *)arm_intstack_alloc(up_cpu_index());
#else #else
uint32_t *ptr = (uint32_t *)g_intstackalloc; uint32_t *ptr = (uint32_t *)g_intstackalloc;
#endif #endif
+2 -2
View File
@@ -350,8 +350,8 @@ void arm_pminitialize(void);
/* Interrupt handling *******************************************************/ /* Interrupt handling *******************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void); uintptr_t arm_intstack_alloc(int cpu);
uintptr_t arm_intstack_top(void); uintptr_t arm_intstack_top(int cpu);
#endif #endif
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
+4 -4
View File
@@ -582,9 +582,9 @@ int up_prioritize_irq(int irq, int priority)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(void) uintptr_t arm_intstack_top(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()]; return g_cpu_intstack_top[cpu];
} }
#endif #endif
@@ -598,8 +598,8 @@ uintptr_t arm_intstack_top(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void) uintptr_t arm_intstack_alloc(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
+5 -4
View File
@@ -136,10 +136,11 @@ void up_irqinitialize(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(void) uintptr_t arm_intstack_top(int cpu)
{ {
return g_irqstack_top[up_cpu_index()]; return g_irqstack_top[cpu];
} }
#endif #endif
/**************************************************************************** /****************************************************************************
@@ -152,8 +153,8 @@ uintptr_t arm_intstack_top(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void) uintptr_t arm_intstack_alloc(int cpu)
{ {
return g_irqstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_irqstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
+4 -4
View File
@@ -161,9 +161,9 @@ void up_irqinitialize(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(void) uintptr_t arm_intstack_top(int cpu)
{ {
return g_irqstack_top[up_cpu_index()]; return g_irqstack_top[cpu];
} }
#endif #endif
@@ -177,8 +177,8 @@ uintptr_t arm_intstack_top(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void) uintptr_t arm_intstack_alloc(int cpu)
{ {
return g_irqstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_irqstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
+4 -4
View File
@@ -829,9 +829,9 @@ int lc823450_irq_register(int irq, struct lc823450_irq_ops *ops)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(void) uintptr_t arm_intstack_top(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()]; return g_cpu_intstack_top[cpu];
} }
#endif #endif
@@ -845,8 +845,8 @@ uintptr_t arm_intstack_top(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void) uintptr_t arm_intstack_alloc(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
+4 -4
View File
@@ -136,9 +136,9 @@ void up_irqinitialize(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(void) uintptr_t arm_intstack_top(int cpu)
{ {
return g_irqstack_top[up_cpu_index()]; return g_irqstack_top[cpu];
} }
#endif #endif
@@ -152,8 +152,8 @@ uintptr_t arm_intstack_top(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void) uintptr_t arm_intstack_alloc(int cpu)
{ {
return g_irqstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_irqstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
+4 -4
View File
@@ -447,9 +447,9 @@ int up_prioritize_irq(int irq, int priority)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_top(void) uintptr_t arm_intstack_top(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()]; return g_cpu_intstack_top[cpu];
} }
#endif #endif
@@ -463,8 +463,8 @@ uintptr_t arm_intstack_top(void)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t arm_intstack_alloc(void) uintptr_t arm_intstack_alloc(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
+1 -1
View File
@@ -477,7 +477,7 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
ret = backtrace_push( ret = backtrace_push(
# ifdef CONFIG_SMP # ifdef CONFIG_SMP
arm_intstack_top(), arm_intstack_top(up_cpu_index()),
# else # else
g_intstacktop, g_intstacktop,
# endif /* CONFIG_SMP */ # endif /* CONFIG_SMP */
+1 -1
View File
@@ -132,7 +132,7 @@ int up_backtrace(struct tcb_s *tcb,
{ {
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
# ifdef CONFIG_SMP # ifdef CONFIG_SMP
istacklimit = (void *)arm64_intstack_top(); istacklimit = (void *)arm64_intstack_top(up_cpu_index());
# else # else
istacklimit = g_interrupt_stack + INTSTACK_SIZE; istacklimit = g_interrupt_stack + INTSTACK_SIZE;
# endif /* CONFIG_SMP */ # endif /* CONFIG_SMP */
+2 -2
View File
@@ -202,9 +202,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
} }
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
return arm64_stack_check((void *)up_get_intstackbase(), return arm64_stack_check((void *)up_get_intstackbase(cpu),
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
} }
#endif #endif
+2 -2
View File
@@ -37,10 +37,10 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
return arm64_intstack_alloc(); return arm64_intstack_alloc(cpu);
#else #else
return (uintptr_t)g_interrupt_stack; return (uintptr_t)g_interrupt_stack;
#endif #endif
+4 -4
View File
@@ -103,9 +103,9 @@ INIT_STACK_DEFINE(g_interrupt_fiq_stack, INTSTACK_SIZE);
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
uintptr_t arm64_intstack_alloc(void) uintptr_t arm64_intstack_alloc(int cpu)
{ {
return (uintptr_t)(g_interrupt_stacks[up_cpu_index()]); return (uintptr_t)(g_interrupt_stacks[cpu]);
} }
/**************************************************************************** /****************************************************************************
@@ -117,9 +117,9 @@ uintptr_t arm64_intstack_alloc(void)
* *
****************************************************************************/ ****************************************************************************/
uintptr_t arm64_intstack_top(void) uintptr_t arm64_intstack_top(int cpu)
{ {
return (uintptr_t)(g_interrupt_stacks[up_cpu_index()] + INTSTACK_SIZE); return (uintptr_t)(g_interrupt_stacks[cpu] + INTSTACK_SIZE);
} }
#endif #endif
+2 -2
View File
@@ -168,8 +168,8 @@ INIT_STACK_ARRAY_DEFINE_EXTERN(g_interrupt_fiq_stacks, CONFIG_SMP_NCPUS,
INTSTACK_SIZE); INTSTACK_SIZE);
#endif #endif
uintptr_t arm64_intstack_alloc(void); uintptr_t arm64_intstack_alloc(int cpu);
uintptr_t arm64_intstack_top(void); uintptr_t arm64_intstack_top(int cpu);
#else #else
/* idle thread stack for primary core */ /* idle thread stack for primary core */
+1 -1
View File
@@ -149,7 +149,7 @@ size_t up_check_tcbstack(FAR struct tcb_s *tcb)
} }
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
uintptr_t start = (uintptr_t)g_intstackalloc; uintptr_t start = (uintptr_t)g_intstackalloc;
return avr_stack_check(start, CONFIG_ARCH_INTERRUPTSTACK & ~3); return avr_stack_check(start, CONFIG_ARCH_INTERRUPTSTACK & ~3);
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+1 -1
View File
@@ -143,7 +143,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
tcb->adj_stack_size); tcb->adj_stack_size);
} }
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
return ceva_stack_check((uintptr_t)g_intstackalloc, return ceva_stack_check((uintptr_t)g_intstackalloc,
g_intstackbase - g_intstackalloc); g_intstackbase - g_intstackalloc);
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+1 -1
View File
@@ -120,7 +120,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
} }
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
return or1k_stack_check((uintptr_t)g_intstackalloc, return or1k_stack_check((uintptr_t)g_intstackalloc,
(CONFIG_ARCH_INTERRUPTSTACK & ~3)); (CONFIG_ARCH_INTERRUPTSTACK & ~3));
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+1 -1
View File
@@ -181,7 +181,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
} }
#if CONFIG_ARCH_INTERRUPTSTACK > 15 #if CONFIG_ARCH_INTERRUPTSTACK > 15
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
return riscv_stack_check((uintptr_t)g_intstackalloc, return riscv_stack_check((uintptr_t)g_intstackalloc,
(CONFIG_ARCH_INTERRUPTSTACK & ~15)); (CONFIG_ARCH_INTERRUPTSTACK & ~15));
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+2 -2
View File
@@ -204,9 +204,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
} }
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
return sparc_stack_check((void *)sparc_intstack_alloc(), return sparc_stack_check((void *)sparc_intstack_alloc(cpu),
STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)); STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));
} }
#endif #endif
+2 -2
View File
@@ -37,8 +37,8 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)sparc_intstack_alloc(); return (uintptr_t)sparc_intstack_alloc(cpu);
} }
#endif #endif
+1 -1
View File
@@ -103,7 +103,7 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS];
#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7 #if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7
static inline void up_color_intstack(void) static inline void up_color_intstack(void)
{ {
uint32_t *ptr = (uint32_t *)sparc_intstack_alloc(); uint32_t *ptr = (uint32_t *)sparc_intstack_alloc(up_cpu_index());
ssize_t size; ssize_t size;
for (size = ((CONFIG_ARCH_INTERRUPTSTACK & ~7) * CONFIG_SMP_NCPUS); for (size = ((CONFIG_ARCH_INTERRUPTSTACK & ~7) * CONFIG_SMP_NCPUS);
+2 -2
View File
@@ -198,8 +198,8 @@ void sparc_sigdeliver(void);
/* Interrupt handling *******************************************************/ /* Interrupt handling *******************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t sparc_intstack_alloc(void); uintptr_t sparc_intstack_alloc(int cpu);
uintptr_t sparc_intstack_top(void); uintptr_t sparc_intstack_top(int cpu);
#endif #endif
/* Chip-specific functions **************************************************/ /* Chip-specific functions **************************************************/
+4 -4
View File
@@ -508,10 +508,10 @@ int up_prioritize_irq(int irq, int priority)
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t sparc_intstack_top(void) uintptr_t sparc_intstack_top(int cpu)
{ {
#if defined(CONFIG_SMP) #if defined(CONFIG_SMP)
return g_cpu_intstack_top[up_cpu_index()]; return g_cpu_intstack_top[cpu];
#else #else
return g_cpu_intstack_top[0]; return g_cpu_intstack_top[0];
#endif #endif
@@ -528,10 +528,10 @@ uintptr_t sparc_intstack_top(void)
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7 #if CONFIG_ARCH_INTERRUPTSTACK > 7
uintptr_t sparc_intstack_alloc(void) uintptr_t sparc_intstack_alloc(int cpu)
{ {
#if defined(CONFIG_SMP) #if defined(CONFIG_SMP)
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
#else #else
return g_cpu_intstack_top[0] - INTSTACK_SIZE; return g_cpu_intstack_top[0] - INTSTACK_SIZE;
#endif #endif
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+1 -1
View File
@@ -37,7 +37,7 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
} }
+2 -2
View File
@@ -230,8 +230,8 @@ void xtensa_window_spill(void);
/* IRQs */ /* IRQs */
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
uintptr_t xtensa_intstack_alloc(void); uintptr_t xtensa_intstack_alloc(int cpu);
uintptr_t xtensa_intstack_top(void); uintptr_t xtensa_intstack_top(int cpu);
#endif #endif
uint32_t *xtensa_int_decode(uint32_t cpuints, uint32_t *regs); uint32_t *xtensa_int_decode(uint32_t cpuints, uint32_t *regs);
+1 -1
View File
@@ -237,7 +237,7 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
#if CONFIG_ARCH_INTERRUPTSTACK > 15 #if CONFIG_ARCH_INTERRUPTSTACK > 15
void *istackbase; void *istackbase;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
istackbase = xtensa_intstack_alloc(); istackbase = xtensa_intstack_alloc(up_cpu_index());
#else #else
istackbase = g_intstackalloc; istackbase = g_intstackalloc;
#endif #endif
+2 -2
View File
@@ -163,9 +163,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
} }
#if CONFIG_ARCH_INTERRUPTSTACK > 15 #if CONFIG_ARCH_INTERRUPTSTACK > 15
size_t up_check_intstack(void) size_t up_check_intstack(int cpu)
{ {
return xtensa_stack_check(up_get_intstackbase(), INTSTACK_SIZE); return xtensa_stack_check(up_get_intstackbase(cpu), INTSTACK_SIZE);
} }
#endif #endif
+2 -2
View File
@@ -37,10 +37,10 @@
****************************************************************************/ ****************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 3 #if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void) uintptr_t up_get_intstackbase(int cpu)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
return (uintptr_t)xtensa_intstack_alloc(); return (uintptr_t)xtensa_intstack_alloc(cpu);
#else #else
return (uintptr_t)g_intstackalloc; return (uintptr_t)g_intstackalloc;
#endif #endif
+1 -1
View File
@@ -61,7 +61,7 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS];
static inline void xtensa_color_intstack(void) static inline void xtensa_color_intstack(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
uint32_t *ptr = (uint32_t *)xtensa_intstack_alloc(); uint32_t *ptr = (uint32_t *)xtensa_intstack_alloc(up_cpu_index());
#else #else
uint32_t *ptr = (uint32_t *)g_intstackalloc; uint32_t *ptr = (uint32_t *)g_intstackalloc;
#endif #endif
+4 -4
View File
@@ -749,9 +749,9 @@ void up_enable_irq(int irq)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
uintptr_t xtensa_intstack_top(void) uintptr_t xtensa_intstack_top(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()]; return g_cpu_intstack_top[cpu];
} }
/**************************************************************************** /****************************************************************************
@@ -763,9 +763,9 @@ uintptr_t xtensa_intstack_top(void)
* *
****************************************************************************/ ****************************************************************************/
uintptr_t xtensa_intstack_alloc(void) uintptr_t xtensa_intstack_alloc(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
+4 -4
View File
@@ -696,9 +696,9 @@ void up_enable_irq(int irq)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15 #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
uintptr_t xtensa_intstack_top(void) uintptr_t xtensa_intstack_top(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()]; return g_cpu_intstack_top[cpu];
} }
/**************************************************************************** /****************************************************************************
@@ -710,9 +710,9 @@ uintptr_t xtensa_intstack_top(void)
* *
****************************************************************************/ ****************************************************************************/
uintptr_t xtensa_intstack_alloc(void) uintptr_t xtensa_intstack_alloc(int cpu)
{ {
return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE; return g_cpu_intstack_top[cpu] - INTSTACK_SIZE;
} }
#endif #endif
@@ -187,7 +187,8 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb,
/* Get the limits on the interrupt stack memory */ /* Get the limits on the interrupt stack memory */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
pdump->info.stacks.interrupt.top = (uint32_t)arm_intstack_top(); pdump->info.stacks.interrupt.top =
(uint32_t)arm_intstack_top(up_cpu_index());
#else #else
pdump->info.stacks.interrupt.top = (uint32_t)g_intstacktop; pdump->info.stacks.interrupt.top = (uint32_t)g_intstacktop;
#endif #endif
+2 -2
View File
@@ -2536,12 +2536,12 @@ void irq_dispatch(int irq, FAR void *context);
struct tcb_s; struct tcb_s;
size_t up_check_tcbstack(FAR struct tcb_s *tcb); size_t up_check_tcbstack(FAR struct tcb_s *tcb);
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3 #if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
size_t up_check_intstack(void); size_t up_check_intstack(int cpu);
#endif #endif
#endif #endif
#if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3 #if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(void); uintptr_t up_get_intstackbase(int cpu);
#endif #endif
/**************************************************************************** /****************************************************************************
+42 -32
View File
@@ -194,7 +194,7 @@ static void dump_stack(FAR const char *tag, uintptr_t sp,
static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp) static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp)
{ {
#if CONFIG_ARCH_INTERRUPTSTACK > 0 #if CONFIG_ARCH_INTERRUPTSTACK > 0
uintptr_t intstack_base = up_get_intstackbase(); uintptr_t intstack_base = up_get_intstackbase(up_cpu_index());
size_t intstack_size = CONFIG_ARCH_INTERRUPTSTACK; size_t intstack_size = CONFIG_ARCH_INTERRUPTSTACK;
uintptr_t intstack_top = intstack_base + intstack_size; uintptr_t intstack_top = intstack_base + intstack_size;
uintptr_t intstack_sp = 0; uintptr_t intstack_sp = 0;
@@ -243,7 +243,7 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp)
intstack_base, intstack_base,
intstack_size, intstack_size,
#ifdef CONFIG_STACK_COLORATION #ifdef CONFIG_STACK_COLORATION
up_check_intstack() up_check_intstack(up_cpu_index())
#else #else
0 0
#endif #endif
@@ -405,17 +405,8 @@ static void dump_backtrace(FAR struct tcb_s *tcb, FAR void *arg)
static void dump_tasks(void) static void dump_tasks(void)
{ {
#if CONFIG_ARCH_INTERRUPTSTACK > 0 && defined(CONFIG_STACK_COLORATION) #if CONFIG_ARCH_INTERRUPTSTACK > 0
size_t stack_used = up_check_intstack(); int cpu;
size_t stack_filled = 0;
if (stack_used > 0)
{
/* Use fixed-point math with one decimal place */
stack_filled = 10 * 100 *
stack_used / CONFIG_ARCH_INTERRUPTSTACK;
}
#endif #endif
/* Dump interesting properties of each task in the crash environment */ /* Dump interesting properties of each task in the crash environment */
@@ -438,31 +429,50 @@ static void dump_tasks(void)
" COMMAND\n"); " COMMAND\n");
#if CONFIG_ARCH_INTERRUPTSTACK > 0 #if CONFIG_ARCH_INTERRUPTSTACK > 0
_alert(" ---- ---" for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
# ifdef CONFIG_SMP {
" ----"
# endif
" --- --------"
" ------- ---"
" ------- ----------"
" ----------------"
" %p"
" %7u"
# ifdef CONFIG_STACK_COLORATION # ifdef CONFIG_STACK_COLORATION
" %7zu %3zu.%1zu%%%c" size_t stack_used = up_check_intstack(cpu);
size_t stack_filled = 0;
if (stack_used > 0)
{
/* Use fixed-point math with one decimal place */
stack_filled = 10 * 100 *
stack_used / CONFIG_ARCH_INTERRUPTSTACK;
}
# endif
_alert(" ---- ---"
# ifdef CONFIG_SMP
" %4d"
# endif
" --- --------"
" ------- ---"
" ------- ----------"
" ----------------"
" %p"
" %7u"
# ifdef CONFIG_STACK_COLORATION
" %7zu %3zu.%1zu%%%c"
# endif # endif
# ifndef CONFIG_SCHED_CPULOAD_NONE # ifndef CONFIG_SCHED_CPULOAD_NONE
" ----" " ----"
# endif # endif
" irq\n" " irq\n"
, (FAR void *)up_get_intstackbase() #ifdef CONFIG_SMP
, CONFIG_ARCH_INTERRUPTSTACK , cpu
#endif
, (FAR void *)up_get_intstackbase(cpu)
, CONFIG_ARCH_INTERRUPTSTACK
# ifdef CONFIG_STACK_COLORATION # ifdef CONFIG_STACK_COLORATION
, stack_used , stack_used
, stack_filled / 10, stack_filled % 10, , stack_filled / 10, stack_filled % 10,
(stack_filled >= 10 * 80 ? '!' : ' ') (stack_filled >= 10 * 80 ? '!' : ' ')
# endif # endif
); );
}
#endif #endif
nxsched_foreach(dump_task, NULL); nxsched_foreach(dump_task, NULL);