汇编je,jns,jle使用哪个寄存器? [英] Assembly je, jns, jle which register does it use?
问题描述
情况1:
cmp dword ptr[ebp + 18],00
mov eax, [ebp + 14]
je Game.exe+417442
情况2:
test eax,eax
jns Game.exe+47137
是否总是查看寄存器eax?如果没有,我们如何知道它要查找哪个寄存器来确定跳转?
Does it ALWAYS look at register eax? If not, how do we know what register it looks at to determine the jump?
推荐答案
The x86 Jcc
(where cc
is a condition code) uses the (R|E)FLAGS
register to determine whether the condition is met or not. The flags can be updated by various previous instructions. In traditional x86 assembly you will normally use a cmp
or test
instruction to set the flags before a jump instruction.
如果您在此说明参考书中查看cmp
的文档,并且对于 test
,您将看到它们允许将任何通用寄存器用作操作数
If you look at the documentation for cmp
at this instruction reference, and for test
, you will see that they permit any of the general purpose registers as operands.
我注意到cmp
和test
并不是影响标志的 only 操作,只是,当您编写自己的汇编代码时,它们通常是您将用来执行的操作确定是否满足跳转条件.
I note that cmp
and test
are not the only operations that affect the flags, just, when you are writing your own assembly code, they are normally the operations you will use to determine if a jump condition is met.
这篇关于汇编je,jns,jle使用哪个寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!