]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
KVM: x86 emulator: make emulate_invlpg() an emulator callback
authorAvi Kivity <avi@redhat.com>
Wed, 20 Apr 2011 12:38:44 +0000 (15:38 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 22 May 2011 12:39:15 +0000 (08:39 -0400)
Removing direct calls to KVM.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/include/asm/kvm_emulate.h
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/emulate.c
arch/x86/kvm/x86.c

index 4d1546aa610413b2435506e10cf7a2a7b067d429..f890769437017841e0e94d5d37656057ddc597a2 100644 (file)
@@ -154,6 +154,7 @@ struct x86_emulate_ops {
                                const void *new,
                                unsigned int bytes,
                                struct x86_exception *fault);
+       void (*invlpg)(struct x86_emulate_ctxt *ctxt, ulong addr);
 
        int (*pio_in_emulated)(struct x86_emulate_ctxt *ctxt,
                               int size, unsigned short port, void *val,
index 9c3567e0f73007623a300a60a7ccd6964beb84a1..d957d0d06562e5330064ba91b16e64d72df23269 100644 (file)
@@ -690,7 +690,6 @@ struct x86_emulate_ctxt;
 int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, unsigned short port);
 void kvm_emulate_cpuid(struct kvm_vcpu *vcpu);
 int kvm_emulate_halt(struct kvm_vcpu *vcpu);
-int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address);
 int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu);
 
 void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
index 2b903a32609653aee456d2945e71282f2219eedb..5d774e91388ec6e9a54e923d020afd9d14d83917 100644 (file)
@@ -2573,7 +2573,7 @@ static int em_invlpg(struct x86_emulate_ctxt *ctxt)
 
        rc = linearize(ctxt, c->src.addr.mem, 1, false, &linear);
        if (rc == X86EMUL_CONTINUE)
-               emulate_invlpg(ctxt->vcpu, linear);
+               ctxt->ops->invlpg(ctxt, linear);
        /* Disable writeback. */
        c->dst.type = OP_NONE;
        return X86EMUL_CONTINUE;
index a9e83862feb87a41d98ebde9669c2715661d6079..8af49b3df675bc2985f4665c0ed6e0db0e78f012 100644 (file)
@@ -4128,10 +4128,9 @@ static unsigned long get_segment_base(struct kvm_vcpu *vcpu, int seg)
        return kvm_x86_ops->get_segment_base(vcpu, seg);
 }
 
-int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
+static void emulator_invlpg(struct x86_emulate_ctxt *ctxt, ulong address)
 {
-       kvm_mmu_invlpg(vcpu, address);
-       return X86EMUL_CONTINUE;
+       kvm_mmu_invlpg(emul_to_vcpu(ctxt), address);
 }
 
 int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu)
@@ -4382,6 +4381,7 @@ static struct x86_emulate_ops emulate_ops = {
        .read_emulated       = emulator_read_emulated,
        .write_emulated      = emulator_write_emulated,
        .cmpxchg_emulated    = emulator_cmpxchg_emulated,
+       .invlpg              = emulator_invlpg,
        .pio_in_emulated     = emulator_pio_in_emulated,
        .pio_out_emulated    = emulator_pio_out_emulated,
        .get_cached_descriptor = emulator_get_cached_descriptor,