summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2011-08-18 11:06:54 +0800
committerPekka Enberg <penberg@kernel.org>2011-08-19 13:41:55 +0300
commit540f0ff98c14e03d098bbde2586cdcd27284809d (patch)
treeedcfe3120827603cf3fe95ae031858fd9f47485c /tools
parenta66148aa576dbd1ffd69694343cedf8adc332930 (diff)
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> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/kvm/ioport.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c
index 2d69ae4c3397..6b0bd30ce751 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();