Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

assembly - Why MOV AH,1 is not supported in 64 bit mode of intel microprocessor?

In the book "THE INTEL MICROPROCESSORS" of Barry B. Brey, it is written that

MOV AH, 1

is not allowed in 64 bit mode, but allowed in 32 bit or 16 bit mode. If MOV AL, 1 can be allowed in 64 bit mode, what is the problem with MOV AH, 1 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is no problem with mov ah,1. It runs just fine in X64 mode.

The opcode for it is b4 01.

The only time when mov ah is not allowed is when the mov has a REX prefix.

from: http://www.felixcloutier.com/x86/MOV.html

***In 64-bit mode, r/m8 can not be encoded to access the following byte registers if a REX prefix is used: AH, BH, CH, DH.

In that case the high byte registers (AH, BH, CH, and DH) are redefined as DIL, SIL, BPL and SPL. But this is only if a REX prefix is present.

Instructions with a REX prefix are:

anything with the R8..R15 regs and parts thereof
anything that accesses the new 8 bit regs: DIL, SIL, BPL, SPL
anything that accesses 64 bit registers.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...