Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Dos Protected Mode Interface - <b>virtual interrupt state functions</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
        VIRTUAL INTERRUPT STATE FUNCTIONS


            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

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson