target/riscv: Extend the SIP CSR to support virtulisation
Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
parent
d0e53ce33e
commit
a2e9f57d06
@ -743,8 +743,19 @@ static int write_sbadaddr(CPURISCVState *env, int csrno, target_ulong val)
|
||||
static int rmw_sip(CPURISCVState *env, int csrno, target_ulong *ret_value,
|
||||
target_ulong new_value, target_ulong write_mask)
|
||||
{
|
||||
int ret = rmw_mip(env, CSR_MSTATUS, ret_value, new_value,
|
||||
int ret;
|
||||
|
||||
if (riscv_cpu_virt_enabled(env)) {
|
||||
/* Shift the new values to line up with the VS bits */
|
||||
ret = rmw_mip(env, CSR_MSTATUS, ret_value, new_value << 1,
|
||||
(write_mask & sip_writable_mask) << 1 & env->mideleg);
|
||||
ret &= vsip_writable_mask;
|
||||
ret >>= 1;
|
||||
} else {
|
||||
ret = rmw_mip(env, CSR_MSTATUS, ret_value, new_value,
|
||||
write_mask & env->mideleg & sip_writable_mask);
|
||||
}
|
||||
|
||||
*ret_value &= env->mideleg;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user