mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-13 02:35:30 +00:00
target/riscv: Do not allow sfence.vma from user mode
The 'sfence.vma' instruction is privileged, and should only ever be allowed when executing in supervisor mode or higher. Backports commit b86f4167630802128d94f3c89043d97d2f4c2546 from qemu
This commit is contained in:
parent
67f0af4282
commit
25c0333213
|
@ -144,9 +144,10 @@ void helper_tlb_flush(CPURISCVState *env)
|
|||
{
|
||||
RISCVCPU *cpu = riscv_env_get_cpu(env);
|
||||
CPUState *cs = CPU(cpu);
|
||||
if (env->priv == PRV_S &&
|
||||
if (!(env->priv >= PRV_S) ||
|
||||
(env->priv == PRV_S &&
|
||||
env->priv_ver >= PRIV_VERSION_1_10_0 &&
|
||||
get_field(env->mstatus, MSTATUS_TVM)) {
|
||||
get_field(env->mstatus, MSTATUS_TVM))) {
|
||||
riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());
|
||||
} else {
|
||||
tlb_flush(cs);
|
||||
|
|
Loading…
Reference in a new issue