Add unified BIOS and UEFI support to XTLDR #22

Open
opened 2025-10-16 07:53:59 +02:00 by harraiken · 0 comments
Owner

Current version of XTLDR supports only UEFI-based boot environments. We need to extend the bootloader to also support legacy BIOS systems while maintaining compatibility with UEFI.

  • Rework the disk access layer so that it functions correctly in both BIOS and UEFI environments.
  • Integrate the PECOFF loader module directly into the bootloader core, allowing it to load modules without relying on UEFI services.
  • Refactor all existing modules to remove any direct dependencies on UEFI and make them compatible with both platforms.
  • Introduce a common module API that works consistently across both BIOS and UEFI boot modes.
  • Determine how to retrieve low-level data that normally requires BIOS interrupts (e.g., the memory map). Since interrupts only work in real mode, consider one of the following approaches:
    • Implement this logic in the VBR, passing all required data to the main bootloader via parameters, or
    • Implement a trampoline mechanism that allows temporarily switching from protected/long mode back to real mode, invoking the necessary BIOS interrupt, and returning safely.

BiosUtils class has already been added, providing basic VGA output. This allows XTLDR to display messages such as "XTLDR requires EFI-based system!"

The entire codebase should be refactored to separate platform-specific components, for example:

  • uefi/console.cc
  • bios/console.cc
    so that the correct implementation is used depending on the boot environment.
Current version of XTLDR supports only UEFI-based boot environments. We need to extend the bootloader to also support legacy BIOS systems while maintaining compatibility with UEFI. - [ ] Rework the disk access layer so that it functions correctly in both BIOS and UEFI environments. - [ ] Integrate the PECOFF loader module directly into the bootloader core, allowing it to load modules without relying on UEFI services. - [ ] Refactor all existing modules to remove any direct dependencies on UEFI and make them compatible with both platforms. - [ ] Introduce a common module API that works consistently across both BIOS and UEFI boot modes. - [ ] Determine how to retrieve low-level data that normally requires BIOS interrupts (e.g., the memory map). Since interrupts only work in real mode, consider one of the following approaches: - [ ] Implement this logic in the VBR, passing all required data to the main bootloader via parameters, or - [ ] Implement a trampoline mechanism that allows temporarily switching from protected/long mode back to real mode, invoking the necessary BIOS interrupt, and returning safely. BiosUtils class has already been added, providing basic VGA output. This allows XTLDR to display messages such as "XTLDR requires EFI-based system!" The entire codebase should be refactored to separate platform-specific components, for example: - uefi/console.cc - bios/console.cc so that the correct implementation is used depending on the boot environment.
Sign in to join this conversation.
No description provided.