<<< POPF Pop Top of Stack into Flags | Index | PUSH Push Operand onto Top of Stack >>> |
O D I T S Z A P C OF: Overflow flag TF: Trap flag AF: Aux carry F F F F F F F F F DF: Direction flag SF: Sign flag PF: Parity flag * * * * * * * * * IF: Interrupt flag ZF: Zero flag CF: Carry flag
POPFD pops the double word (4 bytes) at the top of the stack into the EFlags register. In 32-bit protected mode, the top of the stack is defined as the DWORD at [ESP], and there is no way to override the SS segment with prefixes.
ESP is incremented by 4 after the word comes off the stack. Remember that ESP always points to either an empty stack or else real data. There is a separate pair of instructions, PUSH and POP, for pushing and popping other register data and memory data, in both 16-bit and 32-bit sizes.
PUSHFD and POPFD are most used in writing 32-bit interrupt service routines, where you must be able to save and restore the environment, that is, all machine registers, to avoid disrupting machine operations while servicing the interrupt.
r8 = AL AH BL BH CL CH DL DH r16 = AX BX CX DX BP SP SI DI sr = CS DS SS ES FS GS r32 = EAX EBX ECX EDX EBP ESP ESI EDI m8 = 8-bit memory data m16 = 16-bit memory data m32 = 32-bit memory data i8 = 8-bit immediate data i16 = 16-bit immediate data i32 = 32-bit immediate data d8 = 8-bit signed displacement d16 = 16-bit signed displacement d32 = 32-bit unsigned displacement
<<< POPF Pop Top of Stack into Flags | Index | PUSH Push Operand onto Top of Stack >>> |