From 62ef45dc93074243186f9c12d47857bfcae09344 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sun, 4 Jul 2010 14:02:05 +0300 Subject: [PATCH] kvm: Don't stop on ioport errors by default This patch introduces a '--ioport-debug' option that preserves the old stop-on-error behavior and changes the default to keep on running despite of ioport errors. This allows Linux kernel to boot to VFS mount phase. Signed-off-by: Pekka Enberg --- ioport.c | 9 +++++++-- main.c | 13 +++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ioport.c b/ioport.c index 4bcc2b7..a06bcb4 100644 --- a/ioport.c +++ b/ioport.c @@ -2,11 +2,14 @@ #include "kvm/kvm.h" +#include #include #include #include #include +bool ioport_debug; + static uint8_t ioport_to_uint8(void *data) { uint8_t *p = data; @@ -150,6 +153,8 @@ bool kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, } return true; error: - ioport_error(port, data, direction, size, count); - return false; + if (ioport_debug) + ioport_error(port, data, direction, size, count); + + return !ioport_debug; } diff --git a/main.c b/main.c index 962c2c2..e4dda8c 100644 --- a/main.c +++ b/main.c @@ -10,9 +10,11 @@ #include #include +extern bool ioport_debug; + static void usage(char *argv[]) { - fprintf(stderr, " usage: %s [--single-step] [--params=] [--kernel=]\n", + fprintf(stderr, " usage: %s [--single-step] [--ioport-debug] [--params=] [--kernel=]\n", argv[0]); exit(1); } @@ -48,13 +50,16 @@ int main(int argc, char *argv[]) for (i = 1; i < argc; i++) { if (option_matches(argv[i], "--kernel=")) { - kernel_filename = &argv[i][9]; + kernel_filename = &argv[i][9]; continue; } else if (option_matches(argv[i], "--params=")) { - kernel_cmdline = &argv[i][9]; + kernel_cmdline = &argv[i][9]; continue; } else if (option_matches(argv[i], "--single-step")) { - single_step = true; + single_step = true; + continue; + } else if (option_matches(argv[i], "--ioport-debug")) { + ioport_debug = true; continue; } else { /* any unspecified arg is kernel image */