target/riscv: Allow setting mstatus virtulisation bits
Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Revieweb-by: Palmer Dabbelt <palmer@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
parent
49aaa3e534
commit
1f0419cb04
|
@ -290,7 +290,6 @@ static int write_mstatus(CPURISCVState *env, int csrno, target_ulong val)
|
||||||
{
|
{
|
||||||
target_ulong mstatus = env->mstatus;
|
target_ulong mstatus = env->mstatus;
|
||||||
target_ulong mask = 0;
|
target_ulong mask = 0;
|
||||||
target_ulong mpp = get_field(val, MSTATUS_MPP);
|
|
||||||
|
|
||||||
/* flush tlb on mstatus fields that affect VM */
|
/* flush tlb on mstatus fields that affect VM */
|
||||||
if (env->priv_ver <= PRIV_VERSION_1_09_1) {
|
if (env->priv_ver <= PRIV_VERSION_1_09_1) {
|
||||||
|
@ -305,7 +304,7 @@ static int write_mstatus(CPURISCVState *env, int csrno, target_ulong val)
|
||||||
MSTATUS_VM : 0);
|
MSTATUS_VM : 0);
|
||||||
}
|
}
|
||||||
if (env->priv_ver >= PRIV_VERSION_1_10_0) {
|
if (env->priv_ver >= PRIV_VERSION_1_10_0) {
|
||||||
if ((val ^ mstatus) & (MSTATUS_MXR | MSTATUS_MPP |
|
if ((val ^ mstatus) & (MSTATUS_MXR | MSTATUS_MPP | MSTATUS_MPV |
|
||||||
MSTATUS_MPRV | MSTATUS_SUM)) {
|
MSTATUS_MPRV | MSTATUS_SUM)) {
|
||||||
tlb_flush(CPU(riscv_env_get_cpu(env)));
|
tlb_flush(CPU(riscv_env_get_cpu(env)));
|
||||||
}
|
}
|
||||||
|
@ -313,13 +312,13 @@ static int write_mstatus(CPURISCVState *env, int csrno, target_ulong val)
|
||||||
MSTATUS_SPP | MSTATUS_FS | MSTATUS_MPRV | MSTATUS_SUM |
|
MSTATUS_SPP | MSTATUS_FS | MSTATUS_MPRV | MSTATUS_SUM |
|
||||||
MSTATUS_MPP | MSTATUS_MXR | MSTATUS_TVM | MSTATUS_TSR |
|
MSTATUS_MPP | MSTATUS_MXR | MSTATUS_TVM | MSTATUS_TSR |
|
||||||
MSTATUS_TW;
|
MSTATUS_TW;
|
||||||
}
|
#if defined(TARGET_RISCV64)
|
||||||
|
/*
|
||||||
/* silenty discard mstatus.mpp writes for unsupported modes */
|
* RV32: MPV and MTL are not in mstatus. The current plan is to
|
||||||
if (mpp == PRV_H ||
|
* add them to mstatush. For now, we just don't support it.
|
||||||
(!riscv_has_ext(env, RVS) && mpp == PRV_S) ||
|
*/
|
||||||
(!riscv_has_ext(env, RVU) && mpp == PRV_U)) {
|
mask |= MSTATUS_MPP | MSTATUS_MPV;
|
||||||
mask &= ~MSTATUS_MPP;
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
mstatus = (mstatus & ~mask) | (val & mask);
|
mstatus = (mstatus & ~mask) | (val & mask);
|
||||||
|
|
Loading…
Reference in a new issue