morpheus_bootloader::tui::distro_downloader

Module commit_download

Source
Expand description

Download commit flow - transitions from UEFI to bare-metal for ISO download.

This module handles the critical ExitBootServices transition:

  1. User has selected ISO from catalog and confirmed download
  2. This module prepares the BootHandoff structure
  3. Calibrates TSC timing
  4. Calls ExitBootServices (POINT OF NO RETURN)
  5. Jumps to bare_metal_main for actual download

Β§Safety

After ExitBootServices:

  • No UEFI runtime services for networking
  • No heap allocator (must pre-allocate)
  • No screen/console output (use serial)
  • Must use pre-allocated stack

StructsΒ§

EnumsΒ§

ConstantsΒ§

FunctionsΒ§

  • Calibrate TSC frequency using UEFI Stall service. Must be called BEFORE ExitBootServices.
  • Commit to download - this exits boot services and downloads in bare-metal mode.
  • Display countdown before committing to download.
  • find_esp_lba πŸ”’ ⚠
    Find ESP start LBA by querying LoadedImage -> DeviceHandle -> DevicePath
  • leak_string πŸ”’
    Leak a string so it becomes ’static. Safe to use since we’re about to exit boot services anyway.
  • Probe for VirtIO-blk device via PCI config space. Returns BlkProbeResult with device information. Probe for VirtIO-blk device via PCI config space. Returns BlkProbeResult with device information.
  • Probe for VirtIO NIC via PCI config space. Returns NicProbeResult with full transport information.
  • read_tsc πŸ”’
    Read TSC (Time Stamp Counter).