0
movl $0x7, %eax
movl $0x7, (%eax)

movl 0x7, (%eax)

In my opinion it would be mov the long value to eax register.
second line is move the long value to the memory of eax register.

What does the third line do ?

I am little confused about these.

Gaurav
  • 23
  • 4
  • yup, mov-immediate to register vs. mov-immediate to memory, with a simple addressing mode using just EAX as the address. https://www.felixcloutier.com/x86/mov – Peter Cordes May 05 '21 at 06:21
  • 2
    *What does the third line do ?* - fails to assemble. Did you try it? x86 doesn't allow an instruction with two memory operands, and `0x7` is a memory operand with absolute address `7`. See [Why isn't movl from memory to memory allowed?](https://stackoverflow.com/q/33794169) and [Does referencing constants without a dollar sign have a distinct meaning?](https://stackoverflow.com/q/42727668) – Peter Cordes May 05 '21 at 06:26
  • I didnt try it, but i am new to x86 and found this code somwhere asking, what does this line mean ? I got confused and thats why asked here. – Gaurav May 05 '21 at 06:29
  • 1
    You should try to figure out as much as you can before you ask other people to spend their time explaining things to you. e.g. find a tutorial and docs (https://stackoverflow.com/tags/att/info / https://stackoverflow.com/tags/x86/info), and/or look at compiler output to see what instructions a compiler uses for C you already understand. ([How to remove "noise" from GCC/clang assembly output?](https://stackoverflow.com/q/38552116)). And play around with it yourself, putting instructions in a file so you can single-step them in GDB and see what happens. – Peter Cordes May 05 '21 at 06:39

0 Answers0