target/riscv: Fix mret exception cause when no pmp rule is configured
commit4c48aad122b9dd4d96184828d7172cc62dae01c5
authorBin Meng <bmeng@tinylab.org>
Mon, 5 Dec 2022 06:53:03 +0000 (5 14:53 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 6 Jan 2023 00:42:55 +0000 (6 10:42 +1000)
tree212161ecc4fff5e54baf6564ad5552e51d921c19
parentbb22d391121fc0de42a04d1ed99f602441ea70e1
target/riscv: Fix mret exception cause when no pmp rule is configured

The priv spec v1.12 says:

  If no PMP entry matches an M-mode access, the access succeeds. If
  no PMP entry matches an S-mode or U-mode access, but at least one
  PMP entry is implemented, the access fails. Failed accesses generate
  an instruction, load, or store access-fault exception.

At present the exception cause is set to 'illegal instruction' but
should have been 'instruction access fault'.

Fixes: d102f19a2085 ("target/riscv/pmp: Raise exception if no PMP entry is configured")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20221205065303.204095-1-bmeng@tinylab.org>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/op_helper.c