X86-assembly/Instructions/push
(Redirected from X86-assembly/Instructions/pushad)
You are here: | push[a|ad]
|
Description
- The push instruction is used to push values on the stack.
- The pusha instruction is used to push the 16-bit registers in the following order: AX, CX, DX, BX, SP, BP, SI, DI
- The pushad instruction is used to push the 32-bit registers in the following order: EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI
Syntax
push value pusha pushad
Examples
Example 1
push 0xdebf ; push a value to the stack pop eax ; eax is now 0xdebf
Example 2
; swap content of registers push eax mov eax, ebx pop ebx
Example 3
; push parameters of a function to the stack push 6 ; protocol IPPROTO_TCP push 1 ; type SOCK_STREAM push 2 ; af AF_INET (IP v4) call ds:socket
Example 4
Following C code:
printf("x equals y.\n");
Can be disassembled as follows:
push offset aXEqualsY ; "x equals y.\n" call printf