lkml.org 
[lkml]   [2010]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 19/29] KVM: X86: Propagate fetch faults
    Date
    KVM currently ignores fetch faults in the instruction
    emulator. With nested-npt we could have such faults. This
    patch adds the code to handle these.

    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    ---
    arch/x86/kvm/emulate.c | 3 +++
    arch/x86/kvm/x86.c | 4 ++++
    2 files changed, 7 insertions(+), 0 deletions(-)

    diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
    index 2b08b78..aead72e 100644
    --- a/arch/x86/kvm/emulate.c
    +++ b/arch/x86/kvm/emulate.c
    @@ -1198,6 +1198,9 @@ static int emulate_popf(struct x86_emulate_ctxt *ctxt,
    *(unsigned long *)dest =
    (ctxt->eflags & ~change_mask) | (val & change_mask);

    + if (rc == X86EMUL_PROPAGATE_FAULT)
    + emulate_pf(ctxt);
    +
    return rc;
    }

    diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
    index 2816e5a..16c044b 100644
    --- a/arch/x86/kvm/x86.c
    +++ b/arch/x86/kvm/x86.c
    @@ -4233,6 +4233,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
    vcpu->arch.emulate_ctxt.perm_ok = false;

    r = x86_decode_insn(&vcpu->arch.emulate_ctxt);
    + if (r == X86EMUL_PROPAGATE_FAULT)
    + goto done;
    +
    trace_kvm_emulate_insn_start(vcpu);

    /* Only allow emulation of specific instructions on #UD
    @@ -4291,6 +4294,7 @@ restart:
    return handle_emulation_failure(vcpu);
    }

    +done:
    if (vcpu->arch.emulate_ctxt.exception >= 0) {
    inject_emulated_exception(vcpu);
    r = EMULATE_DONE;
    --
    1.7.0.4



    \
     
     \ /
      Last update: 2010-09-10 17:39    [W:8.580 / U:0.240 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site