5

What does this instruction do?

mov (%r11,%r12,1), %edx
nrz
  • 10,435
  • 4
  • 39
  • 71
  • See also the [AT&T syntax tag wiki](https://stackoverflow.com/tags/att/info) for more details on the syntax, and links to more docs. – Peter Cordes Nov 18 '17 at 17:43
  • Related: [A couple of questions about \[base + index\*scale + disp\]](https://stackoverflow.com/q/27936196) – Peter Cordes Apr 13 '20 at 16:21

2 Answers2

7

Look here. It says

In the AT&T Syntax, memory is referenced in the following way,

segment-override:signed-offset(base,index,scale)

Down on the page there are some examples. I find this the best:

GAS memory operand   NASM memory operand
------------------   -------------------
(%ecx,%ebx,2)    [ecx+ebx*2]

mov source, destination in AT&T syntax copies the value from source to destination. Also consider the size of edx. How many bytes (4) do you think mov will copy ?

nc3b
  • 15,562
  • 5
  • 51
  • 63
-1

mov (%r11,%r12,1), %edx this instruction is use to calculate the address (indexed addressing mode).

  • %r11 is a base adress
  • %r12 is a index
  • and 1 is a multipler

It's work like this:

adres = base adres + index * multipler

base adres and multipler must be constants (base adress can be register), index must be register.

dikamilo
  • 617
  • 7
  • 7