cmp 和 ja 问题
我在理解这一点时遇到问题。它在英特尔语法中
cmp eax, 0x19
ja greater
eax 包含值 -40。 http://en.wikibooks.org/wiki/X86_Assembly/Control_Flow 告诉我 ja 是与前一个 cmp 的无符号比较。
据我所知,如果 arg1 (0x19) 高于 arg2 (0xffffffd8),则应该跳转,
0x19 对我来说看起来小于 0xffffffd8。跳跃正在进行中。非常感谢任何帮助理解我有缺陷的逻辑的帮助!
I'm having problems understanding this. It's in intel syntax
cmp eax, 0x19
ja greater
eax contains the value -40. http://en.wikibooks.org/wiki/X86_Assembly/Control_Flow tells me ja is the unsigned comparison from the previous cmp.
As far as I know, this should jump IF arg1 (0x19) is ABOVE arg2 (0xffffffd8)
0x19 looks smaller than 0xffffffd8 to me. The jump is being performed. Any help understanding my flawed logic much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这有点难以回答,因为不同的汇编器会颠倒操作数的顺序。从表面上看,您似乎正在使用英特尔语法汇编,在这种情况下,您所拥有的内容大致相当于
if (unsigned)eax > 0x19 转到更大
。既然如此,那么跳跃也就在情理之中了。This is a little hard to answer because different assemblers reverse the order of operands. From the looks of things, you seem to be using Intel syntax assembly, in which case what you have is roughly equivalent to
if (unsigned)eax > 0x19 goto greater
. That being the case, it's reasonable that the jump is taken.也许,0xffffffd8 是 32 位二进制补码中的负数。 0x19 为正。
Maybe, 0xffffffd8 is a negative number in two's complement 32 bit. 0x19 is positive.