For a fun weekend project, I wrote a "DOS extender" that simulates a small subset of the Phar Lap 386|DOS execution environment on Linux. 386|DOS was one of the earliest DOS extenders, and its runtime environment makes surprisingly heavy use of the x86 segmentation feature compared to modern runtime environments that just present a flat address space. Luckily, 386|DOS sets up most of its interesting segments, including the main program segment and the segments used to access the DOS system, in the LDT, and this makes it possible to replicate the environment natively under most modern x86 OSes, which still provide system calls to allow a process to manipulate its own LDT. So by parsing the executable file, loading it into memory, setting up the expected segments in the LDT, and using a SIGSEGV handler to trap int 0x21 DOS syscalls and reimplement them using the host API, we can run simple DOS extender programs under Linux. Here's Phar Lap's own 386ASM and 386LINK developer tools being used to assemble and link one of their example programs, which can then itself be run.