V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
hazard
V2EX  ›  问与答

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

  •  
  •   hazard · 2015-02-01 22:57:43 +08:00 · 2573 次点击
    这是一个创建于 3377 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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?
    谢谢!
    9 条回复    2015-02-01 23:18:18 +08:00
    yangff
        1
    yangff  
       2015-02-01 23:06:40 +08:00 via Android   ❤️ 1
    ah bh ch ...是高位啊。。。
    hazard
        2
    hazard  
    OP
       2015-02-01 23:09:08 +08:00
    @yangff 那 one of the new byte registers 指的是什么? 是AL吗?
    xieyudi1990
        3
    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
        4
    xieyudi1990  
       2015-02-01 23:12:58 +08:00   ❤️ 1
    Byte Registers: AL, BL, CL, DL, DIL, SIL, BPL, SPL, R8L - R15L
    bcxx
        5
    bcxx  
       2015-02-01 23:13:09 +08:00
    @hazard 指 r 开头的那些寄存器吧, 这里的意思应该是指在 64 位下的那些 extended registier 也是只能访问到一个字节(我乱说的,别当真) 应该是和寄存器拓展长度有关的. http://stackoverflow.com/a/1753618
    yfdyh000
        6
    yfdyh000  
       2015-02-01 23:13:50 +08:00   ❤️ 1
    在64位模式,将限制指令存取字节寄存器,指令不能同时使用传统的高字节(比如AH, BH. CH, DH)和新的字节寄存器(比如RAX寄存器的低字节)。-- http://baike.baidu.com/view/809.htm
    yangff
        7
    yangff  
       2015-02-01 23:16:31 +08:00 via Android
    头搞晕。。
    反正就是r**那票64位的寄存器的低位不能和他们的高位一起ref。。
    yangff
        8
    yangff  
       2015-02-01 23:17:57 +08:00 via Android
    阿不是。。r**那票的低位
    hazard
        9
    hazard  
    OP
       2015-02-01 23:18:18 +08:00
    明白了 谢谢各位!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2302 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 03:30 · PVG 11:30 · LAX 20:30 · JFK 23:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.