lkml.org 
[lkml]   [2011]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] kvm tools: fix repeated io emulation
When kvm emulates repeation io read instruction, it can exit to user-space with
'count' > 1, we need to emulate io access for many times
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
tools/kvm/ioport.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c
index 2d69ae4..6b0bd30 100644
--- a/tools/kvm/ioport.c
+++ b/tools/kvm/ioport.c
@@ -129,6 +129,7 @@ bool kvm__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int s
struct ioport_operations *ops;
bool ret = false;
struct ioport *entry;
+ void *ptr = data;

br_read_lock();
entry = ioport_search(&ioport_tree, port);
@@ -137,12 +138,16 @@ bool kvm__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int s

ops = entry->ops;

- if (direction == KVM_EXIT_IO_IN) {
- if (ops->io_in)
- ret = ops->io_in(entry, kvm, port, data, size, count);
- } else {
- if (ops->io_out)
- ret = ops->io_out(entry, kvm, port, data, size, count);
+ while (count--) {
+ if (direction == KVM_EXIT_IO_IN) {
+ if (ops->io_in)
+ ret = ops->io_in(entry, kvm, port, ptr, size, count);
+ } else {
+ if (ops->io_out)
+ ret = ops->io_out(entry, kvm, port, ptr, size, count);
+ }
+
+ ptr += size;
}

br_read_unlock();
--
1.7.5.4

\
 
 \ /
  Last update: 2011-08-18 05:07    [from the cache]
©2003-2011 Jasper Spaans