最近在看 intel 指令手册,有一处不明,求解。

2015-02-01 22:57:43 +08:00
 hazard
In 64-bit mode, there are limitations on accessing byte registers. An instruction cannot reference legacy high-bytes (for example: AH, BH, CH, DH) and one of the new byte registers at the same time (for example: the low byte of the RAX register)

这段话该怎么理解?
什么是one of the new byte registers?
谢谢!
2609 次点击
所在节点    问与答
9 条回复
yangff
2015-02-01 23:06:40 +08:00
ah bh ch ...是高位啊。。。
hazard
2015-02-01 23:09:08 +08:00
@yangff 那 one of the new byte registers 指的是什么? 是AL吗?
xieyudi1990
2015-02-01 23:11:09 +08:00
感觉 "new byte registers" 指的是 AL, BL, CL, DL, DIL, SIL, BPL, SPL, R8L - R15L.
意思应该是 AH BH CH DH 和 上面这些不能同时在一条指令里引用.

没玩过x86_64, 但我翻了下手册, 结合上下文应该是这个意思.

In 64-bit mode, there are limitations on accessing byte registers. An instruction cannot reference legacy high-bytes (for example: AH, BH, CH, DH) and one of the new byte registers at the same time (for example: the low byte of the RAX register). However, instructions may reference legacy low-bytes (for example: AL, BL, CL or DL) and new byte registers at the same time (for example: the low byte of the R8 register, or RBP). The architecture enforces this limitation by changing high-byte references (AH, BH, CH, DH) to low byte references (BPL, SPL, DIL, SIL: the low 8 bits for RBP, RSP, RDI and RSI) for instructions using a REX prefix.
xieyudi1990
2015-02-01 23:12:58 +08:00
Byte Registers: AL, BL, CL, DL, DIL, SIL, BPL, SPL, R8L - R15L
bcxx
2015-02-01 23:13:09 +08:00
@hazard 指 r 开头的那些寄存器吧, 这里的意思应该是指在 64 位下的那些 extended registier 也是只能访问到一个字节(我乱说的,别当真) 应该是和寄存器拓展长度有关的. http://stackoverflow.com/a/1753618
yfdyh000
2015-02-01 23:13:50 +08:00
在64位模式,将限制指令存取字节寄存器,指令不能同时使用传统的高字节(比如AH, BH. CH, DH)和新的字节寄存器(比如RAX寄存器的低字节)。-- http://baike.baidu.com/view/809.htm
yangff
2015-02-01 23:16:31 +08:00
头搞晕。。
反正就是r**那票64位的寄存器的低位不能和他们的高位一起ref。。
yangff
2015-02-01 23:17:57 +08:00
阿不是。。r**那票的低位
hazard
2015-02-01 23:18:18 +08:00
明白了 谢谢各位!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/167412

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX