Skip to content

Commit 6ad8735

Browse files
zhangyang-hxdpalmer-dabbelt
authored andcommitted
riscv: set trap vector earlier
The exception vector of the booting hart is not set before enabling the mmu and then still points to the value of the previous firmware, typically _start. That makes it hard to debug setup_vm() when bad things happen. So fix that by setting the exception vector earlier. Reviewed-by: Alexandre Ghiti <[email protected]> Signed-off-by: yang.zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 5ee121a commit 6ad8735

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/riscv/kernel/head.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ SYM_CODE_START(_start_kernel)
305305
#else
306306
mv a0, a1
307307
#endif /* CONFIG_BUILTIN_DTB */
308+
/* Set trap vector to spin forever to help debug */
309+
la a3, .Lsecondary_park
310+
csrw CSR_TVEC, a3
308311
call setup_vm
309312
#ifdef CONFIG_MMU
310313
la a0, early_pg_dir

0 commit comments

Comments
 (0)