aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-04-20 08:38:44 -0400
committerAvi Kivity <avi@redhat.com>2011-05-22 08:39:15 -0400
commit3cb16fe78ce91991a876c74fc5dc99419b737b7a (patch)
treeff534615110fac70fd2cf60e4d9588be3067d862 /arch
parent2d04a05bd7e93c13f13a82ac40de4065a99d069b (diff)
KVM: x86 emulator: make emulate_invlpg() an emulator callback
Removing direct calls to KVM. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/kvm_emulate.h1
-rw-r--r--arch/x86/include/asm/kvm_host.h1
-rw-r--r--arch/x86/kvm/emulate.c2
-rw-r--r--arch/x86/kvm/x86.c6
4 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
index 4d1546aa6104..f89076943701 100644
--- a/arch/x86/include/asm/kvm_emulate.h
+++ b/arch/x86/include/asm/kvm_emulate.h
@@ -154,6 +154,7 @@ struct x86_emulate_ops {
154 const void *new, 154 const void *new,
155 unsigned int bytes, 155 unsigned int bytes,
156 struct x86_exception *fault); 156 struct x86_exception *fault);
157 void (*invlpg)(struct x86_emulate_ctxt *ctxt, ulong addr);
157 158
158 int (*pio_in_emulated)(struct x86_emulate_ctxt *ctxt, 159 int (*pio_in_emulated)(struct x86_emulate_ctxt *ctxt,
159 int size, unsigned short port, void *val, 160 int size, unsigned short port, void *val,
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 9c3567e0f730..d957d0d06562 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -690,7 +690,6 @@ struct x86_emulate_ctxt;
690int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, unsigned short port); 690int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, unsigned short port);
691void kvm_emulate_cpuid(struct kvm_vcpu *vcpu); 691void kvm_emulate_cpuid(struct kvm_vcpu *vcpu);
692int kvm_emulate_halt(struct kvm_vcpu *vcpu); 692int kvm_emulate_halt(struct kvm_vcpu *vcpu);
693int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address);
694int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu); 693int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu);
695 694
696void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg); 695void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 2b903a326096..5d774e91388e 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2573,7 +2573,7 @@ static int em_invlpg(struct x86_emulate_ctxt *ctxt)
2573 2573
2574 rc = linearize(ctxt, c->src.addr.mem, 1, false, &linear); 2574 rc = linearize(ctxt, c->src.addr.mem, 1, false, &linear);
2575 if (rc == X86EMUL_CONTINUE) 2575 if (rc == X86EMUL_CONTINUE)
2576 emulate_invlpg(ctxt->vcpu, linear); 2576 ctxt->ops->invlpg(ctxt, linear);
2577 /* Disable writeback. */ 2577 /* Disable writeback. */
2578 c->dst.type = OP_NONE; 2578 c->dst.type = OP_NONE;
2579 return X86EMUL_CONTINUE; 2579 return X86EMUL_CONTINUE;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a9e83862feb8..8af49b3df675 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4128,10 +4128,9 @@ static unsigned long get_segment_base(struct kvm_vcpu *vcpu, int seg)
4128 return kvm_x86_ops->get_segment_base(vcpu, seg); 4128 return kvm_x86_ops->get_segment_base(vcpu, seg);
4129} 4129}
4130 4130
4131int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address) 4131static void emulator_invlpg(struct x86_emulate_ctxt *ctxt, ulong address)
4132{ 4132{
4133 kvm_mmu_invlpg(vcpu, address); 4133 kvm_mmu_invlpg(emul_to_vcpu(ctxt), address);
4134 return X86EMUL_CONTINUE;
4135} 4134}
4136 4135
4137int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu) 4136int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu)
@@ -4382,6 +4381,7 @@ static struct x86_emulate_ops emulate_ops = {
4382 .read_emulated = emulator_read_emulated, 4381 .read_emulated = emulator_read_emulated,
4383 .write_emulated = emulator_write_emulated, 4382 .write_emulated = emulator_write_emulated,
4384 .cmpxchg_emulated = emulator_cmpxchg_emulated, 4383 .cmpxchg_emulated = emulator_cmpxchg_emulated,
4384 .invlpg = emulator_invlpg,
4385 .pio_in_emulated = emulator_pio_in_emulated, 4385 .pio_in_emulated = emulator_pio_in_emulated,
4386 .pio_out_emulated = emulator_pio_out_emulated, 4386 .pio_out_emulated = emulator_pio_out_emulated,
4387 .get_cached_descriptor = emulator_get_cached_descriptor, 4387 .get_cached_descriptor = emulator_get_cached_descriptor,