CMP in x86 with parentheses and address

后端 未结 2 997
谎友^
谎友^ 2020-12-04 02:46

I have the following line in x86 Assembly language that I don\'t know what it does...

cmp %eax,0x80498d4(,%ebx,4)

I know it\'s comparing th

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 03:07

    That is AT&T syntax:

    cmp %eax,0x80498d4(,%ebx,4)
    

    The equivalent in Intel syntax is:

    cmp [080498D4H + EBX*4],EAX
    

    It means that it compares the DWORD content at the address [0x80498D4 + 4*EBX] with the content of the EAX register and sets the processor flags as if these two values were subtracted from each other. After that, you can use these flags to do, for instance, a conditional jump.

提交回复
热议问题