4 ms·
To add to what userbinator said, you can have 16-bit code segments in long mode. I've played around with this a bit, and made a minimal proof-of-concept "DOS em
by rep_lodsb 2y ago
To add to what userbinator said, you can have 16-bit code segments in long mode. I've played around with this a bit, and made a minimal proof-of-concept "DOS emulator": an INT 21h from the 16-bit segment causes a SIGSEGV, which is intercepted by 32-bit code and turned into the corresponding Linux INT 80h syscall. All running on a standard 64-bit kernel with no dependency on any external libraries.
(I'm not planning to publish this, and it's very minimal: the only supported syscalls are read, write and exit, and the program needs to have exactly two segments, CS and DS=initial SS as defined in the EXE header. But it should be theoretically possible to make something more elaborate that can run at least a few "well-behaved" normal DOS programs, as long as they don't do any arithmetic on segment registers.)
What's no longer available in long mode is the virtual 8086 mode, for that you'd need to use either the more modern virtualization features (with "unrestricted guest" support), or a software emulator.