3

私は現在、単純な C コードの断片を分析することによって、アセンブリ言語 (およびさまざまなコンパイラ オプションの効果) を学ぼうとしています。今、私は次の指示に出くわしました:

mov %edx,-0x80(%rbp,%rax,4)

私が理解していないのは、ターゲットアドレスの式です-0x80(%rbp,%rax,4)。この命令は、ループ内でローカル配列に値を代入します。

4

2 に答える 2

9
-0x80(%rbp,%rax,4) = *(%rbp + %rax * 4 + (-0x80))

したがって、次の命令:

mov %edx,-0x80(%rbp,%rax,4)

CPUにレジスタ%edxの値をアドレスのメモリに移動させることを意味します(%rbp + %rax * 4 + (-0x80))。これはAT&Tスタイルのアセンブリです。

于 2012-11-13T10:38:43.967 に答える
7

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.

于 2012-11-13T10:37:20.497 に答える