From 2f95320e0859029f520d46f777591751dcd39634 Mon Sep 17 00:00:00 2001 From: Arseney300 Date: Wed, 8 Apr 2026 02:32:55 +0700 Subject: doc: add information about grub multiboot --- doc/boot/grub_multiboot.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 doc/boot/grub_multiboot.md diff --git a/doc/boot/grub_multiboot.md b/doc/boot/grub_multiboot.md new file mode 100644 index 0000000..8239674 --- /dev/null +++ b/doc/boot/grub_multiboot.md @@ -0,0 +1,16 @@ +## GRUB multiboot + +So, technically GRUB can load and ELF64 with some moments: + +1) Multiboot requires special header. +2) Special calling convention - Multiboot passes boot info in EAX/EBX (magic + Multiboot info struct pointer). +3) Multiboot1 enters in 32-bit protected mode - Long mode is not set up. We need a 32->64 bit trampoline. +Multiboot2 has a 64-bit EFI handoff tag, but that's a different path. +4) Multiboot is x86-only +5) We haven't BootInfo, like i did in UEFI + +Also Multiboot have stack. When UEFI jumps to kernel, no stack exists for the kernel. Because of it i use asm code to run kernel. +GRUB sets up a basic stack before jump. But, we don't know size and location of this stack. + + +Example of "kernel" that use it: https://github.com/igmunv/kosmos -- cgit v1.2.3