KVM: x86: add read_phys to x86_emulate_ops
[deliverable/linux.git] / arch / x86 / kvm / x86.c
index 57b5f79aad083c5a7ad7cf710514304fe05aa337..a24bae0a83a205beaa98f4f4cb47e3b75936128c 100644 (file)
@@ -4089,6 +4089,15 @@ static int kvm_read_guest_virt_system(struct x86_emulate_ctxt *ctxt,
        return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, 0, exception);
 }
 
+static int kvm_read_guest_phys_system(struct x86_emulate_ctxt *ctxt,
+               unsigned long addr, void *val, unsigned int bytes)
+{
+       struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
+       int r = kvm_vcpu_read_guest(vcpu, addr, val, bytes);
+
+       return r < 0 ? X86EMUL_IO_NEEDED : X86EMUL_CONTINUE;
+}
+
 int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,
                                       gva_t addr, void *val,
                                       unsigned int bytes,
@@ -4824,6 +4833,7 @@ static const struct x86_emulate_ops emulate_ops = {
        .write_gpr           = emulator_write_gpr,
        .read_std            = kvm_read_guest_virt_system,
        .write_std           = kvm_write_guest_virt_system,
+       .read_phys           = kvm_read_guest_phys_system,
        .fetch               = kvm_fetch_guest_virt,
        .read_emulated       = emulator_read_emulated,
        .write_emulated      = emulator_write_emulated,
This page took 0.025974 seconds and 5 git commands to generate.