From 9d1dc21b597470a1acb5b512c240c7f27b87b17c Mon Sep 17 00:00:00 2001 From: Joursoir Date: Thu, 29 Sep 2022 10:52:00 +0300 Subject: 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. --- arch/x86/boot/multiboot/multiboot.s | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'arch/x86/boot/multiboot/multiboot.s') 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 -- cgit v1.2.3-18-g5258