A question about bootloaders and long mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
pearmypie
Posts: 21
Joined: Sat Mar 01, 2025 8:06 pm
GitHub: https://github.com/ionutcatana

A question about bootloaders and long mode

Post 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
sebihepp
Member
Member
Posts: 256
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: A question about bootloaders and long mode

Post 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?
User avatar
pearmypie
Posts: 21
Joined: Sat Mar 01, 2025 8:06 pm
GitHub: https://github.com/ionutcatana

Re: A question about bootloaders and long mode

Post 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.
sebihepp
Member
Member
Posts: 256
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: A question about bootloaders and long mode

Post 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"?
User avatar
pearmypie
Posts: 21
Joined: Sat Mar 01, 2025 8:06 pm
GitHub: https://github.com/ionutcatana

Re: A question about bootloaders and long mode

Post 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.
nullplan
Member
Member
Posts: 2034
Joined: Wed Aug 30, 2017 8:24 am

Re: A question about bootloaders and long mode

Post 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.
Carpe diem!
User avatar
pearmypie
Posts: 21
Joined: Sat Mar 01, 2025 8:06 pm
GitHub: https://github.com/ionutcatana

Re: A question about bootloaders and long mode

Post 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.
Post Reply