RFLAGS

This is a 64-bit status and control register that reflects the outcome of arithmetic and logical operations, controls CPU behavior, and provides information about system state. Each bit in the register has a specific purpose, such as the Carry Flag (CF) for unsigned arithmetic carries, the Zero Flag (ZF) for results equal to zero, the Sign Flag (SF) for negative results, the Overflow Flag (OF) for signed arithmetic overflow, and the Parity Flag (PF) for even parity in the least significant byte. Control bits like the Interrupt Flag (IF) enable or disable maskable interrupts, the Direction Flag (DF) governs the direction of string operations, and the Trap Flag (TF) allows single-step debugging. Other flags include privilege-level indicators (IOPL), nested task control (NT), and virtualization-related flags (VM, VIF, VIP). Many bits are reserved or used in special modes, but collectively, the RFLAGS register provides the processor with the necessary state information to make conditional decisions, manage system control, and support debugging and virtualization.

Bit(s)
0
1
2
3
4
5
6
7
8
9
10
11
12-13
14
15
16
17
18
19
20
21
22-63

Label

CF

1

PF

0

AF

0

ZF

SF

TF

IF

DF

OF

IOPL

NT

0

RF

VM

AC

VIF

VIP

ID

0

Description

Carry Flag

Reserved

Parity Flag

Reserved

Auxiliary Carry Flag

Reserved

Zero Flag

Sign Flag

Trap Flag

Interrupt Flag

Direction Flag

Overflow Flag

I/O Privilege Level

Nested Task

Reserved

Resume Flag

Virtual-8086 Mode

Alignment Check / Access Control

Virtual Interrupt Flag

Virtual Interrupt Pending

Identification Flag

Reserved

Flags in the RFLAGS register can be thought of as boolean values, where a bit set to 1 represents “true” and a bit set to **0” represents “false.” This makes it easier to understand their role in conditional logic: for example, CF = 1 indicates that a carry or borrow occurred, ZF = 0 shows that the result of an operation was not zero, and SF = 1 signals that the result is negative. Interpreting the flags this way is especially useful when reasoning about conditional jumps, because these instructions test whether a specific flag is true or false to determine if the CPU should branch to another instruction.

Last updated