簡體   English   中英

x86 UEFI 啟動:UEFI 真的需要從地址 0 開始的傳統 1MiB 填充嗎?

[英]x86 UEFI Boot: Is the conventional 1MiB padding from address 0 really required for UEFI?

我對使用 UEFI 在 x86_64 上的 kernel 開發和啟動過程比較陌生。 許多通用操作系統開發資源建議將初始 object 文件中的前 1 MiB 保留為空閑/未觸及,因為存在“許多已映射的遺留功能 I/O,例如 VGA 幀緩沖區”。

這僅適用於傳統 BIOS 引導還是仍然適用於 UEFI?

示例 linker 腳本:

ENTRY(start)

SECTIONS {
    /* According to https://intermezzos.github.io/book/first-edition/hello-world.html
     * there is lots of memory mapped I/O and 1MiB is a conventional padding (legacy?!)
     * TODO find out if this only is valid for legacy BIOS boot or also for UEFI!
     */
    . = 1M;

    .text :
    {
        *(.text)
    }

     .bss :
    {
      *(COMMON)
      *(.bss)
    }
}

EFI 引導服務 function GetMemoryMap 提供的 memory map GetMemoryMap 標識所有使用的頁面和可用的頁面。 調用 ExitBootServices 后,您應該可以隨意使用任何可用頁面。

在調用 ExitBootServices 之前,您應該調用 AllocatePool 或 AllocatePages 以獲取 memory。 如果您特別想在第一個兆字節內分配 memory,則可以使用 type = ALLOCATE_MAX_ADDRESS 和 address = 0xfffff 調用 AllocatePages。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM