mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 05:45:36 +00:00
target/riscv: Allow setting a two-stage lookup in the virt status
Backports 5a894dd7709f3b6a9f3e861dec71f78098bb3373
This commit is contained in:
parent
9792907bcf
commit
a8bce9af7a
|
@ -7320,9 +7320,11 @@ riscv_symbols = (
|
||||||
'riscv_cpu_set_force_hs_excep',
|
'riscv_cpu_set_force_hs_excep',
|
||||||
'riscv_cpu_set_mode',
|
'riscv_cpu_set_mode',
|
||||||
'riscv_cpu_set_rdtime_fn',
|
'riscv_cpu_set_rdtime_fn',
|
||||||
|
'riscv_cpu_set_two_stage_lookup',
|
||||||
'riscv_cpu_set_virt_enabled',
|
'riscv_cpu_set_virt_enabled',
|
||||||
'riscv_cpu_swap_hypervisor_regs',
|
'riscv_cpu_swap_hypervisor_regs',
|
||||||
'riscv_cpu_tlb_fill',
|
'riscv_cpu_tlb_fill',
|
||||||
|
'riscv_cpu_two_stage_lookup',
|
||||||
'riscv_cpu_unassigned_access',
|
'riscv_cpu_unassigned_access',
|
||||||
'riscv_cpu_update_mip',
|
'riscv_cpu_update_mip',
|
||||||
'riscv_cpu_virt_enabled',
|
'riscv_cpu_virt_enabled',
|
||||||
|
|
|
@ -4756,9 +4756,11 @@
|
||||||
#define riscv_cpu_set_force_hs_excep riscv_cpu_set_force_hs_excep_riscv32
|
#define riscv_cpu_set_force_hs_excep riscv_cpu_set_force_hs_excep_riscv32
|
||||||
#define riscv_cpu_set_mode riscv_cpu_set_mode_riscv32
|
#define riscv_cpu_set_mode riscv_cpu_set_mode_riscv32
|
||||||
#define riscv_cpu_set_rdtime_fn riscv_cpu_set_rdtime_fn_riscv32
|
#define riscv_cpu_set_rdtime_fn riscv_cpu_set_rdtime_fn_riscv32
|
||||||
|
#define riscv_cpu_set_two_stage_lookup riscv_cpu_set_two_stage_lookup_riscv32
|
||||||
#define riscv_cpu_set_virt_enabled riscv_cpu_set_virt_enabled_riscv32
|
#define riscv_cpu_set_virt_enabled riscv_cpu_set_virt_enabled_riscv32
|
||||||
#define riscv_cpu_swap_hypervisor_regs riscv_cpu_swap_hypervisor_regs_riscv32
|
#define riscv_cpu_swap_hypervisor_regs riscv_cpu_swap_hypervisor_regs_riscv32
|
||||||
#define riscv_cpu_tlb_fill riscv_cpu_tlb_fill_riscv32
|
#define riscv_cpu_tlb_fill riscv_cpu_tlb_fill_riscv32
|
||||||
|
#define riscv_cpu_two_stage_lookup riscv_cpu_two_stage_lookup_riscv32
|
||||||
#define riscv_cpu_unassigned_access riscv_cpu_unassigned_access_riscv32
|
#define riscv_cpu_unassigned_access riscv_cpu_unassigned_access_riscv32
|
||||||
#define riscv_cpu_update_mip riscv_cpu_update_mip_riscv32
|
#define riscv_cpu_update_mip riscv_cpu_update_mip_riscv32
|
||||||
#define riscv_cpu_virt_enabled riscv_cpu_virt_enabled_riscv32
|
#define riscv_cpu_virt_enabled riscv_cpu_virt_enabled_riscv32
|
||||||
|
|
|
@ -4756,9 +4756,11 @@
|
||||||
#define riscv_cpu_set_force_hs_excep riscv_cpu_set_force_hs_excep_riscv64
|
#define riscv_cpu_set_force_hs_excep riscv_cpu_set_force_hs_excep_riscv64
|
||||||
#define riscv_cpu_set_mode riscv_cpu_set_mode_riscv64
|
#define riscv_cpu_set_mode riscv_cpu_set_mode_riscv64
|
||||||
#define riscv_cpu_set_rdtime_fn riscv_cpu_set_rdtime_fn_riscv64
|
#define riscv_cpu_set_rdtime_fn riscv_cpu_set_rdtime_fn_riscv64
|
||||||
|
#define riscv_cpu_set_two_stage_lookup riscv_cpu_set_two_stage_lookup_riscv64
|
||||||
#define riscv_cpu_set_virt_enabled riscv_cpu_set_virt_enabled_riscv64
|
#define riscv_cpu_set_virt_enabled riscv_cpu_set_virt_enabled_riscv64
|
||||||
#define riscv_cpu_swap_hypervisor_regs riscv_cpu_swap_hypervisor_regs_riscv64
|
#define riscv_cpu_swap_hypervisor_regs riscv_cpu_swap_hypervisor_regs_riscv64
|
||||||
#define riscv_cpu_tlb_fill riscv_cpu_tlb_fill_riscv64
|
#define riscv_cpu_tlb_fill riscv_cpu_tlb_fill_riscv64
|
||||||
|
#define riscv_cpu_two_stage_lookup riscv_cpu_two_stage_lookup_riscv64
|
||||||
#define riscv_cpu_unassigned_access riscv_cpu_unassigned_access_riscv64
|
#define riscv_cpu_unassigned_access riscv_cpu_unassigned_access_riscv64
|
||||||
#define riscv_cpu_update_mip riscv_cpu_update_mip_riscv64
|
#define riscv_cpu_update_mip riscv_cpu_update_mip_riscv64
|
||||||
#define riscv_cpu_virt_enabled riscv_cpu_virt_enabled_riscv64
|
#define riscv_cpu_virt_enabled riscv_cpu_virt_enabled_riscv64
|
||||||
|
|
|
@ -324,6 +324,8 @@ bool riscv_cpu_virt_enabled(CPURISCVState *env);
|
||||||
void riscv_cpu_set_virt_enabled(CPURISCVState *env, bool enable);
|
void riscv_cpu_set_virt_enabled(CPURISCVState *env, bool enable);
|
||||||
bool riscv_cpu_force_hs_excep_enabled(CPURISCVState *env);
|
bool riscv_cpu_force_hs_excep_enabled(CPURISCVState *env);
|
||||||
void riscv_cpu_set_force_hs_excep(CPURISCVState *env, bool enable);
|
void riscv_cpu_set_force_hs_excep(CPURISCVState *env, bool enable);
|
||||||
|
bool riscv_cpu_two_stage_lookup(CPURISCVState *env);
|
||||||
|
void riscv_cpu_set_two_stage_lookup(CPURISCVState *env, bool enable);
|
||||||
int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch);
|
int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch);
|
||||||
hwaddr riscv_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
hwaddr riscv_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
|
||||||
void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
||||||
|
|
|
@ -468,7 +468,7 @@
|
||||||
* page table fault.
|
* page table fault.
|
||||||
*/
|
*/
|
||||||
#define FORCE_HS_EXCEP 2
|
#define FORCE_HS_EXCEP 2
|
||||||
|
#define HS_TWO_STAGE 4
|
||||||
|
|
||||||
/* RV32 satp CSR field masks */
|
/* RV32 satp CSR field masks */
|
||||||
#define SATP32_MODE 0x80000000
|
#define SATP32_MODE 0x80000000
|
||||||
|
|
|
@ -220,6 +220,24 @@ void riscv_cpu_set_force_hs_excep(CPURISCVState *env, bool enable)
|
||||||
env->virt = set_field(env->virt, FORCE_HS_EXCEP, enable);
|
env->virt = set_field(env->virt, FORCE_HS_EXCEP, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool riscv_cpu_two_stage_lookup(CPURISCVState *env)
|
||||||
|
{
|
||||||
|
if (!riscv_has_ext(env, RVH)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_field(env->virt, HS_TWO_STAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void riscv_cpu_set_two_stage_lookup(CPURISCVState *env, bool enable)
|
||||||
|
{
|
||||||
|
if (!riscv_has_ext(env, RVH)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
env->virt = set_field(env->virt, HS_TWO_STAGE, enable);
|
||||||
|
}
|
||||||
|
|
||||||
int riscv_cpu_claim_interrupts(RISCVCPU *cpu, uint32_t interrupts)
|
int riscv_cpu_claim_interrupts(RISCVCPU *cpu, uint32_t interrupts)
|
||||||
{
|
{
|
||||||
CPURISCVState *env = &cpu->env;
|
CPURISCVState *env = &cpu->env;
|
||||||
|
|
Loading…
Reference in a new issue