···16571657 return 0;16581658}1659165916601660+static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)16611661+{16621662+ kvm_run->exit_reason = KVM_EXIT_DEBUG;16631663+ printk(KERN_DEBUG "got vmcall at RIP %08lx\n", vmcs_readl(GUEST_RIP));16641664+ printk(KERN_DEBUG "vmcall params: %08lx, %08lx, %08lx, %08lx\n",16651665+ vcpu->regs[VCPU_REGS_RAX],16661666+ vcpu->regs[VCPU_REGS_RCX],16671667+ vcpu->regs[VCPU_REGS_RDX],16681668+ vcpu->regs[VCPU_REGS_RBP]);16691669+ vcpu->regs[VCPU_REGS_RAX] = 0;16701670+ vmcs_writel(GUEST_RIP, vmcs_readl(GUEST_RIP)+3);16711671+ return 1;16721672+}16731673+16601674/*16611675 * The exit handlers return 1 if the exit was handled fully and guest execution16621676 * may resume. Otherwise they set the kvm_run parameter to indicate what needs···16891675 [EXIT_REASON_MSR_WRITE] = handle_wrmsr,16901676 [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window,16911677 [EXIT_REASON_HLT] = handle_halt,16781678+ [EXIT_REASON_VMCALL] = handle_vmcall,16921679};1693168016941681static const int kvm_vmx_max_exit_handlers =
+18
include/linux/kvm_para.h
···52525353#define KVM_EINVAL 154545555+/*5656+ * Hypercall calling convention:5757+ *5858+ * Each hypercall may have 0-6 parameters.5959+ *6060+ * 64-bit hypercall index is in RAX, goes from 0 to __NR_hypercalls-16161+ *6262+ * 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention6363+ * order: RDI, RSI, RDX, RCX, R8, R9.6464+ *6565+ * 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP.6666+ * (the first 3 are according to the gcc regparm calling convention)6767+ *6868+ * No registers are clobbered by the hypercall, except that the6969+ * return value is in RAX.7070+ */7171+#define __NR_hypercalls 07272+5573#endif