Posts: 2
Joined: Sun Jul 01, 2018 1:32 am

Shutting Down QEMU

Mon Oct 15, 2018 3:00 pm

I'm working on setting up integration tests for a OS I'm writing for the RPi and would like a way to signal QEMU to exit. I'm using the watchdog to reboot the physical RPi, but this doesn't seem to work for QEMU. Is there a way to shutdown QEMU or do I have to do so from outside QEMU?

Posts: 31
Joined: Mon Jan 15, 2018 12:14 am

Re: Shutting Down QEMU

Mon Oct 22, 2018 1:10 pm

You can use the smihosting API. This is what I have:

Code: Select all

  mov w0, 0x18
  mov x1, #0x20000
  add x1, x1, #0x26
  hlt #0xF000
Then run Qemu like this:

Code: Select all

qemu-system-aarch64 -M raspi3 -semihosting -kernel build/kernel.bin
And it works for me

Return to “Bare metal, Assembly language”