3 system flags and fields in the eflags register – Intel IA-32 User Manual

Page 60

Advertising
background image

2-12 Vol. 3A

SYSTEM ARCHITECTURE OVERVIEW

2.3

SYSTEM FLAGS AND FIELDS IN THE EFLAGS REGISTER

The system flags and IOPL field of the EFLAGS register control I/O, maskable hardware inter-
rupts, debugging, task switching, and the virtual-8086 mode (see Figure 2-4). Only privileged
code (typically operating system or executive code) should be allowed to modify these bits.

The system flags and IOPL are:

TF

Trap (bit 8) — Set to enable single-step mode for debugging; clear to disable single-
step mode. In single-step mode, the processor generates a debug exception after each
instruction. This allows the execution state of a program to be inspected after each
instruction. If an application program sets the TF flag using a POPF, POPFD, or IRET
instruction, a debug exception is generated after the instruction that follows the POPF,
POPFD, or IRET.

IF

Interrupt enable (bit 9) — Controls the response of the processor to maskable hard-
ware interrupt requests (see also: Section 5.3.2, “Maskable Hardware Interrupts”). The
flag is set to respond to maskable hardware interrupts; cleared to inhibit maskable hard-
ware interrupts. The IF flag does not affect the generation of exceptions or
nonmaskable interrupts (NMI interrupts). The CPL, IOPL, and the state of the VME
flag in control register CR4 determine whether the IF flag can be modified by the CLI,
STI, POPF, POPFD, and IRET.

IOPL

I/O privilege level field (bits 12 and 13) — Indicates the I/O privilege level (IOPL)
of the currently running program or task. The CPL of the currently running program
or task must be less than or equal to the IOPL to access the I/O address space. This
field can only be modified by the POPF and IRET instructions when operating at a
CPL of 0.

Figure 2-4. System Flags in the EFLAGS Register

31

22 21 20 19 18 17 16

R

F

I

D

A

C

V

M

VM — Virtual-8086 Mode

RF — Resume Flag
NT — Nested Task Flag
IOPL— I/O Privilege Level
IF

— Interrupt Enable Flag

AC — Alignment Check

ID

— Identification Flag

VIP — Virtual Interrupt Pending

15

13

14

12 11 10 9 8 7 6 5 4 3 2 1 0

0

C

F

A
F

P

F 1

D

F

I

F

T
F

S
F

Z
F

N

T

0

0

V

I

P

V

I

F

O

F

I

O
P

L

VIF — Virtual Interrupt Flag

TF

— Trap Flag

Reserved

Reserved (set to 0)

Advertising