realemu – software emulation of /dev/realmode


aux/realemu [ -Dpt ] [ -s srvname ] [ -m mountpoint ]


Originally, kernel provided /dev/realmode files with the arch(3) device to access and call the BIOS.

Interrupts had to be disabled and the processor was switched in the legacy 16-bit realmode with memory protection disabled to execute BIOS code.

This is problematic in case the BIOS reprograms hardware currently used by the operating system or when it reenables interrupts or just crashes. This will freeze or reboot the machine with no way to recover or diagnose the problem.

To avoid this, realemu is used to emulate the execution of the BIOS routines by interpreting the machine instructions and intercepting dangerous actions that would compromise the systems stability.

Running realemu with no arguments, it mounts itself before /dev and replaces the original /dev/realmode file in the current namespace.

Then programs like vga(8) can use it to make their BIOS calls.

The D flag will enable debug messages for 9P. The p and t flags control tracing of i/o port access and cpu instructions to stderr (fd 2).

When a srvname is given with the s argument, the default mountpoint is ignored and a 9P channel is created in /srv that can be used to mount the filesystem from another namespace. If a mountpoint is given before the srvname argument then it is ignored, otherwise it will be used.


The realemu process is only needed when accessing /dev/realmode. To invoke a subshell so that realemu exits normally after aux/vga completes:


% @{rfork n; aux/realemu; aux/vga -m vesa -l $vgasize}




vga(8), arch(3)


Realemu first appeared in 9front (April, 2011).