V86-64

This is a simple linux kernel patch which allows legacy 8086 programs to run on modern x86-64 AMD and Intel processors. Currently 64-bit version of linux kernel lacks support of V86 mode because it is not supported in native operating mode (long mode) of these processors. But these processors still have possibility to run 8086 programs in legacy x86 mode. This patch exploits this feature.

Currently only vm86() system call is supported for 32-bit linux programs. The vm86_old() system call is not currently supported. Also added device driver interface to virtual 8086 mode which also accessible from 64-bit userspace.

DOSEMU 1.4.0 / 1.2.2 works (tested with FreeDOS and PC-DOS 2000, Microsoft Windows 3.1 (DOSEMU 1.4.0)). DPMI also works.

This patch is very experimental. Use it on you risk. It needs to be heavily tested. Please send me email if you discover a bug to vladimir32_SPAMMERS_MUST_DIE_gmail.com (replace "_SPAMMERS_MUST_DIE_" by "@" :). Please attatch your dmesg log.

Latest version of patch can be found here.

To install, apply patch to your kernel source tree.
For example: cd /usr/src; bunzip2 </path/to/v86-64-YYYYMMDD-X.X.XX.patch.bz2 | patch -p0
Source tree is expected to be located in directory "linux"
Then go to menuconfig and select "Executable file formats / Emulations ---> Virtual 8086 mode support" and rebuild a kernel.
Your kernel will have vm86() system call for 32-bit programs and DOSEMU will run 8086 code natively.
Direct I/O access and IRQ redirect should also work.
NOTE: You need 32-bit i386 version of DOSEMU, not x86-64!

It's also possible to build 64-bit DOSEMU version which can use /dev/v86 interface by patching it with v86dev patch which can be found on v86-64 download page. Currently it's not heavily tested and breaks internal CPU emulator due to longword size mismatch. After patching DOSEMU should be built with --disable-cpuemu option.

Changes since 20070607:

  • Fixed build on new kernels (2.6.24 and newer);
  • kernel patch no longer supported, only v86dev driver;
  • added LD_PRELOAD'able patch for 32-bit DOSEMU;
  • added simple patch for WINE which allows its dos VM work;
  • some bugs have been fixed.
  • This project is hosted by
    SourceForge.net Logo
    Russian
    Project
    Site