There have been various kvm bugs that prevent reboots from working properly. Generalize the existing test for a failed reboot to better catch these cases.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/resume.c | 9 +++++++++ src/shadow.c | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/resume.c b/src/resume.c index 784abac..9466480 100644 --- a/src/resume.c +++ b/src/resume.c @@ -123,10 +123,19 @@ s3_resume(void) farcall16big(&br); }
+u8 HaveAttemptedReboot VARLOW; + // Attempt to invoke a hard-reboot. static void tryReboot(void) { + if (HaveAttemptedReboot) { + // Hard reboot has failed - try to shutdown machine. + dprintf(1, "Unable to hard-reboot machine - attempting shutdown.\n"); + apm_shutdown(); + } + HaveAttemptedReboot = 1; + dprintf(1, "Attempting a hard reboot\n");
// Setup for reset on qemu. diff --git a/src/shadow.c b/src/shadow.c index 0aac60b..e971fe9 100644 --- a/src/shadow.c +++ b/src/shadow.c @@ -169,8 +169,4 @@ qemu_prep_reset(void) extern u8 code32flat_start[], code32flat_end[]; memcpy(code32flat_start, code32flat_start + BIOS_SRC_OFFSET , code32flat_end - code32flat_start); - - if (HaveRunPost) - // Memory copy failed to work - try to halt the machine. - apm_shutdown(); }