user2636368
user2636368

Reputation: 632

what does cmp do in assembly language

I was just wondering what this does. As of now I just think that it compares %rsp with %eax but Im not really sure what the 0x10 there for

cmp    0x10(%rsp),%eax

thanks for the help

Upvotes: 1

Views: 2519

Answers (1)

DocMax
DocMax

Reputation: 12164

That is AT&T syntax for comparing the DWORD at memory location (rsp+10h) to the value in eax. The Intel syntax equivalent is:

cmp eax,[rsp+10h]

If the syntax difference is what is confusing you, check out this site which gives a good basic comparison between the two.

BTW, comparing the value of rsp with eax would be (AT&T):

cmp %rsp,%eax

or (Intel):

cmp eax,rsp

Upvotes: 4

Related Questions