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:
parent
a33313413d
commit
1d7afb571f
arch/risc-v/src/common
@ -182,7 +182,7 @@ exception_common:
|
|||||||
|
|
||||||
/* Total required interrupt stack size */
|
/* 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
|
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||||
.bss
|
.bss
|
||||||
|
@ -39,6 +39,6 @@
|
|||||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||||
uintptr_t up_get_intstackbase(int cpu)
|
uintptr_t up_get_intstackbase(int cpu)
|
||||||
{
|
{
|
||||||
return (uintptr_t)g_intstackalloc;
|
return (uintptr_t)g_intstacktop - cpu * INT_STACK_SIZE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,6 +81,9 @@
|
|||||||
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
|
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
|
||||||
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~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 */
|
/* Format output with register width and hex */
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_RV32
|
#ifdef CONFIG_ARCH_RV32
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define HART_CNT (CONFIG_SMP_NCPUS)
|
#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),
|
static_assert(RISCV_PERCPU_HARTID == offsetof(riscv_percpu_t, hartid),
|
||||||
"RISCV_PERCPU_HARTID offset is wrong");
|
"RISCV_PERCPU_HARTID offset is wrong");
|
||||||
@ -96,7 +95,7 @@ static void riscv_percpu_init(void)
|
|||||||
/* Set interrupt stack (if any) */
|
/* Set interrupt stack (if any) */
|
||||||
|
|
||||||
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
#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
|
#endif
|
||||||
|
|
||||||
sq_addlast((struct sq_entry_s *) &g_percpu[i], &g_freelist);
|
sq_addlast((struct sq_entry_s *) &g_percpu[i], &g_freelist);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user