arch/risc-v: report correct interrupt stack base

As `up_get_intstackbase` supports per cpu stack base, fix
the report value with the cpu specific one.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
This commit is contained in:
Inochi Amaoto 2024-04-15 08:33:54 +08:00 committed by Alan Carvalho de Assis
parent a33313413d
commit 1d7afb571f
4 changed files with 6 additions and 4 deletions

View File

@ -182,7 +182,7 @@ exception_common:
/* Total required interrupt stack size */
#define STACK_ALLOC_SIZE (CONFIG_ARCH_INTERRUPTSTACK * CONFIG_SMP_NCPUS)
#define STACK_ALLOC_SIZE (INT_STACK_SIZE * CONFIG_SMP_NCPUS)
#if CONFIG_ARCH_INTERRUPTSTACK > 15
.bss

View File

@ -39,6 +39,6 @@
#if CONFIG_ARCH_INTERRUPTSTACK > 3
uintptr_t up_get_intstackbase(int cpu)
{
return (uintptr_t)g_intstackalloc;
return (uintptr_t)g_intstacktop - cpu * INT_STACK_SIZE;
}
#endif

View File

@ -81,6 +81,9 @@
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
/* Interrupt Stack macros */
#define INT_STACK_SIZE (STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK))
/* Format output with register width and hex */
#ifdef CONFIG_ARCH_RV32

View File

@ -41,7 +41,6 @@
****************************************************************************/
#define HART_CNT (CONFIG_SMP_NCPUS)
#define STACK_SIZE (STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK))
static_assert(RISCV_PERCPU_HARTID == offsetof(riscv_percpu_t, hartid),
"RISCV_PERCPU_HARTID offset is wrong");
@ -96,7 +95,7 @@ static void riscv_percpu_init(void)
/* Set interrupt stack (if any) */
#if CONFIG_ARCH_INTERRUPTSTACK > 15
g_percpu[i].irq_stack = (uintptr_t)g_intstacktop - i * STACK_SIZE;
g_percpu[i].irq_stack = (uintptr_t)g_intstacktop - i * INT_STACK_SIZE;
#endif
sq_addlast((struct sq_entry_s *) &g_percpu[i], &g_freelist);