【发布时间】:2021-09-09 09:37:49
【问题描述】:
Address Value Register Value
0x100 0xFF %rax 0x100
0x104 0xAB %rcx 0x1
0x108 0x13 %rdx 0x3
0x10C 0x11
Fill in the following table showing the values for the indicated operands:
Operand Value //Solutions at the end of the chapter
%rax _____ //0x100
0x104 _____ //0xAB
$0x108 _____ //0x108
(%rax) _____ //0xFF
4(%rax) _____ //0xAB
9(%rax, %rdx) _____ //0x11
260(%rcx, %rdx) _____ //0x13
0xFC(,%rcx,4) _____ //0xFF
(%rax, %rdx,4) _____ //0x11
我在这个网站上发现了一个类似的问题,但我仍然不明白 9(%rax, %rdx) 是如何工作的。我以为应该是 9+100+3 = 112 找到地址 0x112 的值,但是没有给我们地址 0x112?在我在这里发现的类似问题中:Hard time understanding assembly language 似乎使用 260(%rcx, %rdx) 我们需要将值转换为十六进制?但这不适用于 9(%rax, %rdx)。 与 (%rax, %rdx,4) 相同。我仍然得到 112。这如何导致地址 0x10C 得到 0x11 的值?
【问题讨论】:
-
9+3 decimal 是 12,十六进制的 12 是 (0x)C NOT 0x12(它应该是 18,而 9+3 不是 18)。 rax 是 0x100 而不是 100 dec,并且 0x100 + 0xC = 0x10C。同样,3 * 4 是 12 dec = 0xC。 12 月 260 日 = 0x104。
标签: assembly hex x86-64 addressing-mode