问题
What does 0x4 from the following assembly line mean?
cmp 0x4(%esi),%ebx
je ...
When this compare returns equal and the jump is performed the registers have the values:
%esi 0xe944d6d0
%ebx 0xe94ceccc
Sorry for asking such a simple question but I'm having a hard time searching such paranthesis notation with google. Spent more than half an hour while under time pressure.
回答1:
That is AT&T syntax, in Intel syntax it would be:
cmp ebx,[esi+4]
Note that the order of operands is reversed.
In Intel syntax it's dest, src. In AT&T it's src, dest.
So basically that instruction compares ebx with the dword value stored in [esi+4] by subtracting the dword value stored in [esi+4] from ebx, just like sub would do, but cmp only updates flags, it doesn't store the result anywhere.
来源:https://stackoverflow.com/questions/14878545/what-does-0x4-from-cmp-0x4esi-ebx-assembly-instruction-mean