KVM: x86 emulator: make emulate_invlpg() an emulator callback
Removing direct calls to KVM. Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
2d04a05bd7
commit
3cb16fe78c
|
@ -154,6 +154,7 @@ struct x86_emulate_ops {
|
||||||
const void *new,
|
const void *new,
|
||||||
unsigned int bytes,
|
unsigned int bytes,
|
||||||
struct x86_exception *fault);
|
struct x86_exception *fault);
|
||||||
|
void (*invlpg)(struct x86_emulate_ctxt *ctxt, ulong addr);
|
||||||
|
|
||||||
int (*pio_in_emulated)(struct x86_emulate_ctxt *ctxt,
|
int (*pio_in_emulated)(struct x86_emulate_ctxt *ctxt,
|
||||||
int size, unsigned short port, void *val,
|
int size, unsigned short port, void *val,
|
||||||
|
|
|
@ -690,7 +690,6 @@ struct x86_emulate_ctxt;
|
||||||
int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, unsigned short port);
|
int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, unsigned short port);
|
||||||
void kvm_emulate_cpuid(struct kvm_vcpu *vcpu);
|
void kvm_emulate_cpuid(struct kvm_vcpu *vcpu);
|
||||||
int kvm_emulate_halt(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);
|
int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
|
void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
|
||||||
|
|
|
@ -2573,7 +2573,7 @@ static int em_invlpg(struct x86_emulate_ctxt *ctxt)
|
||||||
|
|
||||||
rc = linearize(ctxt, c->src.addr.mem, 1, false, &linear);
|
rc = linearize(ctxt, c->src.addr.mem, 1, false, &linear);
|
||||||
if (rc == X86EMUL_CONTINUE)
|
if (rc == X86EMUL_CONTINUE)
|
||||||
emulate_invlpg(ctxt->vcpu, linear);
|
ctxt->ops->invlpg(ctxt, linear);
|
||||||
/* Disable writeback. */
|
/* Disable writeback. */
|
||||||
c->dst.type = OP_NONE;
|
c->dst.type = OP_NONE;
|
||||||
return X86EMUL_CONTINUE;
|
return X86EMUL_CONTINUE;
|
||||||
|
|
|
@ -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);
|
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);
|
kvm_mmu_invlpg(emul_to_vcpu(ctxt), address);
|
||||||
return X86EMUL_CONTINUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu)
|
int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu)
|
||||||
|
@ -4382,6 +4381,7 @@ static struct x86_emulate_ops emulate_ops = {
|
||||||
.read_emulated = emulator_read_emulated,
|
.read_emulated = emulator_read_emulated,
|
||||||
.write_emulated = emulator_write_emulated,
|
.write_emulated = emulator_write_emulated,
|
||||||
.cmpxchg_emulated = emulator_cmpxchg_emulated,
|
.cmpxchg_emulated = emulator_cmpxchg_emulated,
|
||||||
|
.invlpg = emulator_invlpg,
|
||||||
.pio_in_emulated = emulator_pio_in_emulated,
|
.pio_in_emulated = emulator_pio_in_emulated,
|
||||||
.pio_out_emulated = emulator_pio_out_emulated,
|
.pio_out_emulated = emulator_pio_out_emulated,
|
||||||
.get_cached_descriptor = emulator_get_cached_descriptor,
|
.get_cached_descriptor = emulator_get_cached_descriptor,
|
||||||
|
|
Loading…
Reference in New Issue