mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
target/riscv: Apply pointer masking for virtualized memory accesses
Signed-off-by: Alexey Baturo <baturo.alexey@gmail.com> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20250106102346.1100149-7-baturo.alexey@gmail.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
4d501a7a7f
commit
4d1600934a
5 changed files with 82 additions and 29 deletions
|
@ -263,6 +263,25 @@ RISCVPmPmm riscv_pm_get_pmm(CPURISCVState *env)
|
|||
#endif
|
||||
}
|
||||
|
||||
RISCVPmPmm riscv_pm_get_virt_pmm(CPURISCVState *env)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
int priv_mode = cpu_address_mode(env);
|
||||
|
||||
if (priv_mode == PRV_U) {
|
||||
return get_field(env->hstatus, HSTATUS_HUPMM);
|
||||
} else {
|
||||
if (get_field(env->hstatus, HSTATUS_SPVP)) {
|
||||
return get_field(env->henvcfg, HENVCFG_PMM);
|
||||
} else {
|
||||
return get_field(env->senvcfg, SENVCFG_PMM);
|
||||
}
|
||||
}
|
||||
#else
|
||||
return PMM_FIELD_DISABLED;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool riscv_cpu_virt_mem_enabled(CPURISCVState *env)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue