UPDATED:
新的解决方案
这是另一个对双方都适用的更好的解决方案pintos run ...
and make grade
将此行添加到设备/shutdown.c :: shutdown_power_off(无效)在循环之前。
outw( 0x604, 0x0 | 0x2000 );
旧的解决方案
对于较新版本的 qemu,您需要使用以下选项运行它
-device isa-debug-exit
任何写入 IO 端口时都会退出,默认为 0x501
i.e在你的pintos下的项目源代码/实用程序您需要在目录中添加一行pintos文件在run_qemu子程序
sub run_qemu {
print "warning: qemu doesn't support --terminal\n"
if $vga eq 'terminal';
print "warning: qemu doesn't support jitter\n"
if defined $jitter;
my (@cmd) = ('qemu-system-i386');
push (@cmd, '-device', 'isa-debug-exit'); # <====== add this line
..
..
push (@cmd, '-monitor', 'null') if $vga eq 'none' && $debug eq 'none';
run_command (@cmd);
}
and in 关机.c文件下的devices目录
添加这一行关机电源关闭for循环之后的函数
for (p = s; *p != '\0'; p++)
outb (0x8900, *p);
outb (0x501, 0x31); // <====== add this line
Qemu的退出代码是该值的两倍加一,因此没有办法干净地退出。使用 0x31 应该会导致 qemu 退出代码为 0x63
最后使用 -q 选项运行 pintos
pintos -q run alarm-multiple
- 注意:此解决方案不适用于
make grade
请参阅@pranav3688 下面的评论以获取解决方案。