mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
target/loongarch: Populate CPUClass.mmu_index
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
ace0c5fe59
commit
a72a1b105d
2 changed files with 13 additions and 4 deletions
|
@ -375,6 +375,16 @@ static bool loongarch_cpu_has_work(CPUState *cs)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch)
|
||||||
|
{
|
||||||
|
CPULoongArchState *env = cpu_env(cs);
|
||||||
|
|
||||||
|
if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) {
|
||||||
|
return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV);
|
||||||
|
}
|
||||||
|
return MMU_IDX_DA;
|
||||||
|
}
|
||||||
|
|
||||||
static void loongarch_la464_initfn(Object *obj)
|
static void loongarch_la464_initfn(Object *obj)
|
||||||
{
|
{
|
||||||
LoongArchCPU *cpu = LOONGARCH_CPU(obj);
|
LoongArchCPU *cpu = LOONGARCH_CPU(obj);
|
||||||
|
@ -777,6 +787,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
|
||||||
|
|
||||||
cc->class_by_name = loongarch_cpu_class_by_name;
|
cc->class_by_name = loongarch_cpu_class_by_name;
|
||||||
cc->has_work = loongarch_cpu_has_work;
|
cc->has_work = loongarch_cpu_has_work;
|
||||||
|
cc->mmu_index = loongarch_cpu_mmu_index;
|
||||||
cc->dump_state = loongarch_cpu_dump_state;
|
cc->dump_state = loongarch_cpu_dump_state;
|
||||||
cc->set_pc = loongarch_cpu_set_pc;
|
cc->set_pc = loongarch_cpu_set_pc;
|
||||||
cc->get_pc = loongarch_cpu_get_pc;
|
cc->get_pc = loongarch_cpu_get_pc;
|
||||||
|
|
|
@ -408,15 +408,13 @@ struct LoongArchCPUClass {
|
||||||
#define MMU_IDX_USER MMU_PLV_USER
|
#define MMU_IDX_USER MMU_PLV_USER
|
||||||
#define MMU_IDX_DA 4
|
#define MMU_IDX_DA 4
|
||||||
|
|
||||||
|
int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch);
|
||||||
static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch)
|
static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_USER_ONLY
|
#ifdef CONFIG_USER_ONLY
|
||||||
return MMU_IDX_USER;
|
return MMU_IDX_USER;
|
||||||
#else
|
#else
|
||||||
if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) {
|
return loongarch_cpu_mmu_index(env_cpu(env), ifetch);
|
||||||
return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV);
|
|
||||||
}
|
|
||||||
return MMU_IDX_DA;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue