What does the 40
in movq 40(%rdi), %rax
mean?
I see that the value (in other instructions automatically generated by gcc
) is always a positive multiple of 8 (ie. 8, 16, 24, 32, ...)
It is also always surrounded by ()
I also know that the ()
means the address of.
But what does the 40
in the example mean?
When I try changing it, it even allows non-multiples of 8 (eg. 2, 3, 7, -3, -28) and compiles fine.
Some sample values by changing 40 to something else:
movq $1, (%rdi)
movq 0(%rdi), %rax
%rax: 2
movq $1, (%rdi)
movq 1(%rdi), %rax
%rax: 72057594037927937
movq $1, (%rdi)
movq 2(%rdi), %rax
%rax: 281474976710657
movq $1, (%rdi)
movq 8(%rdi), %rax
%rax: 2
movq $1, (%rdi)
movq 16(%rdi), %rax
%rax: 4
movq $1, (%rdi)
movq 24(%rdi), %rax
%rax: 140730710821713
movq $1, (%rdi)
movq 32(%rdi), %rax
%rax: 2761649059213359105