x86 汇编中寄存器上使用的 push/pop 指令的功能是什么? [英] What is the function of the push / pop instructions used on registers in x86 assembly?
本文介绍了x86 汇编中寄存器上使用的 push/pop 指令的功能是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在阅读有关汇编程序的文章时,我经常遇到有人写道,他们推送处理器的某个寄存器,然后再次弹出以恢复它以前的状态.
When reading about assembler I often come across people writing that they push a certain register of the processor and pop it again later to restore it's previous state.
- 如何推送寄存器?它被推到哪里去了?为什么需要这样做?
- 这归结为单个处理器指令还是更复杂?
推荐答案
推送一个值(不一定存储在寄存器中)意味着将它写入堆栈.
pushing a value (not necessarily stored in a register) means writing it to the stack.
弹出意味着将堆栈顶部的任何内容恢复到寄存器中.这些是基本说明:
popping means restoring whatever is on top of the stack into a register. Those are basic instructions:
push 0xdeadbeef ; push a value to the stack
pop eax ; eax is now 0xdeadbeef
; swap contents of registers
push eax
mov eax, ebx
pop ebx
这篇关于x86 汇编中寄存器上使用的 push/pop 指令的功能是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文