arch: riscv: fill all IRQ stacks with 0xAA

Fill the memory of all CPU's IRQ stack with 0xAA on init, so
that `z_stack_space_get` can calculate the remaining space
correctly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
Yong Cong Sin 2024-09-10 19:04:32 +08:00 committed by Carles Cufí
commit 035c822253
2 changed files with 4 additions and 2 deletions

View file

@ -62,7 +62,8 @@ boot_first_core:
#ifdef CONFIG_INIT_STACKS
/* Pre-populate all bytes in z_interrupt_stacks with 0xAA */
la t0, z_interrupt_stacks
li t1, __z_interrupt_stack_SIZEOF
/* Total size of all cores' IRQ stack */
li t1, __z_interrupt_all_stacks_SIZEOF
add t1, t1, t0
/* Populate z_interrupt_stacks with 0xaaaaaaaa */
@ -71,7 +72,7 @@ aa_loop:
sw t2, 0x00(t0)
addi t0, t0, 4
blt t0, t1, aa_loop
#endif
#endif /* CONFIG_INIT_STACKS */
/*
* Initially, setup stack pointer to

View file

@ -71,6 +71,7 @@ GEN_OFFSET_SYM(_thread_t, tls);
#endif /* CONFIG_THREAD_LOCAL_STORAGE */
GEN_ABSOLUTE_SYM(__z_interrupt_stack_SIZEOF, sizeof(z_interrupt_stacks[0]));
GEN_ABSOLUTE_SYM(__z_interrupt_all_stacks_SIZEOF, sizeof(z_interrupt_stacks));
/* member offsets in the device structure. Used in image post-processing */
#ifdef CONFIG_DEVICE_DEPS