summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/multiboot/multiboot.s
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-09-29 10:52:00 +0300
committerJoursoir <chat@joursoir.net>2022-10-07 22:18:32 +0300
commit9d1dc21b597470a1acb5b512c240c7f27b87b17c (patch)
treeab59d7377e63e862e62fd156520f36402994b536 /arch/x86/boot/multiboot/multiboot.s
parent387c11b9c8baff0e6f1617d80b95a9bbffcdfdf5 (diff)
downloadmfsos-9d1dc21b597470a1acb5b512c240c7f27b87b17c.tar.gz
mfsos-9d1dc21b597470a1acb5b512c240c7f27b87b17c.tar.bz2
mfsos-9d1dc21b597470a1acb5b512c240c7f27b87b17c.zip
x86/multiboot: add multiboot header
Unfortunately, GNU AS doesn't perform GCC-like preprocessing. So, to include the multiboot header in the assembly code, we should parse and format it to GAS-style.
Diffstat (limited to 'arch/x86/boot/multiboot/multiboot.s')
-rw-r--r--arch/x86/boot/multiboot/multiboot.s11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/boot/multiboot/multiboot.s b/arch/x86/boot/multiboot/multiboot.s
index 33e54f1..e6e8c21 100644
--- a/arch/x86/boot/multiboot/multiboot.s
+++ b/arch/x86/boot/multiboot/multiboot.s
@@ -1,13 +1,12 @@
# https://www.gnu.org/software/grub/manual/multiboot/multiboot.html
+.include "bare_multiboot.h" # the file is auto-generated
+
/*
Declare constants for the multiboot header.
*/
-.set ALIGN, 1 << 0 # align loaded modules on page boundaries
-.set MEMINFO, 1 << 1 # provide memory map
-.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
-.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
-.set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot
+.set FLAGS, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO # this is the Multiboot 'flag' field
+.set CHECKSUM, -(MULTIBOOT_HEADER_MAGIC + FLAGS) # checksum of above, to prove we are multiboot
/*
Declare a multiboot header that marks the program as a kernel.
@@ -19,7 +18,7 @@ its own section so the header can be forced to be within the first
*/
.section .multiboot
.align 4
-.long MAGIC
+.long MULTIBOOT_HEADER_MAGIC
.long FLAGS
.long CHECKSUM