操作码中的汇编段 [英] Assembly Segments in opcodes
问题描述
我注意到在程序集段中使用了操作码.
I noticed that in Assembly segments are used in opcodes.
示例:
MOV DWORD PTR SS:[EBP-30],30
我认为"PTR SS:"用于指定EBP-30来自堆栈吗? (SS:堆栈段) 我是对的还是我完全错了? :)而且,能否请您告诉我上面的示例与
I think that "PTR SS:" is used to specify that EBP-30 comes from the stack? (SS: stack segment) Am I right or am I completely wrong? :) And, could you please tell me the difference between the example above and
MOV DWORD PTR[EBP-30],30
那么操作码中使用的DS(数据段)呢?
And what about DS (data segment) used in opcodes?
推荐答案
MOV DWORD PTR SS:[EBP-30],30
这里有两个单独的修饰符,DWORD PTR
和SS:
.
There are two separate modifiers here, DWORD PTR
and SS:
.
第一个告诉我们,我们想在指向的地址处存储一个单词.当汇编器无法从指令的操作数中分辨出这一点时,就需要这样做.在这里30
也可能是一个字节要存储.
The first one tells us that we want to store a word at the address pointed to. This is needed when the assembler cannot tell that from the operands of the instruction. Here 30
could just as well be a byte to store.
SS:
是一个段前缀,表示我们要使用相对于堆栈段的地址.在这种情况下,并不需要,因为这是使用ESP
或EBP
寄存器时的默认设置.因此,该指令的第二个版本与第一个相同.
The SS:
is a segment prefix, saying that we want to use an address relative to the stack segment. In this case it isn't strictly needed, because that is the default when using the ESP
or EBP
registers. So the second version of the instruction is identical to the first one.
如果您使用的是EBX
而不是EBP
,那将会有所不同!
Had you used EBX
instead of EBP
there would have been a difference!
这篇关于操作码中的汇编段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!