diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2013-08-13 14:43:57 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-08-20 18:37:17 +0200 |
commit | 354678c5ce162649906e4e1be2859f3df372668f (patch) | |
tree | 312a725f005b45ff380faa3a3409d121e133ed79 /kvm-all.c | |
parent | df67696e97d3edd0cb1683bf2eb3b3236bd9a5ed (diff) |
kvm: Simplify kvm_handle_io
Now that cpu_in/out is just a wrapper around address_space_rw, we can
also call the latter directly. As host endianness == guest endianness,
there is no need for the memory access helpers st*_p/ld*_p as well.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r-- | kvm-all.c | 28 |
1 files changed, 2 insertions, 26 deletions
@@ -1508,32 +1508,8 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size, uint8_t *ptr = data; for (i = 0; i < count; i++) { - if (direction == KVM_EXIT_IO_IN) { - switch (size) { - case 1: - stb_p(ptr, cpu_inb(port)); - break; - case 2: - stw_p(ptr, cpu_inw(port)); - break; - case 4: - stl_p(ptr, cpu_inl(port)); - break; - } - } else { - switch (size) { - case 1: - cpu_outb(port, ldub_p(ptr)); - break; - case 2: - cpu_outw(port, lduw_p(ptr)); - break; - case 4: - cpu_outl(port, ldl_p(ptr)); - break; - } - } - + address_space_rw(&address_space_io, port, ptr, size, + direction == KVM_EXIT_IO_OUT); ptr += size; } } |