The x86-64 CPU Flags register (rflags or eflags) contains information about the state of the CPU including important details of recent instructions and whether autoincrement or autodecrement will occur with string operations. Typically it is most convenient to use status information as part of conditional jump instructions rather than loading eflags and inspecting the bits.
Flag | Name | Meaning |
---|---|---|
CF | Carry Flag | Set if a math op generates a carry or borrow. It indicates an overflow for unsigned math. It can be used to implement multiple precision math. |
PF | Parity Flag | Set if the least significant byte of a result contains an even number of 1 bits. |
AF | Adjust Flag | Set if a math operation generates a carry or borrow from bit 3. It is used for binary coded decimal in which each 4 bits of a number stores a decimal digit. |
ZF | Zero Flag | Set if the result of an instruction is 0. |
SF | Sign Flag | Equal to the most significant bit (sign bit) of a result. It SF is 1, the number is negative. |
OF | Overflow Flag | Set if a result is too big for a signed number. |
DF | Direction Flag | Controls the direction of RDI and RSI adjustments with string instructions. 1 means decrement and 0 means increment. The STD instructions sets DF (makes it 1) and CLD clears DF. |