Reputation: 363
0x7f52379dc42c: mov 0xc(%r12,%r11,8),%r11d
0x7f52379dc431: mov %r11d,0xc(%rsp)
0x7f52379dc436: mov 0xc(%r12,%r10,8),%r14d
0x7f52379dc43b: cmp %r11d,%r14d
I understand that mov %r11d,0xc(%rsp) means *(rsp+0xc) = 0xc
What does mov 0xc(%r12,%r11,8),%r11d mean?
Upvotes: 2
Views: 770
Reputation: 1548
The general syntax for a memory operand (dereference) in AT&T x86/x64 mnemonics is offset(base, index, scale)
, which is the same as [base + index * scale + offset]
in Intel syntax (which is almost the same as the pseudo-C syntax you used).
Specifically, your first instruction
mov 0xc(%r12,%r11,8), %r11d
is the same as
mov r11d, DWORD PTR [r12+r11*8+0xc]
in Intel mnemonics, and approximately the same as
r11d = *(r12 + r11 * 8 + 0xc)
in the pseudo-C syntax.
Note that the scale is encoded using only 2 bits in the instruction, and is always a power-of-two, so only values of 1, 2, 4, and 8 are permitted.
Upvotes: 2