私は現在、単純な C コードの断片を分析することによって、アセンブリ言語 (およびさまざまなコンパイラ オプションの効果) を学ぼうとしています。今、私は次の指示に出くわしました:
mov %edx,-0x80(%rbp,%rax,4)
私が理解していないのは、ターゲットアドレスの式です-0x80(%rbp,%rax,4)
。この命令は、ループ内でローカル配列に値を代入します。
-0x80(%rbp,%rax,4) = *(%rbp + %rax * 4 + (-0x80))
したがって、次の命令:
mov %edx,-0x80(%rbp,%rax,4)
CPUにレジスタ%edxの値をアドレスのメモリに移動させることを意味します(%rbp + %rax * 4 + (-0x80))
。これはAT&Tスタイルのアセンブリです。
The machine command will copy the content of %edx
to the address given by %rbp + 4 * %rax - 0x80
. It seems %rax
is holding the index to that array and %rbp - 0x80
is the base address.
Take a look here to get a better understanding for the AT&T syntax.