<<< PUSHF Push 16-Bit Flags onto Stack | Index | RET Return from Procedure >>> |
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 <none> IF: Interrupt flag ZF: Zero flag CF: Carry flag
PUSHFD simply pushes the current contents of the 32-bit EFlags register onto the top of the stack. The top of the stack in 32-bit modes is defined as the word at [SS:ESP], and there is no way to override that with prefixes.
ESP is decremented before the EFlags double word goes onto 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, and (in the 286 and later processors) immediate data.
The EFlags register is not affected when you push the flags, but only when you pop them back with POPFD.
PUSHFD and POPFD are most used in writing 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
<<< PUSHF Push 16-Bit Flags onto Stack | Index | RET Return from Procedure >>> |