相关疑难解决方法(0)

什么是pushl/popl%esp的汇编级表示?

C++

ATT大会

我试图理解以下两条指令的行为:

pushl %esp
Run Code Online (Sandbox Code Playgroud)

和:

popl %esp
Run Code Online (Sandbox Code Playgroud)

请注意,它们将计算出的值存储回来%esp.

我正在独立地考虑这些指令,而不是按顺序.我知道存储的值%esp总是递增/递减之前的值,但是我怎么能用汇编语言表示行为呢?这是我到目前为止所提出的:

推送:

movl %esp, %edx     1. save value of %esp
subl  $4, %esp      2. decrement stack pointer
movl %edx, (%esp)   3. store old value of %esp on top of stack
Run Code Online (Sandbox Code Playgroud)

对于pop:

movl (%esp), %esp   You wouldn’t need the increment portion. 
Run Code Online (Sandbox Code Playgroud)

它是否正确?如果没有,我哪里错了?谢谢.

x86 assembly stack att

7
推荐指数
1
解决办法
9187
查看次数

标签 统计

assembly ×1

att ×1

stack ×1

x86 ×1