如何在进程结束后自动关闭`qemu`的执行?

2024-02-23

我想要的是qemu打开并显示输出后的窗口运行后自动关闭pintOS

就像我运行命令时一样pintos -- run alarm-multiple in tcshshell,qemu 显示过程开始,然后一些alarm-notifications然后是过程结束,但之后 qemu 窗口不会关闭

我想在成功完成系统调用后退出窗口。


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 下面的评论以获取解决方案。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在进程结束后自动关闭`qemu`的执行? 的相关文章

随机推荐