lib: Don't print delegation CSRs if there is no S-Mode

If the platform doesn't support S-Mode don't print the delegation
registers.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
Alistair Francis
2020-06-16 17:06:15 -07:00
committed by Anup Patel
parent 518e85cccb
commit d5725c24c6

View File

@@ -122,6 +122,10 @@ static int delegate_traps(struct sbi_scratch *scratch, u32 hartid)
void sbi_hart_delegation_dump(struct sbi_scratch *scratch)
{
if (!misa_extension('S'))
/* No delegation possible as mideleg does not exist*/
return;
#if __riscv_xlen == 32
sbi_printf("MIDELEG : 0x%08lx\n", csr_read(CSR_MIDELEG));
sbi_printf("MEDELEG : 0x%08lx\n", csr_read(CSR_MEDELEG));