Page 1 of 1

A question about bootloaders and long mode

Posted: Sun Oct 05, 2025 7:05 am
by pearmypie
TL;DR: Can Limine load long mode kernels using the multiboot2 protocol?

I wish to use a ready-made bootloader & known protocol. I ranked them by (uninformed) my preference:
  1. Limine bootloader + multiboot2 protocol
  2. Limine bootloader + limine protocol
  3. GRUB2 bootloader + multiboot2 protocol
As I understand, GRUB cannot load 64-bit kernels, just 32-bit ones that setup long mode themselves. Limine can load long mode kernels using its own protocol. However, I would like to use Multiboot2 because I'm also writing a paper+project about it.

Is the long mode loading incapability GRUB's shortcoming or multiboot2's? Can Limine load long mode kernels using multiboot2? I can't seem to understand by reading Limine's repo and the multiboot spec. Edit: Yes, I know the `architecture` field of the multiboot2 header specifies the values 0 and 4 or 32-bit i386 and MIPS, but this seems incredibly odd...

Thank you for your time :D

Re: A question about bootloaders and long mode

Posted: Sun Oct 05, 2025 12:12 pm
by sebihepp
pearmypie wrote: Sun Oct 05, 2025 7:05 am Edit: Yes, I know the `architecture` field of the multiboot2 header specifies the values 0 and 4 or 32-bit i386 and MIPS, but this seems incredibly odd...
What exactly does seem odd to you?

Re: A question about bootloaders and long mode

Posted: Mon Oct 06, 2025 5:33 am
by pearmypie
I'm sorry that I didn't make it clear. What I meant is that it's odd that in so many years "0" and "4" are the only possible values. No Arm, PowerPC, SPARC, etc.

Re: A question about bootloaders and long mode

Posted: Mon Oct 06, 2025 4:19 pm
by sebihepp
pearmypie wrote: Mon Oct 06, 2025 5:33 am I'm sorry that I didn't make it clear. What I meant is that it's odd that in so many years "0" and "4" are the only possible values. No Arm, PowerPC, SPARC, etc.
Okay, now think about what that means for your question "can multiboot2 load directly into long mode"?

Re: A question about bootloaders and long mode

Posted: Fri Oct 17, 2025 11:47 am
by pearmypie
I didn't ask because I was crazy. Apparently I read some misinformation on the internet (shocking), but I can't find it again.

Re: A question about bootloaders and long mode

Posted: Fri Oct 17, 2025 12:19 pm
by nullplan
pearmypie wrote: Fri Oct 17, 2025 11:47 am I didn't ask because I was crazy. Apparently I read some misinformation on the internet (shocking), but I can't find it again.
Honestly, I seem to remember the same thing, but yeah, Multiboot and Multiboot2 are incapable of handing over control in 64-bit mode. But all that means for me is that the bootloader shim that transitions from the environment the bootloader gives me to the environment my kernel would like to have, has to be compiled as 32-bit code.

Re: A question about bootloaders and long mode

Posted: Mon Oct 20, 2025 4:08 pm
by pearmypie
nullplan wrote: Fri Oct 17, 2025 12:19 pm
pearmypie wrote: Fri Oct 17, 2025 11:47 am I didn't ask because I was crazy. Apparently I read some misinformation on the internet (shocking), but I can't find it again.
Honestly, I seem to remember the same thing, but yeah, Multiboot and Multiboot2 are incapable of handing over control in 64-bit mode. But all that means for me is that the bootloader shim that transitions from the environment the bootloader gives me to the environment my kernel would like to have, has to be compiled as 32-bit code.
I have found it, it was in the `multiboot2` Rust crate administered by the `rust-osdev` Github organization. This line made me think that when using UEFI firmware, a multiboot2 compliant bootloader would load directly into long mode.

Re: A question about bootloaders and long mode

Posted: Mon Oct 20, 2025 4:33 pm
by Octocontrabass