aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-04-20 08:12:00 -0400
committerAvi Kivity <avi@redhat.com>2011-05-22 08:39:08 -0400
commit1ac9d0cfb07e8ac3b5007d8279c5bd56e124250c (patch)
tree3c6b9179039511476353d4e24dd18042104f10a2 /arch/x86/kvm/x86.c
parentfe870ab9ce1c3e64c6d6b6ee3fe53d0d029f1044 (diff)
KVM: x86 emulator: add and use new callbacks set_idt(), set_gdt()
Replacing direct calls to realmode_lgdt(), realmode_lidt(). Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4f7248ea6caf..7cd3a3b491de 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4249,6 +4249,16 @@ static void emulator_get_idt(struct x86_emulate_ctxt *ctxt, struct desc_ptr *dt)
4249 kvm_x86_ops->get_idt(emul_to_vcpu(ctxt), dt); 4249 kvm_x86_ops->get_idt(emul_to_vcpu(ctxt), dt);
4250} 4250}
4251 4251
4252static void emulator_set_gdt(struct x86_emulate_ctxt *ctxt, struct desc_ptr *dt)
4253{
4254 kvm_x86_ops->set_gdt(emul_to_vcpu(ctxt), dt);
4255}
4256
4257static void emulator_set_idt(struct x86_emulate_ctxt *ctxt, struct desc_ptr *dt)
4258{
4259 kvm_x86_ops->set_idt(emul_to_vcpu(ctxt), dt);
4260}
4261
4252static unsigned long emulator_get_cached_segment_base( 4262static unsigned long emulator_get_cached_segment_base(
4253 struct x86_emulate_ctxt *ctxt, int seg) 4263 struct x86_emulate_ctxt *ctxt, int seg)
4254{ 4264{
@@ -4388,6 +4398,8 @@ static struct x86_emulate_ops emulate_ops = {
4388 .get_cached_segment_base = emulator_get_cached_segment_base, 4398 .get_cached_segment_base = emulator_get_cached_segment_base,
4389 .get_gdt = emulator_get_gdt, 4399 .get_gdt = emulator_get_gdt,
4390 .get_idt = emulator_get_idt, 4400 .get_idt = emulator_get_idt,
4401 .set_gdt = emulator_set_gdt,
4402 .set_idt = emulator_set_idt,
4391 .get_cr = emulator_get_cr, 4403 .get_cr = emulator_get_cr,
4392 .set_cr = emulator_set_cr, 4404 .set_cr = emulator_set_cr,
4393 .cpl = emulator_get_cpl, 4405 .cpl = emulator_get_cpl,
@@ -5049,20 +5061,6 @@ int kvm_fix_hypercall(struct kvm_vcpu *vcpu)
5049 rip, instruction, 3, NULL); 5061 rip, instruction, 3, NULL);
5050} 5062}
5051 5063
5052void realmode_lgdt(struct kvm_vcpu *vcpu, u16 limit, unsigned long base)
5053{
5054 struct desc_ptr dt = { limit, base };
5055
5056 kvm_x86_ops->set_gdt(vcpu, &dt);
5057}
5058
5059void realmode_lidt(struct kvm_vcpu *vcpu, u16 limit, unsigned long base)
5060{
5061 struct desc_ptr dt = { limit, base };
5062
5063 kvm_x86_ops->set_idt(vcpu, &dt);
5064}
5065
5066static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i) 5064static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i)
5067{ 5065{
5068 struct kvm_cpuid_entry2 *e = &vcpu->arch.cpuid_entries[i]; 5066 struct kvm_cpuid_entry2 *e = &vcpu->arch.cpuid_entries[i];