This DPMI 0.9 Specification is hosted by Tenberry Software, Inc.

17. Virtual Interrupt State Functions


[Next Section] * [Previous Section] * [DPMI Index]
[Tenberry Home] * [Software Quality] * [DOS/4G] * [DOS/4GW] * [DOS/16M]

Under many implementations of DPMI, the interrupt flag in protected mode will always be set (interrupts enabled). This is because the program is running under a protected operating system that can not allow programs to disable physical hardware interrupts. However, the operating system will maintain a "virtual" interrupt state for protected mode programs. When the program executes a cli instruction, the program's virtual interrupt state will be disabled, and the program will not receive any hardware interrupts until it executes an sti to reenable interrupts (or calls service 0901h).

When a protected mode program executes a pushf instruction, the real processor flags will be pushed onto the stack. Thus, examining the flags pushed on the stack is not sufficient to determine the state of the program's virtual interrupt flag. These services enable programs to get and modify the state of their virtual interrupt flag.

The following sample code enters an interrupt critical section and then restores the virtual interrupt state to it's previous state.

     ;
     ; Disable interrupts and get previous interrupt state
     ;
             mov     ax, 0900h
             int     31h
     ;
     ; At this point AX = 0900h or 0901h
     ;
             .
             .
             .
     ;
     ; Restore previous state (assumes AX unchanged)
     ;
             int     31h

17.1 Get and Disable Virtual Interrupt State

This function will disable the virtual interrupt flag and return the previous state of the virtual interrupt flag.

To Call

     AX = 0900h

Returns

     Carry flag clear (this function always succeeds)
     Virtual interrupts are disabled
     AL = 0 if virtual interrupts were previously disabled
     AL = 1 if virtual interrupts were previously enabled

Programmer's Notes


17.2 Get and Enable Virtual Interrupt State

This function will enable the virtual interrupt flag and return the previous state of the virtual interrupt flag.

To Call

     AX = 0901h

Returns

     Carry flag clear (this function always succeeds)
     Virtual interrupts are enabled
     AL = 0 if virtual interrupts were previously disabled
     AL = 1 if virtual interrupts were previously enabled

Programmer's Notes


17.3 Get Virtual Interrupt State

This function will return the current state of the virtual interrupt flag.

To Call

     AX = 0902h

Returns

     Carry flag clear (this function always succeeds)
     AL = 0 if virtual interrupts are disabled
     AL = 1 if virtual interrupts are enabled

Programmer's Notes

None.


[Next Section] * [Previous Section] * [DPMI Index]
[Tenberry Home] * [Software Quality] * [DOS/4G] * [DOS/4GW] * [DOS/16M]
This HTML edition of the DPMI 0.9 Specification is hosted by Tenberry Software, Inc., makers of the DOS/16M and the DOS/4G family of DOS extenders. Page last modified 2003.1.28, <webmaster@tenberry.com>