Skip to content

Commit d411cf0

Browse files
greentimepaul-walmsley-sifive
authored andcommitted
riscv: fix scratch register clearing in M-mode.
This patch fixes that the sscratch register clearing in M-mode. It cleared sscratch register in M-mode, but it should clear mscratch register. That will cause kernel trap if the CPU core doesn't support S-mode when trying to access sscratch. Fixes: 9e80635 ("riscv: clear the instruction cache and all registers when booting") Signed-off-by: Greentime Hu <[email protected]> Reviewed-by: Anup Patel <[email protected]> Signed-off-by: Paul Walmsley <[email protected]>
1 parent 0312a3d commit d411cf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/kernel/head.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ ENTRY(reset_regs)
246246
li t4, 0
247247
li t5, 0
248248
li t6, 0
249-
csrw sscratch, 0
249+
csrw CSR_SCRATCH, 0
250250

251251
#ifdef CONFIG_FPU
252252
csrr t0, CSR_MISA

0 commit comments

Comments
 (0)