mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-03-15 19:31:32 +00:00
lib: Hang in sbi_hart_boot_next() if next mode is not supported
We should not jump to next stage if next mode (S-mode or U-mode) is not supported by HART. Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
parent
089f70a179
commit
f003787455
1 changed files with 4 additions and 0 deletions
|
@ -203,6 +203,10 @@ void __attribute__((noreturn)) sbi_hart_boot_next(unsigned long arg0,
|
|||
|
||||
if (next_mode != PRV_S && next_mode != PRV_M && next_mode != PRV_U)
|
||||
sbi_hart_hang();
|
||||
if (next_mode == PRV_S && !misa_extension('S'))
|
||||
sbi_hart_hang();
|
||||
if (next_mode == PRV_U && !misa_extension('U'))
|
||||
sbi_hart_hang();
|
||||
|
||||
val = csr_read(mstatus);
|
||||
val = INSERT_FIELD(val, MSTATUS_MPP, next_mode);
|
||||
|
|
Loading…
Add table
Reference in a new issue