flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > NOP under use64 |
Author |
|
Tomasz Grysztar 18 Dec 2006, 14:20
This is from AMD manuals - by rAX they don't mean there the RAX register, but the register of selected size, for example in description of DIV instruction they use names rDX and rAX that mean any of the DX:AX, EDX:EAX, RDX:RAX pairs (which one, depends on the mode and prefix).
In 64-bit mode 32-bit is the default, thus NOP is an alias for XCHG EAX,EAX, but... not really! That's because 90h does really nothing, while the real XCHG EAX,EAX does clear upper bits of RAX - that's why XCHG EAX,EAX is encoded in a different way, too. Last edited by Tomasz Grysztar on 18 Dec 2006, 14:23; edited 1 time in total |
|||
18 Dec 2006, 14:20 |
|
MazeGen 18 Dec 2006, 14:22
Oh, Tomasz, you are beaten to dead in this section!
First, 0x90 would be XCHG EAX, EAX in 64-bit mode so it would clear upper 32 bits. Second, NOP is not an alias for XCHG rAX, rAX. NOP is independent from rAX register, at least in 64-bit mode. It is mentioned somewhere in the optimization manual. So I think FASM behaves correctly in this case. EDIT: heh, we have posted at the same time |
|||
18 Dec 2006, 14:22 |
|
Tomasz Grysztar 18 Dec 2006, 14:25
Yes, I already added the thing about XCHG EAX,EAX above, here's the quote from description of XCHG instruction in AMD manual:
Quote: The x86 architecture commonly uses the XCHG EAX, EAX instruction (opcode 90h) as And thus in use64 mode fasm encodes XCHG EAX,EAX as 87-C0, and XCHG EAX,R8D as 41-90. PS. MazeGen: we did talk about this in Kraków, didn't we? |
|||
18 Dec 2006, 14:25 |
|
MazeGen 18 Dec 2006, 14:31
Quote: In 64-bit mode, the processor treats opcode 90h as a true NOP only if Shouldn't it be the following? It applies only to XCHG EAX,EAX. Quote: In 64-bit mode, the processor treats opcode 90h as a true NOP only if |
|||
18 Dec 2006, 14:31 |
|
Tomasz Grysztar 18 Dec 2006, 14:47
I understand it as they mean here that 66-90 and 48-90 also behave like a true NOP.
|
|||
18 Dec 2006, 14:47 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.