aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/lguest/x86/core.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 1a83910f674f..eaf722fe309a 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -358,6 +358,16 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
358 if (emulate_insn(cpu)) 358 if (emulate_insn(cpu))
359 return; 359 return;
360 } 360 }
361 /* If KVM is active, the vmcall instruction triggers a
362 * General Protection Fault. Normally it triggers an
363 * invalid opcode fault (6): */
364 case 6:
365 /* We need to check if ring == GUEST_PL and
366 * faulting instruction == vmcall. */
367 if (is_hypercall(cpu)) {
368 rewrite_hypercall(cpu);
369 return;
370 }
361 break; 371 break;
362 case 14: /* We've intercepted a Page Fault. */ 372 case 14: /* We've intercepted a Page Fault. */
363 /* The Guest accessed a virtual address that wasn't mapped. 373 /* The Guest accessed a virtual address that wasn't mapped.
@@ -403,15 +413,6 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
403 * up the pointer now to indicate a hypercall is pending. */ 413 * up the pointer now to indicate a hypercall is pending. */
404 cpu->hcall = (struct hcall_args *)cpu->regs; 414 cpu->hcall = (struct hcall_args *)cpu->regs;
405 return; 415 return;
406 case 6:
407 /* kvm hypercalls trigger an invalid opcode fault (6).
408 * We need to check if ring == GUEST_PL and
409 * faulting instruction == vmcall. */
410 if (is_hypercall(cpu)) {
411 rewrite_hypercall(cpu);
412 return;
413 }
414 break;
415 } 416 }
416 417
417 /* We didn't handle the trap, so it needs to go to the Guest. */ 418 /* We didn't handle the trap, so it needs to go to the Guest. */