V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hazard
V2EX  ›  问与答

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

  •  
  •   hazard · Feb 1, 2015 · 3135 views
    This topic created in 4112 days ago, the information mentioned may be changed or developed.
    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 replies    2015-02-01 23:18:18 +08:00
    yangff
        1
    yangff  
       Feb 1, 2015 via Android   ❤️ 1
    ah bh ch ...是高位啊。。。
    hazard
        2
    hazard  
    OP
       Feb 1, 2015
    @yangff 那 one of the new byte registers 指的是什么? 是AL吗?
    xieyudi1990
        3
    xieyudi1990  
       Feb 1, 2015
    感觉 "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  
       Feb 1, 2015   ❤️ 1
    Byte Registers: AL, BL, CL, DL, DIL, SIL, BPL, SPL, R8L - R15L
    bcxx
        5
    bcxx  
       Feb 1, 2015
    @hazard 指 r 开头的那些寄存器吧, 这里的意思应该是指在 64 位下的那些 extended registier 也是只能访问到一个字节(我乱说的,别当真) 应该是和寄存器拓展长度有关的. http://stackoverflow.com/a/1753618
    yfdyh000
        6
    yfdyh000  
       Feb 1, 2015   ❤️ 1
    在64位模式,将限制指令存取字节寄存器,指令不能同时使用传统的高字节(比如AH, BH. CH, DH)和新的字节寄存器(比如RAX寄存器的低字节)。-- http://baike.baidu.com/view/809.htm
    yangff
        7
    yangff  
       Feb 1, 2015 via Android
    头搞晕。。
    反正就是r**那票64位的寄存器的低位不能和他们的高位一起ref。。
    yangff
        8
    yangff  
       Feb 1, 2015 via Android
    阿不是。。r**那票的低位
    hazard
        9
    hazard  
    OP
       Feb 1, 2015
    明白了 谢谢各位!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   907 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 21:56 · PVG 05:56 · LAX 14:56 · JFK 17:56
    ♥ Do have faith in what you're doing.