Re: announce: my very first disassembler now available (GPL)
- From: "Alexei A. Frounze" <alexfrunews@xxxxxxxxx>
- Date: Tue, 19 Aug 2008 20:26:00 -0700 (PDT)
On Aug 19, 2:03 pm, "H. Peter Anvin" <h...@xxxxxxxxx> wrote:
Alexei A. Frounze wrote:
On Aug 16, 10:08 pm, "Alexei A. Frounze" <alexfrun...@xxxxxxxxx>
wrote:
There's also a special case in 64-bit mode. Depending on the rex
prefix (AFAIR, bit B) it can be either NOP or XCHG.
I meant to say, if both operands are rAX, then it's NOP. This is
controlled by mod, REX.R (if REX is present), reg, REX.B (if REX is
present) and r/m.
Except, it's not.
Plain 90h, which would normally be XCHG EAX,EAX (and therefore
zero-extend EAX into RAX) is actually NOP.
I might have misspoken, but the appropriate REX followed by 0x90 isn't
a NOP, it's XCHG rAX, r8.
Excerpt from the AMD's manual on XCHG:
XCHG Exchange
Exchanges the contents of the two operands. The operands can be two
generalpurpose
registers or a register and a memory location. If either operand
references
memory, the processor locks automatically, whether or not the LOCK
prefix is used
and independently of the value of IOPL. For details about the LOCK
prefix, see “Lock
Prefix” on page 10.
The x86 architecture commonly uses the XCHG EAX, EAX instruction
(opcode 90h) as
a one-byte NOP. In 64-bit mode, the processor treats opcode 90h as a
true NOP only if
it would exchange rAX with itself. Without this special handling, the
instruction
would zero-extend the upper 32 bits of RAX, and thus it would not be a
true nooperation.
Opcode 90h can still be used to exchange rAX and r8 if the appropriate
REX prefix is used.
This special handling does not apply to the two-byte ModRM form of the
XCHG
instruction.
Table A-1 also lists both NOP and XCHG r8, rAX in the cell for opcode
0x90.
Alex
.
- Follow-Ups:
- Re: announce: my very first disassembler now available (GPL)
- From: H. Peter Anvin
- Re: announce: my very first disassembler now available (GPL)
- References:
- announce: my very first disassembler now available (GPL)
- From: Willow
- Re: announce: my very first disassembler now available (GPL)
- From: Rod Pemberton
- Re: announce: my very first disassembler now available (GPL)
- From: Willow
- Re: announce: my very first disassembler now available (GPL)
- From: Rod Pemberton
- Re: announce: my very first disassembler now available (GPL)
- From: Willow
- Re: announce: my very first disassembler now available (GPL)
- From: Rod Pemberton
- Re: announce: my very first disassembler now available (GPL)
- From: Willow
- Re: announce: my very first disassembler now available (GPL)
- From: Alexei A. Frounze
- Re: announce: my very first disassembler now available (GPL)
- From: Alexei A. Frounze
- Re: announce: my very first disassembler now available (GPL)
- From: H. Peter Anvin
- announce: my very first disassembler now available (GPL)
- Prev by Date: Re: announce: my very first disassembler now available (GPL)
- Next by Date: Re: JWasm v1.9 - now 1.91!!!
- Previous by thread: Re: announce: my very first disassembler now available (GPL)
- Next by thread: Re: announce: my very first disassembler now available (GPL)
- Index(es):
Relevant Pages
|