background image

CLI — Clear Interrupt Flag

INSTRUCTION SET REFERENCE, A-L

3-144 Vol. 2A

CLI — Clear Interrupt Flag

Instruction Operand Encoding

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. Table 3-7 indicates the action of the CLI instruction depending on the 
processor operating mode and the CPL/IOPL of the running program or procedure. 
Operation is the same in all modes.

Operation

IF PE = 0

THEN

IF ← 0; (* Reset Interrupt Flag *)

ELSE

IF VM = 0;

THEN

IF IOPL ≥ CPL

THEN

IF ← 0; (* Reset Interrupt Flag *)

ELSE

IF ((IOPL < CPL) and (CPL = 3) and (PVI = 1))

THEN

VIF ← 0; (* Reset Virtual Interrupt Flag *)

ELSE

#GP(0);

Opcode

Instruction

Op/ 

En

64-bit 

Mode

Compat/

Leg Mode

Description

FA

CLI

NP

Valid

Valid

Clear interrupt flag; interrupts disabled when 

interrupt flag cleared.

Op/En

Operand 1

Operand 2

Operand 3

Operand 4

NP

NA

NA

NA

NA

Table 3-7.  Decision Table for CLI Results

PE

VM

IOPL

CPL

PVI

VIP

VME

CLI Result

0

X

X

X

X

X

X

IF

 

=

 

0

1

0

≥ 

CPL

X

X

X

X

IF 

0

1

0

<

 

CPL

3

1

X

X

VIF 

=

 0

1

0

<

 

CPL

<

 

3

X

X

X

GP Fault

1

0

<

 

CPL

X

0

X

X

GP Fault

1

1

3

X

X

X

X

IF 

=

 0

1

1

<

 

3

X

X

X

1

VIF

 

=

 

0

1

1

<

 

3

X

X

X

0

GP Fault

NOTES:

* X = This setting has no impact.