/* Copyright (C) 2021,2022 fef . All rights reserved. */ #include #include #include #include .code32 /* see ../config/kernel{32,64}.ld */ .extern _image_start_phys .extern _kernel_end_phys .extern _image_end_phys .extern _setup /* setup{32,64}.S */ .section .multiboot.data, "a", @progbits .align MB2_HEADER_ALIGN .global header_start header_start: /* struct mb2_header */ /* magic */ .long MB2_HEADER_MAGIC /* architecture */ .long MB2_ARCHITECTURE_I386 /* heaer_length */ .long header_end - header_start /* checksum */ .long (1 << 32) - MB2_HEADER_MAGIC - MB2_ARCHITECTURE_I386 - (header_end - header_start) #if 0 /* TODO: implement graphics */ .align MB2_TAG_ALIGN framebuffer_tag_start: /* struct mb2_header_tag_framebuffer */ /* type */ .short MB2_HEADER_TAG_FRAMEBUFFER /* flags */ .short MB2_HEADER_TAG_OPTIONAL /* size */ .long framebuffer_tag_end - framebuffer_tag_start /* width */ .long 1024 /* height */ .long 768 /* depth */ .long 32 framebuffer_tag_end: #endif /* framebuffer disabled */ .align MB2_TAG_ALIGN end_tag_start: /* struct mb2_header_tag */ /* type */ .short MB2_HEADER_TAG_END /* flags */ .short 0 /* size */ .long end_tag_end - end_tag_start end_tag_end: header_end: .size header_start, . - header_start /* * So, this is weird. * For some reason, the multiboot header is omitted in the compiled * binary if the entry point isn't in the same file (i've tried way * too many times). But, since the header is the same for both i386 * and amd64, we simply add this wrapper. */ .section .multiboot.text, "ax", @progbits ASM_ENTRY(_start) cli jmp _setup ASM_END(_start)