display | more...
The "CLear Interrupt" instruction on x86 processors.

This instruction unsets the Interrupt flag in the FLAGS (or EFLAGS in 32 bit mode) register, stopping interrupts from external sources (except the NMI). To put the interrupt flag back to normal, use the STI (SeT Interrupt) instruction.

This is mainly used for time-critical code that must be executed in real-time, and while doing things which could get messed up if an interrupt occured in the middle. For example, if for some strange reason you wanted to set the stack to DEAD:BEEF, you might try this:

mov ax, 0DEADh
mov ss, ax ; can't access segment registers directly
mov sp, 0BEEFh

It would most likely work, but what if an interrupt occured between setting SS and setting SP? Since interrupts push things onto the stack, something in the DEAD segment could get overwritten. So it would be best to use CLI:

mov ax, 0DEADh
mov ss, ax
mov sp, 0BEEFh

The opcode for CLI is 0xFA.