rust-osdev / bootloader

An experimental pure-Rust x86 bootloader
Apache License 2.0
1.4k stars 214 forks source link

UEFI boot should provide runtime services to the kernel #312

Open jasoncouture opened 1 year ago

jasoncouture commented 1 year ago

UEFI runtime services can be useful for a variety of purposes. Some kernels may want access to these at runtime.

The UEFI bootloader should provide support for mapping runtime services, and providing a pointer to the runtime services table via boot info.

BIOS boot would simply set this field to None, as there is no runtime services (or rather, there are interrupts)

phil-opp commented 1 year ago

See also our discussion about this at https://gitter.im/rust-osdev/bootloader?at=639bc2872b937b1a2ec255d1.

The main challenge is that the UEFI runtime services use physical addressing by default. We switch to virtual memory before giving control to the kernel, so we need to call set_virtual_address_map to change the runtime addressing mode of the UEFI firmware. This function requires a memory map with updated virtual adresses. So we need to map all memory regions that are relevant to the UEFI runtime services to virtual memory.