arch/x86/platform/efi/efi_32.c
Source file repositories/reference/linux-study-clean/arch/x86/platform/efi/efi_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/platform/efi/efi_32.c- Extension
.c- Size
- 3850 bytes
- Lines
- 155
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/types.hlinux/ioport.hlinux/efi.hlinux/pgtable.hasm/io.hasm/desc.hasm/page.hasm/set_memory.hasm/tlbflush.hasm/efi.h
Detected Declarations
function Copyrightfunction efi_alloc_page_tablesfunction efi_sync_low_kernel_mappingsfunction efi_setup_page_tablesfunction efi_map_region_fixedfunction efi_set_virtual_address_mapfunction efi_runtime_update_mappingsfunction for_each_efi_memory_descfunction arch_efi_call_virt_setupfunction arch_efi_call_virt_teardown
Annotated Snippet
void efi_sync_low_kernel_mappings(void) {}
void __init efi_dump_pagetable(void)
{
#ifdef CONFIG_EFI_PGT_DUMP
ptdump_walk_pgd_level(NULL, &init_mm);
#endif
}
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{
return 0;
}
void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
efi_status_t efi_call_svam(efi_runtime_services_t * const *,
u32, u32, u32, void *, u32);
efi_status_t __init efi_set_virtual_address_map(unsigned long memory_map_size,
unsigned long descriptor_size,
u32 descriptor_version,
efi_memory_desc_t *virtual_map,
unsigned long systab_phys)
{
const efi_system_table_t *systab = (efi_system_table_t *)systab_phys;
struct desc_ptr gdt_descr;
efi_status_t status;
unsigned long flags;
pgd_t *save_pgd;
/* Current pgd is swapper_pg_dir, we'll restore it later: */
save_pgd = swapper_pg_dir;
load_cr3(initial_page_table);
__flush_tlb_all();
gdt_descr.address = get_cpu_gdt_paddr(0);
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
/* Disable interrupts around EFI calls: */
local_irq_save(flags);
status = efi_call_svam(&systab->runtime,
memory_map_size, descriptor_size,
descriptor_version, virtual_map,
__pa(&efi.runtime));
local_irq_restore(flags);
load_fixmap_gdt(0);
load_cr3(save_pgd);
__flush_tlb_all();
return status;
}
void __init efi_runtime_update_mappings(void)
{
if (__supported_pte_mask & _PAGE_NX) {
efi_memory_desc_t *md;
/* Make EFI runtime service code area executable */
for_each_efi_memory_desc(md) {
if (md->type != EFI_RUNTIME_SERVICES_CODE)
continue;
set_memory_x(md->virt_addr, md->num_pages);
}
}
}
void arch_efi_call_virt_setup(void)
{
efi_fpu_begin();
firmware_restrict_branch_speculation_start();
}
void arch_efi_call_virt_teardown(void)
{
firmware_restrict_branch_speculation_end();
efi_fpu_end();
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/ioport.h`, `linux/efi.h`, `linux/pgtable.h`, `asm/io.h`, `asm/desc.h`, `asm/page.h`.
- Detected declarations: `function Copyright`, `function efi_alloc_page_tables`, `function efi_sync_low_kernel_mappings`, `function efi_setup_page_tables`, `function efi_map_region_fixed`, `function efi_set_virtual_address_map`, `function efi_runtime_update_mappings`, `function for_each_efi_memory_desc`, `function arch_efi_call_virt_setup`, `function arch_efi_call_virt_teardown`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.