x86 ASM:DD被用作“指令"吗? [英] x86 ASM: DD Being Used as an "Instruction"?
问题描述
在以下x86汇编代码中:
In the following x86 assembly code:
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002+0x00)
该值似乎未分配给任何变量.那么这段代码是做什么的呢?我听说过一些有关它存储在内存中的信息,但是究竟在哪里?
The values don't seem to be assigned to any variables. So what does this snippet of code do? I've heard something about it being stored in memory, but where exactly?
推荐答案
dd
是伪指令",它将4字节常量组装到输出中,与add eax,eax
将0x01 0xc0
组装到输出中的方式相同.输出.
dd
is a "pseudo-instruction" that assembles 4-byte constants into the output, the same way that add eax,eax
assembles 0x01 0xc0
into the output.
NASM手册第3.2节伪指令描述了dw
/dd
,依此类推.
The NASM manual section 3.2 Pseudo-Instructions describes db
/dw
/dd
and so on.
在这种情况下,正如@MichaelPetch指出的那样,这些特定的常量用于将multiboot标头组装到输出文件中. https://www.gnu.org/软件/grub/manual/multiboot/multiboot.html#OS-image-format
In this case, as @MichaelPetch points out, those specific constants are used to assemble a multiboot header into the output file. https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#OS-image-format
相关:
这篇关于x86 ASM:DD被用作“指令"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!