]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Extract ioport emulation code to its own file
authorPekka Enberg <penberg@cs.helsinki.fi>
Wed, 31 Mar 2010 18:08:16 +0000 (21:08 +0300)
committerPekka Enberg <penberg@cs.helsinki.fi>
Wed, 31 Mar 2010 18:08:16 +0000 (21:08 +0300)
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
tools/kvm/Makefile
tools/kvm/ioport.c [new file with mode: 0644]
tools/kvm/kvm.c

index 99b88c9295f50d12199dc9749c19b4fa30dbf024..da5b18bd574a9633060221088d88ca632acadb83 100644 (file)
@@ -3,6 +3,7 @@ PROGRAM = kvm
 OBJS   += cpu.o
 OBJS   += cpuid.o
 OBJS   += interrupt.o
+OBJS   += ioport.o
 OBJS   += kvm.o
 OBJS   += main.o
 OBJS   += util.o
diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c
new file mode 100644 (file)
index 0000000..7725b5f
--- /dev/null
@@ -0,0 +1,21 @@
+#include "kvm/kvm.h"
+
+#include <stdio.h>
+
+static void kvm__emulate_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+{
+       fprintf(stderr, "%s port=%x, size=%d, count=%" PRIu32 "\n", __func__, port, size, count);
+}
+
+static void kvm__emulate_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
+{
+       fprintf(stderr, "%s port=%x, size=%d, count=%" PRIu32 "\n", __func__, port, size, count);
+}
+
+void kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count)
+{
+       if (direction == KVM_EXIT_IO_IN)
+               kvm__emulate_io_in(self, port, data, size, count);
+       else
+               kvm__emulate_io_out(self, port, data, size, count);
+}
index 0b7776557927f66d96899f424fad99a3ca2ead3c..c651004edd6db5874cd9625625f3dbda783174aa 100644 (file)
@@ -413,24 +413,6 @@ void kvm__run(struct kvm *self)
                die_perror("KVM_RUN failed");
 }
 
-static void kvm__emulate_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
-{
-       fprintf(stderr, "%s port=%x, size=%d, count=%" PRIu32 "\n", __func__, port, size, count);
-}
-
-static void kvm__emulate_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
-{
-       fprintf(stderr, "%s port=%x, size=%d, count=%" PRIu32 "\n", __func__, port, size, count);
-}
-
-void kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count)
-{
-       if (direction == KVM_EXIT_IO_IN)
-               kvm__emulate_io_in(self, port, data, size, count);
-       else
-               kvm__emulate_io_out(self, port, data, size, count);
-}
-
 static void print_segment(const char *name, struct kvm_segment *seg)
 {
        printf(" %s       %04" PRIx16 "      %016" PRIx64 "  %08" PRIx32 "  %02" PRIx8 "    %x %x   %x  %x %x %x %x\n",