x86 cmpl和jne [英] x86 cmpl and jne

查看:310
本文介绍了x86 cmpl和jne的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为某个作业跟踪一些x86代码,而我想知道到底是什么"cmpl"?以及如何预测"jne"是否将会满足.

I'm tracing some x86 code for an assignment, and I was wondering what exactly "cmpl" does and how to predict whether or not the "jne" will be met.

80484bf:    83 7d f0 07             cmpl   $0x7,-0x10(%ebp)
80484c3:    75 16                   jne    80484db

推荐答案

cmpl 从$ 0x7减去-0x10(%ebp)并修改标志: AF CF OF PF SF ZF .

  1. 如果-0x10(%ebp)处的内存等于立即数0x7,则设置标志 ZF .该值低于EBP,因此,如果这是使用EBP作为帧指针的未优化构建,则它可能是局部变量.
  2. jne 80484db 意味着,如果两个比较的数字不同(ZF = 0),请跳至 80484db
  1. If memory at -0x10(%ebp) equals immediate 0x7 then the flag ZF is set. This is below EBP so it's probably a local variable, if this is an un-optimized build using EBP as a frame pointer.
  2. jne 80484db means that if the two compared numbers are different (ZF=0), jump to 80484db

总而言之,您的代码等效于:

To summarize, your code is equivalent to :

compare A to 7
jump to 0x80484db if they are different.

这篇关于x86 cmpl和jne的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆