Try to detect an unsuccessful hard-reboot to prevent soft-reboot loops.
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>
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 @@
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 @@
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();
}