target/riscv: Legalize MPP value in write_mstatus
authorWeiwei Li <liweiwei@iscas.ac.cn>
Fri, 7 Apr 2023 01:47:43 +0000 (09:47 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 5 May 2023 00:49:50 +0000 (10:49 +1000)
commit0c98ccef49b015b5625495b451315a06a54525ec
tree4ea8e1278a4a0dc0f3ea15bc7cc3d07a0339c7d6
parent44b8f74b0088df22f30e0718f6aefa9fb87702f6
target/riscv: Legalize MPP value in write_mstatus

mstatus.MPP field is a WARL field since priv version 1.11, so we
remain it unchanged if an invalid value is written into it. And
after this, RVH shouldn't be passed to riscv_cpu_set_mode().

Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230407014743.18779-4-liweiwei@iscas.ac.cn>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu_helper.c
target/riscv/csr.c