kvm: Add proper 00E0 ioport handling

We use 00E0 ioport for trapping to the hypervisor. This patch cleans up
handling of the ioport to call exit() in ioport emulation handler.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
Pekka Enberg
2010-07-04 13:41:45 +03:00
committed by Will Deacon
parent b9bc89d70f
commit cb046752e8
3 changed files with 16 additions and 14 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ bios/int10.o: bios/int10.S bios/int10-real.S
check: $(PROGRAM)
$(MAKE) -C tests
./$(PROGRAM) --dbgtest tests/pit/tick.bin
./$(PROGRAM) tests/pit/tick.bin
.PHONY: check
clean:
+14
View File
@@ -4,6 +4,7 @@
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
static uint8_t ioport_to_uint8(void *data)
@@ -28,6 +29,15 @@ static struct ioport_operations cmos_ram_rtc_ops = {
.io_out = cmos_ram_rtc_io_out,
};
static bool debug_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
{
exit(EXIT_SUCCESS);
}
static struct ioport_operations debug_ops = {
.io_out = debug_io_out,
};
static bool dummy_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
{
return true;
@@ -70,6 +80,10 @@ static struct ioport_operations *ioport_ops[USHRT_MAX] = {
[0x00A0] = &dummy_read_write_ioport_ops,
[0x00A1] = &dummy_read_write_ioport_ops,
/* PORT 00E0-00EF are 'motherboard specific' so we use them for our
internal debugging purposes. */
[0x00E0] = &debug_ops,
/* PORT 00ED - DUMMY PORT FOR DELAY??? */
[0x00ED] = &dummy_write_only_ioport_ops,
+1 -13
View File
@@ -10,11 +10,9 @@
#include <string.h>
#include <stdio.h>
unsigned int dbgtest_mode;
static void usage(char *argv[])
{
fprintf(stderr, " usage: %s [--dbgtest] [--single-step] [--kernel=]<kernel-image>\n",
fprintf(stderr, " usage: %s [--single-step] [--kernel=]<kernel-image>\n",
argv[0]);
exit(1);
}
@@ -55,9 +53,6 @@ int main(int argc, char *argv[])
} else if (option_matches(argv[i], "--params=")) {
kernel_cmdline = &argv[i][9];
continue;
} else if (option_matches(argv[i], "--dbgtest")) {
dbgtest_mode = 1;
continue;
} else if (option_matches(argv[i], "--single-step")) {
single_step = true;
continue;
@@ -137,13 +132,6 @@ int main(int argc, char *argv[])
exit_kvm:
if (dbgtest_mode) {
if (kvm->kvm_run->exit_reason == KVM_EXIT_IO &&
kvm->kvm_run->io.port == 0xe0)
fprintf(stderr, "KVM: this is an expected IO error\n");
goto out;
}
fprintf(stderr, "KVM exit reason: %" PRIu32 " (\"%s\")\n",
kvm->kvm_run->exit_reason, kvm_exit_reasons[kvm->kvm_run->exit_reason]);
if (kvm->kvm_run->exit_reason == KVM_EXIT_UNKNOWN)