miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
qemu_exit.h File Reference

QEMU isa-debug-exit device helper. More...

#include <miniOS/types.h>
Include dependency graph for qemu_exit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void qemu_exit (uint8_t code)
 Exit QEMU via the isa-debug-exit device.

Detailed Description

QEMU isa-debug-exit device helper.

Provides qemu_exit() which triggers QEMU's isa-debug-exit device to exit the emulator with a deterministic exit code. Used by functional tests to signal pass/fail without relying on serial output polling.

isa-debug-exit protocol: QEMU exit code = (value_written_to_port << 1) | 1 qemu_exit(0) -> QEMU exits with code 1 (test PASS) qemu_exit(1) -> QEMU exits with code 3 (test FAIL)

Device must be added to QEMU invocation: -device isa-debug-exit,iobase=0xf4,iosize=0x04

Function Documentation

◆ qemu_exit()

void qemu_exit ( uint8_t code)

Exit QEMU via the isa-debug-exit device.

Writes code to port 0xf4. QEMU translates this to exit code (code << 1) | 1. Call with 0 for PASS (QEMU exits 1), 1 for FAIL (QEMU exits 3).

Parameters
codeExit value to encode. 0 = pass, 1 = fail.

Exit QEMU via the isa-debug-exit device.

QEMU computes exit code as (code << 1) | 1: qemu_exit(0) -> QEMU exits 1 (functional test PASS) qemu_exit(1) -> QEMU exits 3 (functional test FAIL / panic)

If QEMU is not running with -device isa-debug-exit,iobase=0xf4,iosize=0x04 this is a no-op (the port write is ignored).

Here is the call graph for this function:
Here is the caller graph for this function: