什么是对x86汇编寄存器使用PUSH​​ / POP指令的功能? [英] What is the function of the push / pop instructions used on registers in x86 assembly?

查看:349
本文介绍了什么是对x86汇编寄存器使用PUSH​​ / POP指令的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读汇编我经常遇到人写他们的的处理器有一定寄存器的弹出的它以后再恢复它的previous状态。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆