From: John Ousterhout Date: Thu, 17 Dec 2015 19:38:47 +0000 (-0800) Subject: Updates for new version of qemu X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47747baf50a7db012348a4954b97fc161bcacd19;p=pintos-anon Updates for new version of qemu Use new isa-debug-exit device for shutdown, switch name to qemu-system-i386. --- diff --git a/src/devices/shutdown.c b/src/devices/shutdown.c index 61c76f7..da94c52 100644 --- a/src/devices/shutdown.c +++ b/src/devices/shutdown.c @@ -107,6 +107,13 @@ shutdown_power_off (void) for (p = s; *p != '\0'; p++) outb (0x8900, *p); + /* For newer versions of qemu, you must run with -device + * isa-debug-exit, which exits on any write to an IO port (by + * default 0x501). Qemu's exit code is double the value plus one, + * so there is no way to exit cleanly. We use 0x31 which should + * result in a qemu exit code of 0x63. */ + outb (0x501, 0x31); + /* This will power off a VMware VM if "gui.exitOnCLIHLT = TRUE" is set in its configuration file. (The "pintos" script does that automatically.) */ diff --git a/src/utils/pintos b/src/utils/pintos index 909df83..eca4708 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -618,7 +618,9 @@ sub run_qemu { if $vga eq 'terminal'; print "warning: qemu doesn't support jitter\n" if defined $jitter; - my (@cmd) = ('qemu'); + my (@cmd) = ('qemu-system-i386'); + push (@cmd, '-device', 'isa-debug-exit'); + push (@cmd, '-hda', $disks[0]) if defined $disks[0]; push (@cmd, '-hdb', $disks[1]) if defined $disks[1]; push (@cmd, '-hdc', $disks[2]) if defined $disks[2]; @@ -857,7 +859,11 @@ sub xsystem { exit 0; } - return $?; + # Kind of a gross hack, because qemu's isa-debug-exit device + # only allows odd-numbered exit values, so we can't exit + # cleanly with 0. We use exit status 0x63 as an alternate + # "clean" exit status. + return ($? != 0x6300) && $?; } }