How to Automatically Close The Execution of The 'Qemu' After End of Process

How to automatically close the execution of the `qemu` after end of process?

UPDATED:


The new solution

Here is another better 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 ); 

The old Solution

For the newer versions of qemu you need to run it with the option

-device isa-debug-exit

Which exits on any write to an IO port, by default it's 0x501

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);
}

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'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

finally run pintos with -q option

pintos -q run alarm-multiple
  • Note: this solution will not work for make grade see the comment below by @pranav3688 for a solution.

How to cleanly exit QEMU after executing bare metal program without user intervention?

The cleanest option for me was to grab the source for a stable version of Qemu close to the one we were already using. The following refers to version 1.1.2 of the Qemu source.

I modified the emulation of the reset vector handling for the Cortex M3 + Stellaris LM3S6965 eval board in armv7m_nvic.c. I replaced the hw_error() call with a call to qemu_system_reset_request(). This internal system call will reset a virtual machine but also responds to the -no-reboot command line option for a clean shutdown as discussed in my original question.

These build instructions worked for me after grabbing a snapshot of Qemu 1.1.2. I encountered several build errors, but web searches quickly resolved each issue.

How can I close the terminal window after launching a program using ANT's exec?

This works fine:

<exec executable="/bin/sh">
<arg value="-c"/>
<arg value="nohup evince /home/my.pdf >> /dev/null & exit"/>
</exec>

Qemu cannot recognize file changes immediately

When you are finished updating / deleting / copying files you should use the umount command to unmount the directory when finished. That will ensure all the file updates are complete. At that point try running it in QEMU. My guess is that you are keeping the file system mounted while running QEMU. That can cause the type of problems you seem to be observing.

How to close down Android SDK emulator after running tests

Appium does not let you terminate emulator instances. But you can use adb to shut them down. Incorporate something like below into your tear down code.

string cmdstr;
cmdstr="adb -s emulator-5554 emu kill"
System.Diagnostics.Process.Start("CMD.exe",cmdstr);

Android Emulator issues in new versions - The emulator process has terminated

It's an issue of latest Emulator.

I upgraded to v30.6.4 last night and got the same issue.

Please use Genymotion instead before Android Studio Emulator issuing its next update.

It's free for personal use.

https://www.genymotion.com/download/

Sample Image



Related Topics



Leave a reply



Submit