AngoLinux

80386 Programmer's Reference Manual -- Opcode PUSH


PUSH -- Push Operand onto the Stack

OpcodeInstructionClocks DescriptionExample
FF /6pushw m165 Push memory wordpushw m16
FF /6pushl m325 Push memory dwordpushl m32
50 + /rpushw r162 Push register wordpushw %bx
50 + /rpushl r322 Push register dwordpushl %ebx
68pushw imm162 Push immediate wordpushw $0x7fff
68pushl imm322 Push immediate dwordpushl $0x7fffffff
0Epushw cs2 Push CSpushw %cs
16pushw ss2 Push SSpushw %ss
1Epushw ds2 Push DSpushw %ds
06pushw es2 Push ESpushw %es
0F A0pushw fs2 Push FSpushw %fs
OF A8pushw gs2 Push GSpushw %gs

Operation




IF StackAddrSize = 16
THEN
   IF OperandSize = 16 THEN
      SP := SP - 2;
      (SS:SP) := (SOURCE); (* word assignment *)
   ELSE
      SP := SP - 4;
      (SS:SP) := (SOURCE); (* dword assignment *)
   FI;
ELSE (* StackAddrSize = 32 *)
   IF OperandSize = 16
   THEN
      ESP := ESP - 2;
      (SS:ESP) := (SOURCE); (* word assignment *)
   ELSE
      ESP := ESP - 4;
      (SS:ESP) := (SOURCE); (* dword assignment *)
   FI;
FI;

Description

PUSH decrements the stack pointer by 2 if the operand-size attribute of the instruction is 16 bits; otherwise, it decrements the stack pointer by 4. PUSH then places the operand on the new top of stack, which is pointed to by the stack pointer.

The 80386 PUSH eSP instruction pushes the value of eSP as it existed before the instruction. This differs from the 8086, where PUSH SP pushes the new value (decremented by 2).

Flags Affected

None

Protected Mode Exceptions

#SS(0) if the new value of SP or ESP is outside the stack segment limit; #GP(0) for an illegal memory operand effective address in the CS, DS, ES, FS, or GS segments; #SS(0) for an illegal address in the SS segment; #PF(fault-code) for a page fault

Real Address Mode Exceptions

None; if SP or ESP is 1, the 80386 shuts down due to a lack of stack space

Virtual 8086 Mode Exceptions

Same exceptions as in real-address mode; #PF(fault-code) for a page fault


[Home Page dell'ITIS "Fermi"] [80386 Programmer's Reference Manual Index] [Previous] [Next]