Node:Interrupt Handling, Next:, Previous:V86 Mode, Up:Top

13 Interrupt Handling in Protected Mode

Interrupt Handling is one of the most important tasks of any operating system. In particular, without handling the hardware interrupts correctly, anything could happen. The system could crash or cause unusual problems. This section gives an overview of interrupt handling in Protected Mode and V86 Mode.

Interrupt handling in Protected Mode has been mentioned previously in this document. See Exceptions.

Interrupt handling in V86 mode is slighly more complex. Although the processor is in V86 mode, the interrupt handling still occurs in protected mode. Since the segment registers will most probably contain garbage values for the selectors, the 386 zeros all segment registers before calling the appropriate interrupt handler. Keep in mind that we're talking of hardware interrupts here, not the ones generated by the INT instruction. The SS will contain the selector for the PL0 stack in the Task State Segment. The structure of the VM86 stack frame which is pushed into the PL0 stack is as shown in the figure below.

fig9.jpg

When the General Protection Fault occurs, it can be either due to the fact that a V86 task was interrupted or it could be due to an interrupt in a true protected mode program. To differentiate between the two, the handler can look at the EFLAGS register to check if a V86 task was running. If a V86 task generated the interrupt, the interrupt handler can look at the offending instruction. Once the cause of interrupt is known, the operating system can choose to emulate the instruction (instructions like CLI, STI, etc.). or simply terminate the program or take any other action.



Copyright (C) 2000, 2001 Prashant TR. All rights reserved.