国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 甘孜| 濮阳县| 双辽市| 孝昌县| 新邵县| 昭平县| 云浮市| 奉节县| 元朗区| 石嘴山市| 上高县| 镇赉县| 吴桥县| 嘉祥县| 朔州市| 大宁县| 宝丰县| 呼图壁县| 达州市| 定安县| 登封市| 连江县| 电白县| 阿克| 洛扎县| 四川省| 通榆县| 东方市| 犍为县| 哈尔滨市| 峨边| 南郑县| 陕西省| 会宁县| 林口县| 宣化县| 沐川县| 麻江县| 东海县| 永定县| 津市市|