## Physical Device Driver Reference

[prev][next][parent][TOC]

### Processing the Interrupt

STI ENTRY RULE

Interrupt handlers that share interrupts are entered with processor interrupts enabled. This prevents the lockout of higher priority hardware interrupts because the search for the owner of the current interrupt level takes a variable amount of time. Interrupt handlers that do not share interrupts are entered with processor interrupts disabled.

IRQ OWNERSHIP RULE

The physical device driver interrupt handler, when started, must always interrogate its device to see if the device caused the interrupt. If the interrupt handler's device caused the interrupt, then the handler owns the processing of the interrupt and can briefly disable processor interrupts for critical operations. It must issue the EOI as soon as possible and must be aware that once it does so, it could be reentered at its interrupt handler's entry point. If the interrupt handler's device did not cause the interrupt, the handler must not issue an EOI.

INT RETURN RULE

The interrupt handler, after taking the appropriate action in processing the interrupt, must return an indication of whether it claimed the interrupt. If the handler owns the interrupt, then it must clear the carry flag (CF=0) and issue a far return (far ret) when processing is complete. If the handler does not own the interrupt, then it must set the carry flag (CF=1) and issue a far return.

SEARCH RULE

The operating system calls each interrupt handler registered for a particular interrupt level until one of the interrupt handlers claims the interrupt. If no interrupt handler claims the interrupt, then the IRQ is disabled.

EOI RULE

Management of the 8259 interrupt controllers is the responsibility of the operating system. However, the End-Of-Interrupt (EOI) is the responsibility of the interrupt handler. The handler must use the DevHlp_ EOI service to issue the EOI as soon as possible in the processing of its interrupt. This permits the 8259 interrupt controller to process other interrupt requests at the current interrupt priority, as well as interrupt requests of lower priorities. In a level-sensitive interrupt environment, the EOI must not be issued to the 8259 interrupt controllers until the interrupt condition at the device is removed.

PhysToVirt RULE

Selectors used for PhysToVirt represent a critical resource. An interrupt handler that uses PhysToVirt must not issue the EOI until after it no longer needs the addresses generated by PhysToVirt. Otherwise, the interrupt handler must disable processor interrupts before issuing the EOI. This allows the interrupt handler to use the temporary selectors for its interrupt level without getting another interrupt on its level. However, this does not apply to the selectors obtained by the DevHlp_AllocGDT.

POSITION RULE

An interrupt handler that shares an interrupt level must not depend on its position in the list of handlers for that interrupt level.