From 7d500c46e6937aab4184b56dbc6e427cf3d3b446 Mon Sep 17 00:00:00 2001 From: espes Date: Sat, 6 Oct 2018 17:52:32 +1000 Subject: [PATCH] hvf: support PAT msr --- target/i386/hvf/x86_emu.c | 8 +++++++- target/i386/hvf/x86hvf.c | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index a388066585..ff17f8877d 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386/hvf/x86_emu.c @@ -698,6 +698,9 @@ void simulate_rdmsr(struct CPUState *cpu) case MSR_CSTAR: abort(); break; + case MSR_PAT: + val = env->pat; + break; case MSR_IA32_MISC_ENABLE: val = env->msr_ia32_misc_enable; break; @@ -742,7 +745,7 @@ void simulate_rdmsr(struct CPUState *cpu) val = env->mtrr_deftype; break; default: - /* fprintf(stderr, "%s: unknown msr 0x%x\n", __func__, msr); */ + fprintf(stderr, "%s: unknown msr 0x%x\n", __func__, msr); val = 0; break; } @@ -798,6 +801,9 @@ void simulate_wrmsr(struct CPUState *cpu) hv_vcpu_invalidate_tlb(cpu->hvf_fd); } break; + case MSR_PAT: + env->pat = data; + break; case MSR_MTRRphysBase(0): case MSR_MTRRphysBase(1): case MSR_MTRRphysBase(2): diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 9f407344f9..6f0d1e1964 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -141,6 +141,8 @@ void hvf_put_msrs(CPUState *cpu_state) hv_vcpu_write_msr(cpu_state->hvf_fd, MSR_IA32_SYSENTER_EIP, env->sysenter_eip); + hv_vcpu_write_msr(cpu_state->hvf_fd, MSR_PAT, env->pat); + hv_vcpu_write_msr(cpu_state->hvf_fd, MSR_STAR, env->star); #ifdef TARGET_X86_64 @@ -231,6 +233,8 @@ void hvf_get_msrs(CPUState *cpu_state) hv_vcpu_read_msr(cpu_state->hvf_fd, MSR_IA32_SYSENTER_EIP, &tmp); env->sysenter_eip = tmp; + hv_vcpu_read_msr(cpu_state->hvf_fd, MSR_PAT, &env->pat); + hv_vcpu_read_msr(cpu_state->hvf_fd, MSR_STAR, &env->star); #ifdef TARGET_X86_64