x86 cmpl and jne
42,784
cmpl subtracts -0x10(%ebp) from $0x7 and modifies flags: AF CF OF PF SF ZF.
- 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.
- 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.
Author by
Richarizard
Updated on September 12, 2020Comments
-
Richarizard over 3 years
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
-
Richarizard about 11 yearsThank you very much. So ZF is set to 0 if -0x10(%ebp) minus $0x7 does not equal zero? Or is it the other way around?
-
Omar MEBARKI about 11 yearsYou are welcome. Yes, ZF is set to 0 if -0x10(%ebp) minus $0x7 does not equal