x86 ASM: DD Being Used as an “Instruction”?

后端 未结 1 1828
野性不改
野性不改 2021-01-27 01:45

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 wha

相关标签:
1条回答
  • 2021-01-27 02:47

    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.

    The NASM manual section 3.2 Pseudo-Instructions describes db/dw/dd and so on.

    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

    How does this assembly bootloader code work?


    Related:

    How are dw and dd different from db directives for strings?

    What is the use of .byte assembler directive in gnu assembly?

    x86 assembly - Which variable size to use (db, dw, dd)

    0 讨论(0)
提交回复
热议问题