diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-02-19 07:37:47 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-03-04 04:12:40 -0500 |
commit | 102d8325a1d2f266d3d0a03fdde948544e72c12d (patch) | |
tree | 21024c8b9b2b702c79200343e26f14f075da0479 /drivers/kvm/vmx.c | |
parent | 5972e9535e94bf875eb8eab8a667ba04c7583874 (diff) |
KVM: add MSR based hypercall API
This adds a special MSR based hypercall API to KVM. This is to be
used by paravirtual kernels and virtual drivers.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index d1198e2b2b5d..0198d400037f 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1469,6 +1469,18 @@ static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1469 | return 0; | 1469 | return 0; |
1470 | } | 1470 | } |
1471 | 1471 | ||
1472 | static void | ||
1473 | vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall) | ||
1474 | { | ||
1475 | /* | ||
1476 | * Patch in the VMCALL instruction: | ||
1477 | */ | ||
1478 | hypercall[0] = 0x0f; | ||
1479 | hypercall[1] = 0x01; | ||
1480 | hypercall[2] = 0xc1; | ||
1481 | hypercall[3] = 0xc3; | ||
1482 | } | ||
1483 | |||
1472 | static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 1484 | static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
1473 | { | 1485 | { |
1474 | u64 exit_qualification; | 1486 | u64 exit_qualification; |
@@ -2064,6 +2076,7 @@ static struct kvm_arch_ops vmx_arch_ops = { | |||
2064 | .run = vmx_vcpu_run, | 2076 | .run = vmx_vcpu_run, |
2065 | .skip_emulated_instruction = skip_emulated_instruction, | 2077 | .skip_emulated_instruction = skip_emulated_instruction, |
2066 | .vcpu_setup = vmx_vcpu_setup, | 2078 | .vcpu_setup = vmx_vcpu_setup, |
2079 | .patch_hypercall = vmx_patch_hypercall, | ||
2067 | }; | 2080 | }; |
2068 | 2081 | ||
2069 | static int __init vmx_init(void) | 2082 | static int __init vmx_init(void) |