我正在为我的内核使用 multiboot2,我正在尝试从 GRUB2 获取 ELF 符号,但我不知道该怎么做。
我已经在boot.s中设置了.long MULTIBOOT_TAG_TYPE_ELF_SECTIONS
,我也从grub2中获得了精灵类型,大小,数字,entsize和shndx。
.section .multiboot_header
.align 8
multiboot_header:
.long MULTIBOOT2_HEADER_MAGIC
.long MULTIBOOT_ARCHITECTURE_I386
.long multiboot_header_end - multiboot_header
.long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + multiboot_header_end - multiboot_header)
# multiboot2 information request
.align 8
mbi_tag_start:
.short MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST
.short MULTIBOOT_HEADER_TAG_OPTIONAL
.long mbi_tag_end - mbi_tag_start
.long MULTIBOOT_TAG_TYPE_CMDLINE
.long MULTIBOOT_TAG_TYPE_MODULE
.long MULTIBOOT_TAG_TYPE_BOOTDEV
.long MULTIBOOT_TAG_TYPE_MMAP
.long MULTIBOOT_TAG_TYPE_ELF_SECTIONS
.long MULTIBOOT_TAG_TYPE_APM
.align 8
mbi_tag_end:
.short MULTIBOOT_HEADER_TAG_END
.short 0
.long 8
multiboot_header_end:
struct multiboot_tag_elf_sections {
multiboot_uint32_t type;
multiboot_uint32_t size;
multiboot_uint32_t num;
multiboot_uint32_t entsize;
multiboot_uint32_t shndx;
char sections[0];
};
在多重引导信息中搜索类型=9的标记。