aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-03-18 09:20:03 -0400
committerAvi Kivity <avi@redhat.com>2010-05-17 05:15:54 -0400
commit52a4661737ecc918633f6b05c611a4af4b5eae5a (patch)
tree25bf976f23423db921b5edde6854f0dc8391eb1c /arch/x86/kvm/emulate.c
parent6ce5a090a9a0ea4266a2cad058c69e2f27201e11 (diff)
KVM: Provide callback to get/set control registers in emulator ops.
Use this callback instead of directly call kvm function. Also rename realmode_(set|get)_cr to emulator_(set|get)_cr since function has nothing to do with real mode. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 91450b5cd49e..5b060e4be0e3 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2483,7 +2483,7 @@ twobyte_insn:
2483 break; 2483 break;
2484 case 4: /* smsw */ 2484 case 4: /* smsw */
2485 c->dst.bytes = 2; 2485 c->dst.bytes = 2;
2486 c->dst.val = realmode_get_cr(ctxt->vcpu, 0); 2486 c->dst.val = ops->get_cr(0, ctxt->vcpu);
2487 break; 2487 break;
2488 case 6: /* lmsw */ 2488 case 6: /* lmsw */
2489 realmode_lmsw(ctxt->vcpu, (u16)c->src.val, 2489 realmode_lmsw(ctxt->vcpu, (u16)c->src.val,
@@ -2519,8 +2519,7 @@ twobyte_insn:
2519 case 0x20: /* mov cr, reg */ 2519 case 0x20: /* mov cr, reg */
2520 if (c->modrm_mod != 3) 2520 if (c->modrm_mod != 3)
2521 goto cannot_emulate; 2521 goto cannot_emulate;
2522 c->regs[c->modrm_rm] = 2522 c->regs[c->modrm_rm] = ops->get_cr(c->modrm_reg, ctxt->vcpu);
2523 realmode_get_cr(ctxt->vcpu, c->modrm_reg);
2524 c->dst.type = OP_NONE; /* no writeback */ 2523 c->dst.type = OP_NONE; /* no writeback */
2525 break; 2524 break;
2526 case 0x21: /* mov from dr to reg */ 2525 case 0x21: /* mov from dr to reg */
@@ -2534,7 +2533,7 @@ twobyte_insn:
2534 case 0x22: /* mov reg, cr */ 2533 case 0x22: /* mov reg, cr */
2535 if (c->modrm_mod != 3) 2534 if (c->modrm_mod != 3)
2536 goto cannot_emulate; 2535 goto cannot_emulate;
2537 realmode_set_cr(ctxt->vcpu, c->modrm_reg, c->modrm_val); 2536 ops->set_cr(c->modrm_reg, c->modrm_val, ctxt->vcpu);
2538 c->dst.type = OP_NONE; 2537 c->dst.type = OP_NONE;
2539 break; 2538 break;
2540 case 0x23: /* mov from reg to dr */ 2539 case 0x23: /* mov from reg to dr */