本文介绍了苹果为何将R8l用作字节寄存器而不是R8b?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在进行代码64位清理主题

╔═════════════════════╤══════════════════════════════════════════════════════╗
║ Register name       │ Description                                          ║
╠═════════════════════╪══════════════════════════════════════════════════════╣
║ R8                  │ A 64-bit register.                                   ║
╟─────────────────────┼──────────────────────────────────────────────────────╢
║ R8d                 │ A 32-bit register containing the bottom half of R8.  ║
╟─────────────────────┼──────────────────────────────────────────────────────╢
║ R8w                 │ A 16-bit register containing the bottom half of R8d. ║
╟─────────────────────┼──────────────────────────────────────────────────────╢
║ R8l (Lowercase "l") │ An 8-bit register containing the bottom half of R8w. ║
╚═════════════════════╧══════════════════════════════════════════════════════╝

使用l后缀,我首先认为它是一个long寄存器,就像GAS语法一样.

With the l suffix I first thought that it's a long register like in GAS syntax.

为什么苹果使用别人的名字?

Why is Apple using a different name from everybody else?

推荐答案

正如罗斯·里奇(Ross Ridge)的评论一样,这是因为AMD和英特尔的寄存器命名约定不同

As from Ross Ridge's comment, that's because of the difference in AMD and Intel's register naming convention

摘自《 AMD64体系结构程序员手册》,第1卷:应用程序编程

From AMD64 Architecture Programmer’s Manual, Volume 1: Application Programming

  • 十六个8位低字节寄存器(AL,BL,CL,DL,SIL,DIL,BPL,SPL, R8B,R9B,R10B,R11B,R12B,R13B,R14B,R15B ).
  • 四个8位高字节寄存器(AH,BH,CH,DH),仅当不使用REX前缀时才可寻址.
  • 16个16位寄存器(AX,BX,CX,DX,DI,SI,BP,SP,R8W,R9W,R10W,R11W,R12W,R13W,R14W,R15W).
  • 16个32位寄存器(EAX,EBX,ECX,EDX,EDI,ESI,EBP,ESP,R8D,R9D,R10D,R11D,R12D,R13D,​​R14D,R15D).
  • 十六个64位寄存器(RAX,RBX,RCX,RDX,RDI,RSI,RBP,RSP,R8,R9,R10,R11,R12,R13,R14,R15).
  • Sixteen 8-bit low-byte registers (AL, BL, CL, DL, SIL, DIL, BPL, SPL, R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B).
  • Four 8-bit high-byte registers (AH, BH, CH, DH), addressable only when no REX prefix is used.
  • Sixteen 16-bit registers (AX, BX, CX, DX, DI, SI, BP, SP, R8W, R9W, R10W, R11W, R12W,R13W, R14W, R15W).
  • Sixteen 32-bit registers (EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D).
  • Sixteen 64-bit registers (RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, R8, R9, R10, R11, R12, R13, R14, R15).

与Intel®64和IA-32架构相比-软件开发人员手册第1卷:1:基本架构

Compared to Intel® 64 and IA-32 Architectures - Software Developer’s Manual Volume 1:Basic Architecture

  • 64位通用寄存器(RAX,RBX,RCX,RDX,RSI,RDI,RSP,RBP或R8-R15)
  • 32位通用寄存器(EAX,EBX,ECX,EDX,ESI,EDI,ESP,EBP或R8D-R15D)
  • 16位通用寄存器(AX,BX,CX,DX,SI,DI,SP,BP或R8W-R15W)
  • 8位通用寄存器:AL,BL,CL,DL,SIL,DIL,SPL,BPL和 R8L-R15L 可以使用REX前缀使用;可以使用AL,BL,CL,DL,AH,BH,CH,DH,而无需使用REX前缀.
  • 64-bit general-purpose registers (RAX, RBX, RCX, RDX, RSI, RDI, RSP, RBP, or R8-R15)
  • 32-bit general-purpose registers (EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP, or R8D-R15D)
  • 16-bit general-purpose registers (AX, BX, CX, DX, SI, DI, SP, BP, or R8W-R15W)
  • 8-bit general-purpose registers: AL, BL, CL, DL, SIL, DIL, SPL, BPL, and R8L-R15L are available using REX prefixes; AL, BL, CL, DL, AH, BH, CH, DH are available without using REX prefixes.

这篇关于苹果为何将R8l用作字节寄存器而不是R8b?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 18:40