x86 Instruction Set Reference
CLI
Clear Interrupt Flag
Opcode | Mnemonic | Description |
---|---|---|
FA |
CLI |
Clear interrupt flag; interrupts disabled when interrupt flag cleared. |
Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
If protected-mode virtual interrupts are not enabled, CLI clears the IF flag in the EFLAGS register. No other flags are affected. Clearing the IF flag causes the processor to ignore maskable external interrupts. The IF flag and the CLI and STI instruction have no affect on the generation of exceptions and NMI interrupts. When protected-mode virtual interrupts are enabled, CPL is 3, and IOPL is less than 3; CLI clears the VIF flag in the EFLAGS register, leaving IF unaffected. The following table indicates the action of the CLI instruction depending on the processor operating mode and the CPL/IOPL of the running program or procedure. Decision Table for CLI Results:
|
Operation |
---|
if(PE == 0) IF = 0; //Reset Interrupt Flag else { if(VM == 0) { if(IOPL != CPL) IF = 0; //Reset Interrupt Flag else { if(IOPL < CPL && CPL < 3 && PVI == 1) VIF = 0; //Reset Virtual Interrupt Flag else Exception(GP(0)); } } else { if(IOPL == 3) IF = 0; //Reset Interrupt Flag else { if(IOPL < 3 && VME == 1) VIF = 0; //Reset Virtual Interrupt Flag else Exception(GP(0)); } } } |
Flags affected |
---|
If protected-mode virtual interrupts are not enabled, IF is set to 0 if the CPL is equal to or less than the IOPL; otherwise, it is not affected. The other flags in the EFLAGS register are unaffected. When protected-mode virtual interrupts are enabled, CPL is 3, and IOPL is less than 3; CLI clears the VIF flag in the EFLAGS register, leaving IF unaffected. |
Protected Mode Exceptions | ||
---|---|---|
|
Real-Address Mode Exceptions |
---|
None. |
Virtual-8086 Mode Exceptions | ||
---|---|---|
|
Instruction | Latency | Throughput | Execution Unit |
---|---|---|---|
CPUID | 0F3n/0F2n/069n | 0F3n/0F2n/069n | 0F2n |
CLI | - | 26 | - |