国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

kernel中efi變量初始化

2019-11-09 17:14:10
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
在setup_arch->efi_init->uefi_init->efi_config_parse_tablesint __init efi_config_parse_tables(void *config_tables, int count, int sz,                   efi_config_table_type_t *arch_tables){    void *tablep;    int i;    tablep = config_tables;    PR_info("");    for (i = 0; i < count; i++) {        efi_guid_t guid;        unsigned long table;        if (efi_enabled(EFI_64BIT)) {            u64 table64;            guid = ((efi_config_table_64_t *)tablep)->guid;            table64 = ((efi_config_table_64_t *)tablep)->table;            table = table64;#ifndef CONFIG_64BIT            if (table64 >> 32) {                pr_cont("/n");                pr_err("Table located above 4GB, disabling EFI./n");                return -EINVAL;            }#endif        } else {            guid = ((efi_config_table_32_t *)tablep)->guid;            table = ((efi_config_table_32_t *)tablep)->table;        }        if (!match_config_table(&guid, table, common_tables))            match_config_table(&guid, table, arch_tables);        tablep += sz;    }    pr_cont("/n");    set_bit(EFI_CONFIG_TABLES, &efi.flags);    /* Parse the EFI Properties table if it exists */    if (efi.properties_table != EFI_INVALID_TABLE_ADDR) {        efi_properties_table_t *tbl;        tbl = early_memremap(efi.properties_table, sizeof(*tbl));        if (tbl == NULL) {            pr_err("Could not map Properties table!/n");            return -ENOMEM;        }        if (tbl->memory_protection_attribute &            EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA)            set_bit(EFI_NX_PE_DATA, &efi.flags);        early_memunmap(tbl, sizeof(*tbl));    }    return 0;}在efi_config_parse_tables 中會(huì)對(duì)common_tables 中的ptr賦值,這樣我們就能在kernel中使用common_tables 中的指針static __initdata efi_config_table_type_t common_tables[] = {    {ACPI_20_TABLE_GUID, "ACPI 2.0", &efi.acpi20},    {ACPI_TABLE_GUID, "ACPI", &efi.acpi},    {HCDP_TABLE_GUID, "HCDP", &efi.hcdp},    {MPS_TABLE_GUID, "MPS", &efi.mps},    {SAL_SYSTEM_TABLE_GUID, "SALsystab", &efi.sal_systab},    {SMBIOS_TABLE_GUID, "SMBIOS", &efi.smbios},    {SMBIOS3_TABLE_GUID, "SMBIOS 3.0", &efi.smbios3},    {UGA_IO_PROTOCOL_GUID, "UGA", &efi.uga},    {EFI_SYSTEM_RESOURCE_TABLE_GUID, "ESRT", &efi.esrt},    {EFI_PROPERTIES_TABLE_GUID, "PROP", &efi.properties_table},    {EFI_MEMORY_ATTRIBUTES_TABLE_GUID, "MEMATTR", &efi.mem_attr_table},    {NULL_GUID, NULL, NULL},};具體是在在efi_config_parse_tables中的下面code中賦值.if (!match_config_table(&guid, table, common_tables))            match_config_table(&guid, table, arch_tables);同時(shí)會(huì)設(shè)定EFI_CONFIG_TABLES 這個(gè)flag。set_bit(EFI_CONFIG_TABLES, &efi.flags);如果uefi中有Properties table 的話,會(huì)設(shè)定set_bit(EFI_NX_PE_DATA, &efi.flags);最后補(bǔ)充一下,在match_config_table 中是根據(jù)guid 來(lái)找對(duì)應(yīng)的table的.static __init int match_config_table(efi_guid_t *guid,                     unsigned long table,                     efi_config_table_type_t *table_types){    int i;    if (table_types) {        for (i = 0; efi_guidcmp(table_types[i].guid, NULL_GUID); i++) {            if (!efi_guidcmp(*guid, table_types[i].guid)) {                *(table_types[i].ptr) = table;                if (table_types[i].name)                    pr_cont(" %s=0x%lx ",                        table_types[i].name, table);                return 1;            }        }    }    return 0;}
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 富源县| 巫溪县| 同江市| 高青县| 平顺县| 宜兴市| 游戏| 花垣县| 仁布县| 克拉玛依市| 淳安县| 东乡| 龙游县| 鸡西市| 曲阳县| 吴忠市| 山阳县| 日土县| 嫩江县| 建昌县| 旺苍县| 应用必备| 民勤县| 华安县| 永和县| 清涧县| 遂平县| 瑞安市| 华亭县| 石渠县| 长葛市| 万州区| 白河县| 武陟县| 吴川市| 武宣县| 新疆| 瑞金市| 克拉玛依市| 石城县| 固阳县|