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:
“The only way to find out anything about what kinds of lives people led in any given period is to tunnel into their records and to let them speak for themselves.”
—John Dos Passos (18961970)
“We attempt to remember our collective American childhood, the way it was, but what we often remember is a combination of real past, pieces reshaped by bitterness and love, and, of course, the video pastthe portrayals of family life on such television programs as Leave it to Beaver and Father Knows Best and all the rest.”
—Richard Louv (20th century)