Old DOS Programs
Some old DOS programs that use a protected mode DOS extender and install their own interrupt handlers (usually games) use the CLI instruction in the handlers to disable interrupts and either POPF (after a corresponding PUSHF) or IRET (which restores the flags from the stack as part of its effects) to restore it. This works in real mode, but causes problems when such programs are run in a virtual-8086 (V86) based container on modern operating systems (such as NTVDM under Windows 2000 or later). Since CLI is a privileged instruction, it triggers a fault into the operating system when the program attempts to use it. The OS then typically stops delivering interrupts to the program until the program executes STI (which would cause another fault). However, the POPF instruction is not privileged and simply fails silently to restore the IF. The result is that the OS stops delivering interrupts to the program, which then hangs. DOS programs that do not use a protected mode extender do not suffer from this problem, as they execute in V86 mode where POPF does trigger a fault.
There are few satisfactory resolutions to this issue. It is usually not possible to modify the program as source code is typically not available and there is no room in the instruction stream to introduce a STI without massive editing at the assembly level. Removing CLI's from the program or causing the V86 host to ignore CLI completely might cause other bugs if the guest's interrupt handlers are not re-entrant safe (though when executed on a modern processor, they typically execute fast enough to avoid overlapping of interrupts).
Read more about this topic: Interrupt Flag, Privilege Level
Famous quotes containing the words dos and/or programs:
“In abnormal times like our own, when institutions are changing rapidly in several directions at once and the traditional framework of society has broken down, it becomes more and more difficult to measure any type of behavior against any other.”
—John Dos Passos (18961970)
“Although good early childhood programs can benefit all children, they are not a quick fix for all of societys illsfrom crime in the streets to adolescent pregnancy, from school failure to unemployment. We must emphasize that good quality early childhood programs can help change the social and educational outcomes for many children, but they are not a panacea; they cannot ameliorate the effects of all harmful social and psychological environments.”
—Barbara Bowman (20th century)