How to automatically close `qemu` execution after the process terminates?

I want the qemu window to automatically close after starting pintOS after opening and displaying the output

As when running the pintos -- run alarm-multiple command in tcsh , qemu shows that the process starts, then several alarm-notifications , and then the process ends, but after that the qemu window does not close

I want to exit the window after the successful completion of my system call.

+6
source share
1 answer

UPDATED:


New solution

Here is another best solution that will work for both pintos run ... and make grade

add this line to devices / shutdown.c :: shutdown_power_off (void) before the loop.

 outw( 0x604, 0x0 | 0x2000 ); 

Old decision

For new versions of qemu, you need to run it using the option

 -device isa-debug-exit 

The output from any entry to the I / O port is 0x501 by default

, i.e. in the pintos project in the src / utils directory, you need to add one line in pintos strong> in the run_qemu routine

 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 the shutdown.c file in the device directory add this line to 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 exit code is doubled plus one, so there is no way to exit it cleanly. Use 0x31, which should result in qemu 0x63 exit code

finally run pintos with the -q option

 pintos -q run alarm-multiple 
  • Note. This solution will not work for make grade , see the comment below @ pranav3688 for the solution.
+2
source

Source: https://habr.com/ru/post/1014943/


All Articles