aboutsummaryrefslogtreecommitdiff
path: root/target/i386/cpu.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-01-29 09:31:15 +1000
committerRichard Henderson <richard.henderson@linaro.org>2024-02-03 08:52:25 +1000
commitace0c5fe595047d720c685478b22a5e4c572ac42 (patch)
tree54c450f5c7964d5f479aacf169d7188f38f936db /target/i386/cpu.c
parent8f39cb77643828e08fe3320a0080dd0e27dd8e3b (diff)
downloadqemu-ace0c5fe595047d720c685478b22a5e4c572ac42.zip
qemu-ace0c5fe595047d720c685478b22a5e4c572ac42.tar.gz
qemu-ace0c5fe595047d720c685478b22a5e4c572ac42.tar.bz2
target/i386: Populate CPUClass.mmu_index
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/i386/cpu.c')
-rw-r--r--target/i386/cpu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 03822d9..280bcb7 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7720,6 +7720,15 @@ static bool x86_cpu_has_work(CPUState *cs)
return x86_cpu_pending_interrupt(cs, cs->interrupt_request) != 0;
}
+int x86_cpu_mmu_index(CPUState *cs, bool ifetch)
+{
+ CPUX86State *env = cpu_env(cs);
+
+ return (env->hflags & HF_CPL_MASK) == 3 ? MMU_USER_IDX :
+ (!(env->hflags & HF_SMAP_MASK) || (env->eflags & AC_MASK))
+ ? MMU_KNOSMAP_IDX : MMU_KSMAP_IDX;
+}
+
static void x86_disas_set_info(CPUState *cs, disassemble_info *info)
{
X86CPU *cpu = X86_CPU(cs);
@@ -7954,6 +7963,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
cc->class_by_name = x86_cpu_class_by_name;
cc->parse_features = x86_cpu_parse_featurestr;
cc->has_work = x86_cpu_has_work;
+ cc->mmu_index = x86_cpu_mmu_index;
cc->dump_state = x86_cpu_dump_state;
cc->set_pc = x86_cpu_set_pc;
cc->get_pc = x86_cpu_get_pc;