forked from Mirrors/opensbi
		
	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:
		@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user