POP

By Vesper Vei
2 minutes read

Table of Contents

  1. POP(pop)
    1. Basic Function
    2. Instruction Execution Process
    3. Instruction Format
    4. Behavioral Characteristics
    5. Equivalent Expansion Example
    6. ASCII Stack Diagram
    7. Common Uses

POP(pop)

Basic Function

The POP instruction pops the top value from the stack into the destination operand, then moves the stack pointer upward.
In contrast to PUSH, POP increases ESP/RSP.

Instruction Execution Process

64-bit:

操作数 = [rsp]
rsp = rsp + 8

32-bit:

操作数 = [esp]
esp = esp + 4

Instruction Format

The following operands are allowed:

Not allowed:

Behavioral Characteristics

Equivalent Expansion Example

pop rax
; 等价于
mov rax, [rsp]
add rsp, 8

ASCII Stack Diagram

Before execution:

rsp → +------------------+
| 要弹出的值 |
+------------------+

After executing pop rax:

rsp → +------------------+
| (旧数据) |
+------------------+
; rax = 原栈顶值

image.png ⚠️ Note: the stack data at 0x0012FF88 here will not be cleared, but it will be overwritten during normal program execution

Common Uses



Relationship Graph

Loading graph...