aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/x86_emulate.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2007-09-17 15:57:50 -0400
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:52:46 -0500
commit7aa81cc04781b5b99a0647ec04533599d78cd219 (patch)
tree6ac8854faf3db2bc499e2c105fdfdab95df52170 /drivers/kvm/x86_emulate.c
parentaca7f96600b170e470b3056aba0ed8d7df8d330d (diff)
KVM: Refactor hypercall infrastructure (v3)
This patch refactors the current hypercall infrastructure to better support live migration and SMP. It eliminates the hypercall page by trapping the UD exception that would occur if you used the wrong hypercall instruction for the underlying architecture and replacing it with the right one lazily. A fall-out of this patch is that the unhandled hypercalls no longer trap to userspace. There is very little reason though to use a hypercall to communicate with userspace as PIO or MMIO can be used. There is no code in tree that uses userspace hypercalls. [avi: fix #ud injection on vmx] Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86_emulate.c')
-rw-r--r--drivers/kvm/x86_emulate.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 84af9cc737fa..f12bc2c74040 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1384,7 +1384,11 @@ twobyte_insn:
1384 if (modrm_mod != 3 || modrm_rm != 1) 1384 if (modrm_mod != 3 || modrm_rm != 1)
1385 goto cannot_emulate; 1385 goto cannot_emulate;
1386 1386
1387 /* nop */ 1387 rc = kvm_fix_hypercall(ctxt->vcpu);
1388 if (rc)
1389 goto done;
1390
1391 kvm_emulate_hypercall(ctxt->vcpu);
1388 break; 1392 break;
1389 case 2: /* lgdt */ 1393 case 2: /* lgdt */
1390 rc = read_descriptor(ctxt, ops, src.ptr, 1394 rc = read_descriptor(ctxt, ops, src.ptr,
@@ -1395,7 +1399,10 @@ twobyte_insn:
1395 break; 1399 break;
1396 case 3: /* lidt/vmmcall */ 1400 case 3: /* lidt/vmmcall */
1397 if (modrm_mod == 3 && modrm_rm == 1) { 1401 if (modrm_mod == 3 && modrm_rm == 1) {
1398 /* nop */ 1402 rc = kvm_fix_hypercall(ctxt->vcpu);
1403 if (rc)
1404 goto done;
1405 kvm_emulate_hypercall(ctxt->vcpu);
1399 } else { 1406 } else {
1400 rc = read_descriptor(ctxt, ops, src.ptr, 1407 rc = read_descriptor(ctxt, ops, src.ptr,
1401 &size, &address, 1408 &size, &address,