为什么将rbp和rsp称为通用寄存器? [英] Why are rbp and rsp called general purpose registers?

查看:1200
本文介绍了为什么将rbp和rsp称为通用寄存器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据x64中的Intel,以下寄存器称为通用寄存器(RAX,RBX,RCX,RDX,RBP,RSI,RDI,RSP和R8-R15). com/en-us/articles/introduction-to-x64-assembly"rel =" noreferrer> https://software.intel.com/zh-CN/articles/introduction-to-x64-assembly .

According to Intel in x64 the following registers are called general purpose registers (RAX, RBX, RCX, RDX, RBP, RSI, RDI, RSP and R8-R15) https://software.intel.com/en-us/articles/introduction-to-x64-assembly.

在下面的文章中,RBP和RSP是专用寄存器(RBP指向当前堆栈框架的底部,RSP指向当前堆栈框架的顶部). https://www.recurse.com/blog/7-understanding -c-learning-assembly

In the following article, it's written that RBP and RSP are special purpose registers (RBP point to the base of the current stack frame and RSP point to the top of the current stack frame). https://www.recurse.com/blog/7-understanding-c-by-learning-assembly

现在我有两个矛盾的说法. Intel声明应该是受信任的声明,但是什么是正确的,为什么RBP和RSP根本被称为通用?

Now I have two contradictory statements. The Intel statement should be the trusted one, but what is correct and why is RBP and RSP called general purpose at all ?

感谢您的帮助.

推荐答案

通用意味着所有这些寄存器都可以与使用通用寄存器进行计算的任何指令一起使用,例如,您无法对指令执行任何操作指针(RIP)或标志寄存器(RFLAGS).

General purpose means all of these registers might be used with any instructions doing computation with general purpose registers while, for example, you cannot do whatever you want with the instruction pointer (RIP) or the flags register (RFLAGS).

这些寄存器中的某些已被设想用于特定用途,并且通常被使用.最关键的是RSP和RBP.

Some of these registers were envisioned to be used for specific use, and commonly are. The most critical ones are the RSP and RBP.

如果您需要出于自己的目的使用它们,则应在存储其他内容之前保存它们的内容,并在完成操作后将其恢复为原始值.

Should you need to use them for your own purpose, you should save their contents before storing something else inside, and restore them to their original value when done.

这篇关于为什么将rbp和rsp称为通用寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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