Use of parentheses in gnu ATT GAS

31 Views Asked by At

I have a question concerning parentheses in GAS. I have looked in SO and in quite a few number of other places, but I am still unclear on this:

What is the difference between?:

movl %edx, %eax

and

movl (%edx), %eax

From my understanding, parentheses dereference the address stored at the register.

register value value at address
1 %edx 0x00 20
2 %edx int 20 whatever is located at 0x14 (int 20) ?

I am understanding this as follows:

  • # 1: an address is stored in the register
    • %edx == 0x00 and (%edx) == 20
  • # 2: a value is store in register
    • %edx == 20 and (%edx) == whatever is at 0x14, which would probably segfault if attempted to access.

Can someone please elaborate on what the parentheses are doing and if I am seeing this correctly?

0

There are 0 best solutions below