是MOV%ESI,ESI%无操作或不x86-64的? [英] Is mov %esi, %esi a no-op or not on x86-64?
问题描述
我有点被注释为Linux内核,<一个头文件中的一个困惑href=\"http://lxr.free-electrons.com/source/arch/x86/include/asm/nops.\">arch/x86/include/asm/nops.h.它指出,
&LT; ...>下面的说明都没有NOP处于64位模式,64位模式下使用K8或P6 NOP指令,而不是结果
MOVL%ESI,ESI%结果
莱亚尔为0x00(%ESI),ESI%结果
&LT; ...>
块引用>我猜测作者所隐含的机器指令('89 F6'和'8D 76 00,分别)存在,而不是汇编指令。从
LEA
的英特尔软件开发人员手册卷2A,后者指令(LEA 0×00(%RSI),%ESI $的说明如下C $ C>)不一样的是前者,
MOV%ESI,ESI%
。所以这减少的问题,无论是
MOV%ESI,ESI%
实际上是X86-64无操作。
MOV
不会改变标志。这种MOV
的也不改变内存。看来,如果它的变化,除了%撕裂
的东西,这应该是通用寄存器。但我不知道它如何改变%RSI
或任何内容。如果你操作通用寄存器的下半部分,上半部分应该不会改变吧?解决方案MOV%ESI,ESI%
从零RSI%的高32位,因此不是在x86_64无操作。
I am a bit confused by the comment in one of the header files for the Linux kernel, arch/x86/include/asm/nops.h. It states that
<...> the following instructions are NOT nops in 64-bit mode, for 64-bit mode use K8 or P6 nops instead
movl %esi,%esi
leal 0x00(%esi),%esi
<...>I guess the author implied the machine instructions ('89 F6' and '8D 76 00', respectively) there rather than assembly instructions. It follows from the description of
LEA
in Intel Software Developer's Manual Vol 2A that the latter instruction (lea 0x00(%rsi), %esi
) does the same as the the former,mov %esi,%esi
.So this reduces to the question, whether
mov %esi,%esi
is actually a no-op on x86-64.
mov
does not change flags. This kind ofmov
does not change memory either. It seems, if it changes something besides%rip
, that should be general purpose registers. But I have no clue how it can change the contents of%rsi
or whatever. If you manipulate the lower half of a general purpose register, the upper half should not change, right?解决方案mov %esi, %esi
zeros out the high 32 bits of %rsi, and is therefore not a no-op on x86_64.
这篇关于是MOV%ESI,ESI%无操作或不x86-64的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!