閱碼場(chǎng)5小時(shí)深入理解linUX/ARM虛擬化
在用戶空間使用 gST 訪問系統(tǒng)表
上面示例中的模塊入口函數(shù) UefiMain 中使用傳入的參數(shù) SystemTable 訪問系統(tǒng)表。EDK2 為了方便開發(fā)者,提供了 UefiBootServicesTableLib,在 UefiLib 定義了全局變量 gST
、gBS、gImageHandle。這三個(gè)全局變量在函數(shù) UefiBootServicesTableLibConstructor 中被初始化,該函數(shù)是庫 UefiBootServicesTableLib 的構(gòu)造函數(shù),在 AutoGen.c 中的 ProcessLibraryConstructorList 被調(diào)用,而 ProcessLibraryConstructorList 是在 UefiMain 之前被調(diào)用的。
構(gòu)造函數(shù) UefiBootServicesTableLibConstructor 源碼:
標(biāo)簽: