【发布时间】:2017-10-14 23:08:01
【问题描述】:
我在Making Code 64-Bit Clean主题中看到了这个
╔═════════════════════╤══════════════════════════════════════════════════════╗
║ 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 语法中一样。
为什么 Apple 使用与其他所有人不同的名称?
【问题讨论】:
-
“低字节”中的“l”
-
这些是 Intel 寄存器名称。
-
@RossRidge 刚刚检查了英特尔手册,他们确实使用了
L后缀。那么为什么其他组装商使用 R8b 而不是使用 Intel 呢? -
因为 AMD 使用 B 后缀作为编号的寄存器。 AMD 手册将低字节寄存器列为“AL、BL、CL、DL、SIL、DIL、BPL、SPL、R8B、R9B、R10B、R11B、R12B、R13B、R14B、R15B”,而 Intel 手册将它们列为“AL , BL, CL, DL, DIL, SIL, BPL, SPL, R8L - R15L”。可以说英特尔的名称更一致,但可以说 AMD 的名称更正确,因为它们创建了额外的 64 位寄存器。
标签: macos assembly x86-64 cpu-registers