进程结束后如何自动关闭`qemu`的执行? [英] How to automatically close the execution of the `qemu` after end of process?
问题描述
我希望打开并显示输出后的qemu
窗口在运行pintOS
I want that the qemu
window after opening and showing the output automatically closes after running pintOS
就像我在tcsh
shell中运行命令pintos -- run alarm-multiple
一样,qemu显示进程开始,然后一些alarm-notifications
然后进程结束,但是之后,qemu窗口将不会关闭
Like when i run the command pintos -- run alarm-multiple
in tcsh
shell, qemu displays that process begins ,then some alarm-notifications
and then the process ends, but after that the qemu window won't close
我想在成功完成系统调用后退出窗口.
I want to exit the window after successful completion of my system call.
推荐答案
已更新:
新解决方案
这是另一个对 pintos run ...
和 make grade
Here is another better solution that will work for both pintos run ...
and make grade
将此行添加到循环之前的 devices/shutdown.c :: :: shutdown_power_off(void).
add this line to devices/shutdown.c :: shutdown_power_off(void) before the loop.
outw( 0x604, 0x0 | 0x2000 );
旧解决方案
对于较新版本的qemu,您需要使用选项运行它
For the newer versions of qemu you need to run it with the option
-device isa-debug-exit
任何对IO端口的写操作都会退出,默认情况下为0x501
Which exits on any write to an IO port, by default it's 0x501
ie ,您需要在 pintos 中添加一行 run_qemu 子例程
i.e in your pintos project under the src/utils directory you will need to add one line to the pintos file in the run_qemu subroutine
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);
}
和 devices 目录下的 shutdown.c 文件中 在for循环后的 shutdown_power_off 函数中添加此行
and in shutdown.c file under the devices directory add this line in the shutdown_power_off function after the for loop
for (p = s; *p != '\0'; p++)
outb (0x8900, *p);
outb (0x501, 0x31); // <====== add this line
Qemu的退出代码是值的两倍加一,因此无法干净地退出.使用0x31,这将导致qemu退出代码为0x63
Qemu's exit code is double the value plus one, so there is no way to exit cleanly. Use 0x31 which should result in a qemu exit code of 0x63
最终使用-q选项运行pintos
finally run pintos with -q option
pintos -q run alarm-multiple
- 注意:此解决方案不适用于
make grade
,请参阅以下@ pranav3688的注释以获取解决方案.
这篇关于进程结束后如何自动关闭`qemu`的执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!