x86指令含义 [英] x86 instruction meaning
问题描述
我通过一些code运行现在的gdb的,我不知道什么这两个指令实际上做。如果有人可以帮助我,我真的AP preciate它。
添加-0x2c(EBP%,EBX%,4),EAX%
CMP%EAX,-0x28(EBP%,EBX%,4)
x86汇编通常更容易,当你在Intel语法,而不是AT&放写明白; T语法
在Intel语句将是:
添加EAX,[EBP + 4 * EBX-0x2C]
CMP [EBP + 4 * EBX-0x28],EAX
第一个指令(添加
)将存储在存储器地址的值 [EBP + 4 * EBX-0x2C]
为 EAX
,并将之和 EAX
。
第二个指令( CMP
)比较 EAX
与 [EBP + 4 * EBX -0x28]
从存储在内存中的地址的字值减去 EAX
的值 [EBP + 4 * EBX-0x28]
,并设置标志(的
, SF
, ZF
, AF
, PF
, CF
),据此,但不会在任何地方保存结果。 CMP
是完全一样的分
,唯一的区别是一个事实,即在子
的结果保存在 CMP
不是
比较的类型,通常的形式创建的一个条件跳转。在x86汇编有很多条件跳转,他们分支是否依赖于标志的值。
I'm running through some code right now on gdb and I have no clue what these two instructions actually do. If anyone could help me out, I'd really appreciate it.
add -0x2c(%ebp, %ebx, 4), %eax
cmp %eax, -0x28(%ebp, %ebx, 4)
x86 assembly is usually much easier to understand when you write it in Intel syntax instead of AT&T syntax.
In Intel syntax it would be:
add eax,[ebp+4*ebx-0x2C]
cmp [ebp+4*ebx-0x28],eax
The first instruction (add
) adds the value of word stored in the memory address [ebp+4*ebx-0x2C]
to the value of eax
, and stores the sum in eax
.
The second instruction (cmp
) compares eax
with [ebp+4*ebx-0x28]
by subtracting the value of eax
from the value of the word stored in the memory address [ebp+4*ebx-0x28]
, and sets flags (OF
, SF
, ZF
, AF
, PF
, CF
) accordingly but does not save the result anywhere. cmp
is exactly the same as sub
, the only difference being the fact that in sub
the result is saved, in cmp
not.
The type of comparison is usually created in the form a conditional jump. In x86 assembly there are a lot of conditional jumps and whether they branch depends on the values of the flags.
这篇关于x86指令含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!