From b257cc57cf50704c785d1a3b02badcb166a19ebe Mon Sep 17 00:00:00 2001 From: Felipe Boeira Date: Mon, 21 Jan 2019 13:22:57 +0100 Subject: Fixed bugs for execution on newer software --- src/threads/init.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/threads') diff --git a/src/threads/init.c b/src/threads/init.c index 0e97c39..3ad3f07 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -374,6 +374,15 @@ power_off (void) printf ("Powering off...\n"); serial_flush (); outw(0xB004, 0x2000); + outb(0xF4, 0x30); + + /* 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); + for (p = s; *p != '\0'; p++) outb (0x8900, *p); asm volatile ("cli; hlt" : : : "memory"); -- cgit v1.2.1