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:
Atish Patra 2018-12-21 11:06:20 +05:30 committed by Anup Patel
parent 089f70a179
commit f003787455

View file

@ -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);