aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.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/emulate.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/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 0ff7d4bd1bb..57e0e291b38 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3494,6 +3494,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
3494 int rc = X86EMUL_CONTINUE; 3494 int rc = X86EMUL_CONTINUE;
3495 int saved_dst_type = c->dst.type; 3495 int saved_dst_type = c->dst.type;
3496 int irq; /* Used for int 3, int, and into */ 3496 int irq; /* Used for int 3, int, and into */
3497 struct desc_ptr desc_ptr;
3497 3498
3498 ctxt->decode.mem_read.pos = 0; 3499 ctxt->decode.mem_read.pos = 0;
3499 3500
@@ -4005,9 +4006,6 @@ twobyte_insn:
4005 switch (c->b) { 4006 switch (c->b) {
4006 case 0x01: /* lgdt, lidt, lmsw */ 4007 case 0x01: /* lgdt, lidt, lmsw */
4007 switch (c->modrm_reg) { 4008 switch (c->modrm_reg) {
4008 u16 size;
4009 unsigned long address;
4010
4011 case 0: /* vmcall */ 4009 case 0: /* vmcall */
4012 if (c->modrm_mod != 3 || c->modrm_rm != 1) 4010 if (c->modrm_mod != 3 || c->modrm_rm != 1)
4013 goto cannot_emulate; 4011 goto cannot_emulate;
@@ -4023,10 +4021,11 @@ twobyte_insn:
4023 break; 4021 break;
4024 case 2: /* lgdt */ 4022 case 2: /* lgdt */
4025 rc = read_descriptor(ctxt, ops, c->src.addr.mem, 4023 rc = read_descriptor(ctxt, ops, c->src.addr.mem,
4026 &size, &address, c->op_bytes); 4024 &desc_ptr.size, &desc_ptr.address,
4025 c->op_bytes);
4027 if (rc != X86EMUL_CONTINUE) 4026 if (rc != X86EMUL_CONTINUE)
4028 goto done; 4027 goto done;
4029 realmode_lgdt(ctxt->vcpu, size, address); 4028 ctxt->ops->set_gdt(ctxt, &desc_ptr);
4030 /* Disable writeback. */ 4029 /* Disable writeback. */
4031 c->dst.type = OP_NONE; 4030 c->dst.type = OP_NONE;
4032 break; 4031 break;
@@ -4041,11 +4040,12 @@ twobyte_insn:
4041 } 4040 }
4042 } else { 4041 } else {
4043 rc = read_descriptor(ctxt, ops, c->src.addr.mem, 4042 rc = read_descriptor(ctxt, ops, c->src.addr.mem,
4044 &size, &address, 4043 &desc_ptr.size,
4044 &desc_ptr.address,
4045 c->op_bytes); 4045 c->op_bytes);
4046 if (rc != X86EMUL_CONTINUE) 4046 if (rc != X86EMUL_CONTINUE)
4047 goto done; 4047 goto done;
4048 realmode_lidt(ctxt->vcpu, size, address); 4048 ctxt->ops->set_idt(ctxt, &desc_ptr);
4049 } 4049 }
4050 /* Disable writeback. */ 4050 /* Disable writeback. */
4051 c->dst.type = OP_NONE; 4051 c->dst.type = OP_NONE;