diff --git a/arch/arm/src/armv6-m/arm_initialstate.c b/arch/arm/src/armv6-m/arm_initialstate.c index b52c8f3f9b..6e5683a074 100644 --- a/arch/arm/src/armv6-m/arm_initialstate.c +++ b/arch/arm/src/armv6-m/arm_initialstate.c @@ -158,7 +158,7 @@ void up_initial_state(struct tcb_s *tcb) noinline_function void arm_initialize_stack(void) { #ifdef CONFIG_SMP - uint32_t stack = (uint32_t)arm_intstack_top(); + uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index()); #else uint32_t stack = (uint32_t)g_intstacktop; #endif diff --git a/arch/arm/src/armv7-m/arm_initialstate.c b/arch/arm/src/armv7-m/arm_initialstate.c index fe42f23344..3522023280 100644 --- a/arch/arm/src/armv7-m/arm_initialstate.c +++ b/arch/arm/src/armv7-m/arm_initialstate.c @@ -181,7 +181,7 @@ void up_initial_state(struct tcb_s *tcb) noinline_function void arm_initialize_stack(void) { #ifdef CONFIG_SMP - uint32_t stack = (uint32_t)arm_intstack_top(); + uint32_t stack = (uint32_t)arm_intstack_top(up_cpu_index()); #else uint32_t stack = (uint32_t)g_intstacktop; #endif diff --git a/arch/arm/src/armv8-m/arm_initialstate.c b/arch/arm/src/armv8-m/arm_initialstate.c index 536f464b28..5ad62a4ffd 100644 --- a/arch/arm/src/armv8-m/arm_initialstate.c +++ b/arch/arm/src/armv8-m/arm_initialstate.c @@ -187,9 +187,9 @@ void up_initial_state(struct tcb_s *tcb) noinline_function void arm_initialize_stack(void) { #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 - uint32_t stacklim = (uint32_t)arm_intstack_alloc(); + uint32_t stacklim = (uint32_t)arm_intstack_alloc(up_cpu_index()); #endif #else uint32_t stack = (uint32_t)g_intstacktop; diff --git a/arch/arm/src/common/arm_backtrace_fp.c b/arch/arm/src/common/arm_backtrace_fp.c index 85c62f23ce..e186ede50b 100644 --- a/arch/arm/src/common/arm_backtrace_fp.c +++ b/arch/arm/src/common/arm_backtrace_fp.c @@ -122,7 +122,7 @@ int up_backtrace(struct tcb_s *tcb, { #if CONFIG_ARCH_INTERRUPTSTACK > 7 # ifdef CONFIG_SMP - istacklimit = (void *)arm_intstack_top(); + istacklimit = (void *)arm_intstack_top(up_cpu_index()); # else istacklimit = g_intstacktop; # endif /* CONFIG_SMP */ diff --git a/arch/arm/src/common/arm_backtrace_sp.c b/arch/arm/src/common/arm_backtrace_sp.c index 47ec8f324e..155d09306a 100644 --- a/arch/arm/src/common/arm_backtrace_sp.c +++ b/arch/arm/src/common/arm_backtrace_sp.c @@ -260,7 +260,7 @@ int up_backtrace(struct tcb_s *tcb, unsigned long top; #if CONFIG_ARCH_INTERRUPTSTACK > 7 # ifdef CONFIG_SMP - top = arm_intstack_top(); + top = arm_intstack_top(up_cpu_index()); # else top = (unsigned long)g_intstacktop; # endif /* CONFIG_SMP */ diff --git a/arch/arm/src/common/arm_backtrace_unwind.c b/arch/arm/src/common/arm_backtrace_unwind.c index 9369f91615..f3b281be83 100644 --- a/arch/arm/src/common/arm_backtrace_unwind.c +++ b/arch/arm/src/common/arm_backtrace_unwind.c @@ -725,7 +725,7 @@ int up_backtrace(struct tcb_s *tcb, { #if CONFIG_ARCH_INTERRUPTSTACK > 7 # ifdef CONFIG_SMP - frame.stack_top = arm_intstack_top(); + frame.stack_top = arm_intstack_top(up_cpu_index()); # else frame.stack_top = (unsigned long)&g_intstacktop; # endif /* CONFIG_SMP */ diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c index dd4b53d5cb..7f3c6415dd 100644 --- a/arch/arm/src/common/arm_checkstack.c +++ b/arch/arm/src/common/arm_checkstack.c @@ -224,9 +224,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb) } #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)); } #endif diff --git a/arch/arm/src/common/arm_getintstack.c b/arch/arm/src/common/arm_getintstack.c index b2617d79fe..aede34785c 100644 --- a/arch/arm/src/common/arm_getintstack.c +++ b/arch/arm/src/common/arm_getintstack.c @@ -37,10 +37,10 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { #ifdef CONFIG_SMP - return arm_intstack_alloc(); + return arm_intstack_alloc(cpu); #else return (uintptr_t)g_intstackalloc; #endif diff --git a/arch/arm/src/common/arm_initialize.c b/arch/arm/src/common/arm_initialize.c index c86621280b..cda1d3cd19 100644 --- a/arch/arm/src/common/arm_initialize.c +++ b/arch/arm/src/common/arm_initialize.c @@ -57,7 +57,7 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS]; static inline void arm_color_intstack(void) { #ifdef CONFIG_SMP - uint32_t *ptr = (uint32_t *)arm_intstack_alloc(); + uint32_t *ptr = (uint32_t *)arm_intstack_alloc(up_cpu_index()); #else uint32_t *ptr = (uint32_t *)g_intstackalloc; #endif diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h index 0ca9494212..af630958b2 100644 --- a/arch/arm/src/common/arm_internal.h +++ b/arch/arm/src/common/arm_internal.h @@ -350,8 +350,8 @@ void arm_pminitialize(void); /* Interrupt handling *******************************************************/ #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7 -uintptr_t arm_intstack_alloc(void); -uintptr_t arm_intstack_top(void); +uintptr_t arm_intstack_alloc(int cpu); +uintptr_t arm_intstack_top(int cpu); #endif #if CONFIG_ARCH_INTERRUPTSTACK > 7 diff --git a/arch/arm/src/cxd56xx/cxd56_irq.c b/arch/arm/src/cxd56xx/cxd56_irq.c index 5885ed53fe..dd91915844 100644 --- a/arch/arm/src/cxd56xx/cxd56_irq.c +++ b/arch/arm/src/cxd56xx/cxd56_irq.c @@ -582,9 +582,9 @@ int up_prioritize_irq(int irq, int priority) ****************************************************************************/ #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 @@ -598,8 +598,8 @@ uintptr_t arm_intstack_top(void) ****************************************************************************/ #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 diff --git a/arch/arm/src/goldfish/goldfish_irq.c b/arch/arm/src/goldfish/goldfish_irq.c index b06b09b97e..b47166b80b 100644 --- a/arch/arm/src/goldfish/goldfish_irq.c +++ b/arch/arm/src/goldfish/goldfish_irq.c @@ -136,10 +136,11 @@ void up_irqinitialize(void) ****************************************************************************/ #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 /**************************************************************************** @@ -152,8 +153,8 @@ uintptr_t arm_intstack_top(void) ****************************************************************************/ #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 diff --git a/arch/arm/src/imx6/imx_irq.c b/arch/arm/src/imx6/imx_irq.c index 7fad4ff632..7bac970709 100644 --- a/arch/arm/src/imx6/imx_irq.c +++ b/arch/arm/src/imx6/imx_irq.c @@ -161,9 +161,9 @@ void up_irqinitialize(void) ****************************************************************************/ #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 @@ -177,8 +177,8 @@ uintptr_t arm_intstack_top(void) ****************************************************************************/ #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 diff --git a/arch/arm/src/lc823450/lc823450_irq.c b/arch/arm/src/lc823450/lc823450_irq.c index c64e1a3a31..92d14a90f4 100644 --- a/arch/arm/src/lc823450/lc823450_irq.c +++ b/arch/arm/src/lc823450/lc823450_irq.c @@ -829,9 +829,9 @@ int lc823450_irq_register(int irq, struct lc823450_irq_ops *ops) ****************************************************************************/ #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 @@ -845,8 +845,8 @@ uintptr_t arm_intstack_top(void) ****************************************************************************/ #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 diff --git a/arch/arm/src/qemu/qemu_irq.c b/arch/arm/src/qemu/qemu_irq.c index e69918e99e..a544f0ad46 100644 --- a/arch/arm/src/qemu/qemu_irq.c +++ b/arch/arm/src/qemu/qemu_irq.c @@ -136,9 +136,9 @@ void up_irqinitialize(void) ****************************************************************************/ #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 @@ -152,8 +152,8 @@ uintptr_t arm_intstack_top(void) ****************************************************************************/ #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 diff --git a/arch/arm/src/rp2040/rp2040_irq.c b/arch/arm/src/rp2040/rp2040_irq.c index b6d8c40f0e..a6d8013416 100644 --- a/arch/arm/src/rp2040/rp2040_irq.c +++ b/arch/arm/src/rp2040/rp2040_irq.c @@ -447,9 +447,9 @@ int up_prioritize_irq(int irq, int priority) ****************************************************************************/ #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 @@ -463,8 +463,8 @@ uintptr_t arm_intstack_top(void) ****************************************************************************/ #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 diff --git a/arch/arm/src/tlsr82/tc32/tc32_backtrace.c b/arch/arm/src/tlsr82/tc32/tc32_backtrace.c index 7a8dbf68fb..e60b68bcd5 100644 --- a/arch/arm/src/tlsr82/tc32/tc32_backtrace.c +++ b/arch/arm/src/tlsr82/tc32/tc32_backtrace.c @@ -477,7 +477,7 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip) #if CONFIG_ARCH_INTERRUPTSTACK > 7 ret = backtrace_push( # ifdef CONFIG_SMP - arm_intstack_top(), + arm_intstack_top(up_cpu_index()), # else g_intstacktop, # endif /* CONFIG_SMP */ diff --git a/arch/arm64/src/common/arm64_backtrace.c b/arch/arm64/src/common/arm64_backtrace.c index 3ff4e2d1b0..a655719240 100644 --- a/arch/arm64/src/common/arm64_backtrace.c +++ b/arch/arm64/src/common/arm64_backtrace.c @@ -132,7 +132,7 @@ int up_backtrace(struct tcb_s *tcb, { #if CONFIG_ARCH_INTERRUPTSTACK > 7 # ifdef CONFIG_SMP - istacklimit = (void *)arm64_intstack_top(); + istacklimit = (void *)arm64_intstack_top(up_cpu_index()); # else istacklimit = g_interrupt_stack + INTSTACK_SIZE; # endif /* CONFIG_SMP */ diff --git a/arch/arm64/src/common/arm64_checkstack.c b/arch/arm64/src/common/arm64_checkstack.c index fac5d6433b..8a39f1e199 100644 --- a/arch/arm64/src/common/arm64_checkstack.c +++ b/arch/arm64/src/common/arm64_checkstack.c @@ -202,9 +202,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb) } #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)); } #endif diff --git a/arch/arm64/src/common/arm64_getintstack.c b/arch/arm64/src/common/arm64_getintstack.c index 8da53fc19e..883f6aa01a 100644 --- a/arch/arm64/src/common/arm64_getintstack.c +++ b/arch/arm64/src/common/arm64_getintstack.c @@ -37,10 +37,10 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 7 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { #ifdef CONFIG_SMP - return arm64_intstack_alloc(); + return arm64_intstack_alloc(cpu); #else return (uintptr_t)g_interrupt_stack; #endif diff --git a/arch/arm64/src/common/arm64_initialize.c b/arch/arm64/src/common/arm64_initialize.c index 83d30c566d..72c5346fff 100644 --- a/arch/arm64/src/common/arm64_initialize.c +++ b/arch/arm64/src/common/arm64_initialize.c @@ -103,9 +103,9 @@ INIT_STACK_DEFINE(g_interrupt_fiq_stack, INTSTACK_SIZE); ****************************************************************************/ #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 diff --git a/arch/arm64/src/common/arm64_internal.h b/arch/arm64/src/common/arm64_internal.h index 0d18a3b03d..6384e1c08f 100644 --- a/arch/arm64/src/common/arm64_internal.h +++ b/arch/arm64/src/common/arm64_internal.h @@ -168,8 +168,8 @@ INIT_STACK_ARRAY_DEFINE_EXTERN(g_interrupt_fiq_stacks, CONFIG_SMP_NCPUS, INTSTACK_SIZE); #endif -uintptr_t arm64_intstack_alloc(void); -uintptr_t arm64_intstack_top(void); +uintptr_t arm64_intstack_alloc(int cpu); +uintptr_t arm64_intstack_top(int cpu); #else /* idle thread stack for primary core */ diff --git a/arch/avr/src/avr/avr_checkstack.c b/arch/avr/src/avr/avr_checkstack.c index 270fe1cb10..e53dfd37f1 100644 --- a/arch/avr/src/avr/avr_checkstack.c +++ b/arch/avr/src/avr/avr_checkstack.c @@ -149,7 +149,7 @@ size_t up_check_tcbstack(FAR struct tcb_s *tcb) } #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; return avr_stack_check(start, CONFIG_ARCH_INTERRUPTSTACK & ~3); diff --git a/arch/avr/src/common/avr_getintstack.c b/arch/avr/src/common/avr_getintstack.c index 8baceec9dd..fa2e979113 100644 --- a/arch/avr/src/common/avr_getintstack.c +++ b/arch/avr/src/common/avr_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/ceva/src/common/ceva_checkstack.c b/arch/ceva/src/common/ceva_checkstack.c index 3d0fe35914..eb0f295677 100644 --- a/arch/ceva/src/common/ceva_checkstack.c +++ b/arch/ceva/src/common/ceva_checkstack.c @@ -143,7 +143,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb) 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, g_intstackbase - g_intstackalloc); diff --git a/arch/ceva/src/common/ceva_getintstack.c b/arch/ceva/src/common/ceva_getintstack.c index 5b7ffd25f5..877eac7f66 100644 --- a/arch/ceva/src/common/ceva_getintstack.c +++ b/arch/ceva/src/common/ceva_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/hc/src/common/hc_getintstack.c b/arch/hc/src/common/hc_getintstack.c index b3d30b2859..1264c32ad1 100644 --- a/arch/hc/src/common/hc_getintstack.c +++ b/arch/hc/src/common/hc_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/mips/src/common/mips_getintstack.c b/arch/mips/src/common/mips_getintstack.c index 435f36c2a9..e019c00452 100644 --- a/arch/mips/src/common/mips_getintstack.c +++ b/arch/mips/src/common/mips_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/or1k/src/common/or1k_checkstack.c b/arch/or1k/src/common/or1k_checkstack.c index e4cde1a9d3..c317d5d039 100644 --- a/arch/or1k/src/common/or1k_checkstack.c +++ b/arch/or1k/src/common/or1k_checkstack.c @@ -120,7 +120,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb) } #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, (CONFIG_ARCH_INTERRUPTSTACK & ~3)); diff --git a/arch/or1k/src/common/or1k_getintstack.c b/arch/or1k/src/common/or1k_getintstack.c index dcfcf16075..b202eeaa41 100644 --- a/arch/or1k/src/common/or1k_getintstack.c +++ b/arch/or1k/src/common/or1k_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/renesas/src/common/renesas_getintstack.c b/arch/renesas/src/common/renesas_getintstack.c index 0e384a588c..a7e4f8219d 100644 --- a/arch/renesas/src/common/renesas_getintstack.c +++ b/arch/renesas/src/common/renesas_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/risc-v/src/common/riscv_checkstack.c b/arch/risc-v/src/common/riscv_checkstack.c index 7ab1dc1ec9..8e7d3d7736 100644 --- a/arch/risc-v/src/common/riscv_checkstack.c +++ b/arch/risc-v/src/common/riscv_checkstack.c @@ -181,7 +181,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb) } #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, (CONFIG_ARCH_INTERRUPTSTACK & ~15)); diff --git a/arch/risc-v/src/common/riscv_getintstack.c b/arch/risc-v/src/common/riscv_getintstack.c index 9222f21a11..044b0eda11 100644 --- a/arch/risc-v/src/common/riscv_getintstack.c +++ b/arch/risc-v/src/common/riscv_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/sparc/src/common/sparc_checkstack.c b/arch/sparc/src/common/sparc_checkstack.c index 1a71098434..d22e4c7893 100644 --- a/arch/sparc/src/common/sparc_checkstack.c +++ b/arch/sparc/src/common/sparc_checkstack.c @@ -204,9 +204,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb) } #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)); } #endif diff --git a/arch/sparc/src/common/sparc_getintstack.c b/arch/sparc/src/common/sparc_getintstack.c index 55c258b6f2..a8f33b372b 100644 --- a/arch/sparc/src/common/sparc_getintstack.c +++ b/arch/sparc/src/common/sparc_getintstack.c @@ -37,8 +37,8 @@ ****************************************************************************/ #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 diff --git a/arch/sparc/src/common/sparc_initialize.c b/arch/sparc/src/common/sparc_initialize.c index a23a138020..e20b6315ab 100644 --- a/arch/sparc/src/common/sparc_initialize.c +++ b/arch/sparc/src/common/sparc_initialize.c @@ -103,7 +103,7 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS]; #if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 7 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; for (size = ((CONFIG_ARCH_INTERRUPTSTACK & ~7) * CONFIG_SMP_NCPUS); diff --git a/arch/sparc/src/common/sparc_internal.h b/arch/sparc/src/common/sparc_internal.h index 6762176956..4f149e8c3e 100644 --- a/arch/sparc/src/common/sparc_internal.h +++ b/arch/sparc/src/common/sparc_internal.h @@ -198,8 +198,8 @@ void sparc_sigdeliver(void); /* Interrupt handling *******************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 7 -uintptr_t sparc_intstack_alloc(void); -uintptr_t sparc_intstack_top(void); +uintptr_t sparc_intstack_alloc(int cpu); +uintptr_t sparc_intstack_top(int cpu); #endif /* Chip-specific functions **************************************************/ diff --git a/arch/sparc/src/s698pm/s698pm-irq.c b/arch/sparc/src/s698pm/s698pm-irq.c index 21b6694309..8237623ef3 100644 --- a/arch/sparc/src/s698pm/s698pm-irq.c +++ b/arch/sparc/src/s698pm/s698pm-irq.c @@ -508,10 +508,10 @@ int up_prioritize_irq(int irq, int priority) ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 7 -uintptr_t sparc_intstack_top(void) +uintptr_t sparc_intstack_top(int cpu) { #if defined(CONFIG_SMP) - return g_cpu_intstack_top[up_cpu_index()]; + return g_cpu_intstack_top[cpu]; #else return g_cpu_intstack_top[0]; #endif @@ -528,10 +528,10 @@ uintptr_t sparc_intstack_top(void) ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 7 -uintptr_t sparc_intstack_alloc(void) +uintptr_t sparc_intstack_alloc(int cpu) { #if defined(CONFIG_SMP) - return g_cpu_intstack_top[up_cpu_index()] - INTSTACK_SIZE; + return g_cpu_intstack_top[cpu] - INTSTACK_SIZE; #else return g_cpu_intstack_top[0] - INTSTACK_SIZE; #endif diff --git a/arch/x86/src/common/x86_getintstack.c b/arch/x86/src/common/x86_getintstack.c index 03167b6b34..355e013c72 100644 --- a/arch/x86/src/common/x86_getintstack.c +++ b/arch/x86/src/common/x86_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/x86_64/src/common/x86_64_getintstack.c b/arch/x86_64/src/common/x86_64_getintstack.c index 85469a72c8..12e646893e 100644 --- a/arch/x86_64/src/common/x86_64_getintstack.c +++ b/arch/x86_64/src/common/x86_64_getintstack.c @@ -37,7 +37,7 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { return (uintptr_t)g_intstackalloc; } diff --git a/arch/xtensa/src/common/xtensa.h b/arch/xtensa/src/common/xtensa.h index f1e3babd1f..c685368238 100644 --- a/arch/xtensa/src/common/xtensa.h +++ b/arch/xtensa/src/common/xtensa.h @@ -230,8 +230,8 @@ void xtensa_window_spill(void); /* IRQs */ #if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15 -uintptr_t xtensa_intstack_alloc(void); -uintptr_t xtensa_intstack_top(void); +uintptr_t xtensa_intstack_alloc(int cpu); +uintptr_t xtensa_intstack_top(int cpu); #endif uint32_t *xtensa_int_decode(uint32_t cpuints, uint32_t *regs); diff --git a/arch/xtensa/src/common/xtensa_backtrace.c b/arch/xtensa/src/common/xtensa_backtrace.c index 9de290b61a..fbb9de7ffe 100644 --- a/arch/xtensa/src/common/xtensa_backtrace.c +++ b/arch/xtensa/src/common/xtensa_backtrace.c @@ -237,7 +237,7 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip) #if CONFIG_ARCH_INTERRUPTSTACK > 15 void *istackbase; #ifdef CONFIG_SMP - istackbase = xtensa_intstack_alloc(); + istackbase = xtensa_intstack_alloc(up_cpu_index()); #else istackbase = g_intstackalloc; #endif diff --git a/arch/xtensa/src/common/xtensa_checkstack.c b/arch/xtensa/src/common/xtensa_checkstack.c index e50b3b6219..6bdc76157c 100644 --- a/arch/xtensa/src/common/xtensa_checkstack.c +++ b/arch/xtensa/src/common/xtensa_checkstack.c @@ -163,9 +163,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb) } #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 diff --git a/arch/xtensa/src/common/xtensa_getintstack.c b/arch/xtensa/src/common/xtensa_getintstack.c index eb64149ddd..2dbfe1b716 100644 --- a/arch/xtensa/src/common/xtensa_getintstack.c +++ b/arch/xtensa/src/common/xtensa_getintstack.c @@ -37,10 +37,10 @@ ****************************************************************************/ #if CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void) +uintptr_t up_get_intstackbase(int cpu) { #ifdef CONFIG_SMP - return (uintptr_t)xtensa_intstack_alloc(); + return (uintptr_t)xtensa_intstack_alloc(cpu); #else return (uintptr_t)g_intstackalloc; #endif diff --git a/arch/xtensa/src/common/xtensa_initialize.c b/arch/xtensa/src/common/xtensa_initialize.c index c645005f9b..7635121c9e 100644 --- a/arch/xtensa/src/common/xtensa_initialize.c +++ b/arch/xtensa/src/common/xtensa_initialize.c @@ -61,7 +61,7 @@ volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS]; static inline void xtensa_color_intstack(void) { #ifdef CONFIG_SMP - uint32_t *ptr = (uint32_t *)xtensa_intstack_alloc(); + uint32_t *ptr = (uint32_t *)xtensa_intstack_alloc(up_cpu_index()); #else uint32_t *ptr = (uint32_t *)g_intstackalloc; #endif diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c index 2600457105..1f1ca44dfb 100644 --- a/arch/xtensa/src/esp32/esp32_irq.c +++ b/arch/xtensa/src/esp32/esp32_irq.c @@ -749,9 +749,9 @@ void up_enable_irq(int irq) ****************************************************************************/ #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 diff --git a/arch/xtensa/src/esp32s3/esp32s3_irq.c b/arch/xtensa/src/esp32s3/esp32s3_irq.c index 5e3dca56a3..be67a792e2 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_irq.c +++ b/arch/xtensa/src/esp32s3/esp32s3_irq.c @@ -696,9 +696,9 @@ void up_enable_irq(int irq) ****************************************************************************/ #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 diff --git a/boards/arm/cxd56xx/common/src/cxd56_crashdump.c b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c index 4cb81a8825..cd8d61ef61 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_crashdump.c +++ b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c @@ -187,7 +187,8 @@ void board_crashdump(uintptr_t sp, struct tcb_s *tcb, /* Get the limits on the interrupt stack memory */ #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 pdump->info.stacks.interrupt.top = (uint32_t)g_intstacktop; #endif diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index c1d266f5ca..385e9223b1 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -2536,12 +2536,12 @@ void irq_dispatch(int irq, FAR void *context); struct tcb_s; size_t up_check_tcbstack(FAR struct tcb_s *tcb); #if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3 -size_t up_check_intstack(void); +size_t up_check_intstack(int cpu); #endif #endif #if defined(CONFIG_ARCH_INTERRUPTSTACK) && CONFIG_ARCH_INTERRUPTSTACK > 3 -uintptr_t up_get_intstackbase(void); +uintptr_t up_get_intstackbase(int cpu); #endif /**************************************************************************** diff --git a/sched/misc/assert.c b/sched/misc/assert.c index fc0e480847..0079014782 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -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) { #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; uintptr_t intstack_top = intstack_base + intstack_size; uintptr_t intstack_sp = 0; @@ -243,7 +243,7 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp) intstack_base, intstack_size, #ifdef CONFIG_STACK_COLORATION - up_check_intstack() + up_check_intstack(up_cpu_index()) #else 0 #endif @@ -405,17 +405,8 @@ static void dump_backtrace(FAR struct tcb_s *tcb, FAR void *arg) static void dump_tasks(void) { -#if CONFIG_ARCH_INTERRUPTSTACK > 0 && defined(CONFIG_STACK_COLORATION) - size_t stack_used = up_check_intstack(); - 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; - } +#if CONFIG_ARCH_INTERRUPTSTACK > 0 + int cpu; #endif /* Dump interesting properties of each task in the crash environment */ @@ -438,31 +429,50 @@ static void dump_tasks(void) " COMMAND\n"); #if CONFIG_ARCH_INTERRUPTSTACK > 0 - _alert(" ---- ---" -# ifdef CONFIG_SMP - " ----" -# endif - " --- --------" - " ------- ---" - " ------- ----------" - " ----------------" - " %p" - " %7u" + for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++) + { # 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 # ifndef CONFIG_SCHED_CPULOAD_NONE - " ----" + " ----" # endif - " irq\n" - , (FAR void *)up_get_intstackbase() - , CONFIG_ARCH_INTERRUPTSTACK + " irq\n" +#ifdef CONFIG_SMP + , cpu +#endif + , (FAR void *)up_get_intstackbase(cpu) + , CONFIG_ARCH_INTERRUPTSTACK # ifdef CONFIG_STACK_COLORATION - , stack_used - , stack_filled / 10, stack_filled % 10, - (stack_filled >= 10 * 80 ? '!' : ' ') + , stack_used + , stack_filled / 10, stack_filled % 10, + (stack_filled >= 10 * 80 ? '!' : ' ') # endif - ); + ); + } #endif nxsched_foreach(dump_task, NULL);