ADDL指令,86 [英] Addl instruction, x86
问题描述
您必须原谅我,我一般品牌的新x86汇编,和组装。
You'll have to excuse me, I'm brand new to x86 assembly, and assembly in general.
所以我的问题是,我有这样的:
So my question is, I have something like:
addl %edx,(%eax)
%eax中是持有一个指向某个整数寄存器。让XP把它叫做
%eax is a register which holds a pointer to some integer. Let's call it xp
这是否意味着它的说法: * XP = * XP +%EDX
? (%EDX
是一个整数)
Does this mean that it's saying: *xp = *xp + %edx
? (%edx
is an integer)
我只是困惑在哪里ADDL将存储结果。如果%EAX
是一个指向一个int,那么(%EAX)
应该是INT的实际值。因此,将 ADDL
存储%EDX +(%EAX)的结果
在 * XP
?我更喜欢有人给我讲解一下!
I'm just confused where addl will store the result. If %eax
is a pointer to an int, then (%eax)
should be the actual value of that int. So would addl
store the result of %edx+(%eax)
in *xp
? I would really love for someone to explain this to me!
我真的AP preciate任何帮助!
I really appreciate any help!
推荐答案
是的,这个指令做什么,你觉得它在做什么。
Yes, this instruction is doing exactly what you think it's doing.
大多数x86算术指令有两个操作数:源和目标。在AT& T公司的语法(这里使用),目的地是永远正确的操作。因此一个指令,如:
Most x86 arithmetic instructions take two operands: a source and a destination. In AT&T syntax (used here), the destination is always the right operand. So with an instruction like:
addl %edx, %eax
中的值 EDX
和 EAX
相加,结果存储在 EAX
。然而,在你的榜样,内存间接寻址使用(这是由括号表示)。这意味着 EAX
作为指针处理,所以正确的操作数取自地址由 EAX
指出,并将其结果存储到同一地址。
the values in edx
and eax
are added together and the result is stored in eax
. However, in your example, memory indirect addressing is used (this is denoted by parentheses). This means that eax
is treated as a pointer, so the right operand is taken from the address pointed to by eax
, and the result is stored to the same address.
这篇关于ADDL指令,86的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!