On 26.08.2019 08:51, Emmanuel Dreyfus wrote: > Hello > > I would like to add multiboot support to bootx64.efi. I had a look to > the multiboot protocol specification [1], and it seems to only deal > with 32 bit environment. The version 2.0 of the protocol [2] has the same > approach. I understand that the BIOS booting procedure runs as 32 bit, > and the amd64 kernel switches to 64 bits once multiboot launches it. > > But bootx64.efi runs as 64 bits. If I understand correctly, adding > multiboot support for it means that the multiboot() function in > sys/arch/i386/stand/efiboot/bootx64/efibootx64.c should call the > 32 bits multiboot routine from sys/arch/i386/stand/lib/multiboot.S > with the arguments properly set up. > > That seems to require a multiboot64 assembly routine to take the > arguments from $rdi, $rsi, $rdx, store them on the stack, and > call multibot, something like this: > ENTRY(multiboot64) > pushq $rdx > pushq $rsi > pushq $rdi > call multiboot > > But obviously I also need to switch to 32 bit mode, something that > will require heavy x86 black magic. Anyone can help on that point? > > > [1] https://www.gnu.org/software/grub/manual/multiboot/multiboot.html > [2] https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html > Regarding multiboot amd64 boot. We need "qemu-system-x86_64 -kernel" (qemu uses multiboot) support in fuzzing environments. Right now we have some workarounds but they are unneeded complexity and difference with Linux.
Attachment:
signature.asc
Description: OpenPGP digital signature