Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

64 bits EFI boot and multiboot protocol



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

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index