4 ms·
From a quick skim through the code: - it first, if not yet present, starts Linux, via normal Linux kernel load. It passes over some pointers from DOS into /ini
by q3k 6y ago
From a quick skim through the code:
- it first, if not yet present, starts Linux, via normal Linux kernel load. It passes over some pointers from DOS into /init arguments so that /init can know about DOS' context when Linux was first loaded
- Linux's /init then uses VM86 [1] to call back into DOS, back to the function that was run in DOS before Linux was loaded (vm86_return). This is a bit of a 'draw the rest of the fucking owl' deal, as it has to actually emulate a lot of DOS/PC behaviour (emulate INB/OUTB, etc). It's basically a small VM, like with KVM, but for 16-bit DOS.
- when DOS wants to run a Linux command, it now uses a special new interrupt (DOSLINUX_INT) to call into the kernel. This in turn triggers a VM86 exit, jumps into the VM86 monitor in /init, executes the command, and pokes the result back into DOS, resuming VM86 emulation.
[1] - https://en.wikipedia.org/wiki/Virtual_8086_mode https://en.wikipedia.org/wiki/Virtual_8086_mode