mov instruction in x86 assembly

后端 未结 1 720
遇见更好的自我
遇见更好的自我 2021-01-08 00:35

From what I\'ve read about mov, it copies the second argument into the first argument. Then, what does this do?

movl    8(%ebp),    %edx

I

相关标签:
1条回答
  • 2021-01-08 01:03
    movl 8(%ebp), %edx
    

    is in "AT&T Syntax"; in this syntax, the source comes first and the destination second. So yes, your belief is correct. Most documentation uses the "Intel Syntax", which has the reverse ordering. This is a source of considerable confusion for people new to x86 assembly.

    In Intel Syntax, your instruction would be written:

    mov edx, [ebp + 8]
    

    Note the absence of % before the register names, and the use of square brackets instead of parentheses for the address, and the lack of an l suffix on the instruction. These are dead giveaways to know which form of assembly you are looking at.

    0 讨论(0)
提交回复
热议问题