0

Background: I'm using QEMU to virtualize xv6-riscv on top of WSL2. I'm looking to create some sort of clean OS shutdown process reminiscent of Linux's exit command. Currently I'm using Ctrl-a x to kill qemu, but I want to be able to do this programmatically from within the OS.

I know that the Linux exit command simply closes the current shell, which means I need a kernelspace way of detecting if there's any active shells left and a way of signalling to QEMU that it's turning off. I have full access to the kernel for recompiling, but I can't use external C libraries because there are none. Any solution I develop has to be basically from-scratch.

Thus, my question: What does an operating system need to do to tell a RISC-V QEMU instance that it's turning off? How do you exit QEMU itself from within the OS? This second point is important specifically because I'm instantiating QEMU from a Makefile in a CLI, and I'd like to have access to the terminal after the OS terminates, rather than have QEMU sitting there emulating a RISC-V with nothing on it.

note: This question is different from this other one because I'm asking about a guest OS initiated shutdown rather than a host initiated ACPI shutdown, as well as diving much deeper into the internals of QEMU and operating systems in general.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.