diff options
author | Avi Kivity <avi@qumranet.com> | 2007-02-22 12:39:30 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:23 -0400 |
commit | 46fc1477887c41c8e900f2c95485e222b9a54822 (patch) | |
tree | ef9d4d4b6fc32f3d6b4e77a87d1b47b6da455574 /drivers/kvm/vmx.c | |
parent | 9a2bb7f486dc639a1cf2ad803bf2227f0dc0809d (diff) |
KVM: Do not communicate to userspace through cpu registers during PIO
Currently when passing the a PIO emulation request to userspace, we
rely on userspace updating %rax (on 'in' instructions) and %rsi/%rdi/%rcx
(on string instructions). This (a) requires two extra ioctls for getting
and setting the registers and (b) is unfriendly to non-x86 archs, when
they get kvm ports.
So fix by doing the register fixups in the kernel and passing to userspace
only an abstract description of the PIO to be done.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index a721b60f7385..4d5f40fcb651 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1459,12 +1459,14 @@ static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1459 | = (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_DF) != 0; | 1459 | = (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_DF) != 0; |
1460 | kvm_run->io.rep = (exit_qualification & 32) != 0; | 1460 | kvm_run->io.rep = (exit_qualification & 32) != 0; |
1461 | kvm_run->io.port = exit_qualification >> 16; | 1461 | kvm_run->io.port = exit_qualification >> 16; |
1462 | kvm_run->io.count = 1; | ||
1462 | if (kvm_run->io.string) { | 1463 | if (kvm_run->io.string) { |
1463 | if (!get_io_count(vcpu, &kvm_run->io.count)) | 1464 | if (!get_io_count(vcpu, &kvm_run->io.count)) |
1464 | return 1; | 1465 | return 1; |
1465 | kvm_run->io.address = vmcs_readl(GUEST_LINEAR_ADDRESS); | 1466 | kvm_run->io.address = vmcs_readl(GUEST_LINEAR_ADDRESS); |
1466 | } else | 1467 | } else |
1467 | kvm_run->io.value = vcpu->regs[VCPU_REGS_RAX]; /* rax */ | 1468 | kvm_run->io.value = vcpu->regs[VCPU_REGS_RAX]; /* rax */ |
1469 | vcpu->pio_pending = 1; | ||
1468 | return 0; | 1470 | return 0; |
1469 | } | 1471 | } |
1470 | 1472 | ||