x86 ASM:DD被用作“指令"吗? [英] x86 ASM: DD Being Used as an "Instruction"?

查看:293
本文介绍了x86 ASM:DD被用作“指令"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下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,eax0x01 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

此程序集引导加载程序代码如何工作?

相关:

dw和dd与db指令是否包含字符串?

.byte的用途是什么gnu汇编中的汇编程序指令?

x86程序集-要使用哪个变量大小( db,dw,dd)

这篇关于x86 ASM:DD被用作“指令"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆