X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/28c176b668c841a3b7fb093faccf0efa39257603..71e44ac5296a7819554ce50b79129d64fd740e8f:/lunaix-os/arch/x86/includes/sys/boot/multiboot.S.inc diff --git a/lunaix-os/arch/x86/includes/sys/boot/multiboot.S.inc b/lunaix-os/arch/x86/includes/sys/boot/multiboot.S.inc index 061680d..243fc90 100644 --- a/lunaix-os/arch/x86/includes/sys/boot/multiboot.S.inc +++ b/lunaix-os/arch/x86/includes/sys/boot/multiboot.S.inc @@ -1,15 +1,36 @@ #define __ASM__ +#include #include "multiboot.h" .section .multiboot __mb_start: .4byte MULTIBOOT_MAGIC +/* + One may wondering why we set the address header part. + + This is due to some weirdo's patch to QEMU that prohibit loading + ELF64 using -kernel option. The only way to get around is to + fool multiboot loader by pretend ourselves a non-elf kernel. + + Although one may think this "trick" is some-how not portable, + the fact is actually the other-way around. It allow us to relax + the assumption that grub (or other multiboot compliances) made on + our executable. + */ + #ifdef CONFIG_X86_BL_MB - #define MB_FLAGS (MULTIBOOT_MEMORY_INFO | MULTIBOOT_PAGE_ALIGN) + #define MB_FLAGS ( MULTIBOOT_MEMORY_INFO |\ + MULTIBOOT_PAGE_ALIGN |\ + MULTIBOOT_AOUT_KLUDGE ) .4byte MB_FLAGS .4byte -(MULTIBOOT_MAGIC + MB_FLAGS) + .4byte __mb_start + .4byte __kload_start + .4byte __kload_end + .4byte __kbss_end + .4byte ENTRY_POINT #elif CONFIG_X86_BL_MB2 #define HDR_LEN (__mb_end - __mb_start) @@ -20,8 +41,8 @@ __mb_start: .align MULTIBOOT_TAG_ALIGN __mbir_tag_start: - .2byte MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST - .2byte 0 + .2byte MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST + .2byte 0 .4byte __mbir_tag_end - __mbir_tag_start .4byte MULTIBOOT_TAG_TYPE_CMDLINE .4byte MULTIBOOT_TAG_TYPE_MMAP @@ -29,10 +50,27 @@ __mb_start: .4byte MULTIBOOT_TAG_TYPE_MODULE __mbir_tag_end: + __maddr_tag_start: + .2byte MULTIBOOT_HEADER_TAG_ADDRESS + .2byte 0 + .4byte __maddr_tag_end - __maddr_tag_start + .4byte __mb_start + .4byte __kload_start + .4byte __kload_end + .4byte __kbss_end + __maddr_tag_end: + + __ment_tag_start: + .2byte MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS + .2byte 0 + .4byte __ment_tag_end - __ment_tag_start + .4byte ENTRY_POINT + __ment_tag_end: + .align MULTIBOOT_TAG_ALIGN .2byte MULTIBOOT_HEADER_TAG_END .2byte 0 - .4byte 8 + .4byte 8 #endif