Skip to contentSkip to conversation

vm86: fix IOPL virtualisation

PATCH New Stas Sergeev 1 participant 1 message May 25, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vm86: fix IOPL virtualisation

Hello.

The attached patch implements the following:
http://x86.ddj.com/articles/vme1/vme_overview.htm
---
In addition to moving the VIF to the IF on the stack image, PUSHF always pushes an IOPL image of 3 onto the stack.
---

Many DOS programs, including dos4gw, are checking if they are in a v86 mode by trying to alter IOPL. With that patch they are not get confused under dosemu.
Also the patch fixes what looks like a bug with an IF flag.

arch/i386/kernel/vm86.c +3 -0
@@ -362,6 +362,9 @@
 
 	if (VEFLAGS & VIF_MASK)
 		flags |= IF_MASK;
+	else
+		flags &= ~IF_MASK;
+	flags |= IOPL_MASK;
 	return flags | (VEFLAGS & current->thread.v86mask);
 }