arch/x86/kernel/machine_kexec_64.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/machine_kexec_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/machine_kexec_64.c- Extension
.c- Size
- 18622 bytes
- Lines
- 710
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mm.hlinux/kexec.hlinux/string.hlinux/gfp.hlinux/reboot.hlinux/numa.hlinux/ftrace.hlinux/io.hlinux/suspend.hlinux/vmalloc.hlinux/efi.hlinux/cc_platform.hasm/init.hasm/tlbflush.hasm/mmu_context.hasm/io_apic.hasm/debugreg.hasm/kexec-bzimage64.hasm/setup.hasm/set_memory.hasm/cpu.hasm/efi.hasm/processor.h
Detected Declarations
struct init_pgtable_datafunction mem_region_callbackfunction map_acpi_tablesfunction map_acpi_tablesfunction map_mmio_serialfunction map_efi_systabfunction free_transition_pgtablefunction init_transition_pgtablefunction init_pgtablefunction load_segmentsfunction prepare_debug_idtfunction machine_kexec_preparefunction machine_kexec_cleanupfunction memoryfunction arch_kexec_apply_relocations_addfunction arch_kimage_file_post_load_cleanupfunction kexec_mark_rangefunction kexec_mark_crashkresfunction kexec_mark_dm_crypt_keysfunction arch_kexec_protect_crashkresfunction arch_kexec_unprotect_crashkresfunction arch_kexec_post_alloc_pagesfunction arch_kexec_pre_free_pages
Annotated Snippet
struct init_pgtable_data {
struct x86_mapping_info *info;
pgd_t *level4p;
};
static int mem_region_callback(struct resource *res, void *arg)
{
struct init_pgtable_data *data = arg;
return kernel_ident_mapping_init(data->info, data->level4p,
res->start, res->end + 1);
}
static int
map_acpi_tables(struct x86_mapping_info *info, pgd_t *level4p)
{
struct init_pgtable_data data;
unsigned long flags;
int ret;
data.info = info;
data.level4p = level4p;
flags = IORESOURCE_MEM | IORESOURCE_BUSY;
ret = walk_iomem_res_desc(IORES_DESC_ACPI_TABLES, flags, 0, -1,
&data, mem_region_callback);
if (ret && ret != -EINVAL)
return ret;
/* ACPI tables could be located in ACPI Non-volatile Storage region */
ret = walk_iomem_res_desc(IORES_DESC_ACPI_NV_STORAGE, flags, 0, -1,
&data, mem_region_callback);
if (ret && ret != -EINVAL)
return ret;
return 0;
}
#else
static int map_acpi_tables(struct x86_mapping_info *info, pgd_t *level4p) { return 0; }
#endif
static int map_mmio_serial(struct x86_mapping_info *info, pgd_t *level4p)
{
unsigned long mstart, mend;
if (!kexec_debug_8250_mmio32)
return 0;
mstart = kexec_debug_8250_mmio32 & PAGE_MASK;
mend = (kexec_debug_8250_mmio32 + PAGE_SIZE + 23) & PAGE_MASK;
pr_info("Map PCI serial at %lx - %lx\n", mstart, mend);
return kernel_ident_mapping_init(info, level4p, mstart, mend);
}
#ifdef CONFIG_KEXEC_FILE
const struct kexec_file_ops * const kexec_file_loaders[] = {
&kexec_bzImage64_ops,
NULL
};
#endif
static int
map_efi_systab(struct x86_mapping_info *info, pgd_t *level4p)
{
#ifdef CONFIG_EFI
unsigned long mstart, mend;
void *kaddr;
int ret;
if (!efi_enabled(EFI_BOOT))
return 0;
mstart = (boot_params.efi_info.efi_systab |
((u64)boot_params.efi_info.efi_systab_hi<<32));
if (efi_enabled(EFI_64BIT))
mend = mstart + sizeof(efi_system_table_64_t);
else
mend = mstart + sizeof(efi_system_table_32_t);
if (!mstart)
return 0;
ret = kernel_ident_mapping_init(info, level4p, mstart, mend);
if (ret)
return ret;
kaddr = memremap(mstart, mend - mstart, MEMREMAP_WB);
if (!kaddr) {
pr_err("Could not map UEFI system table\n");
Annotation
- Immediate include surface: `linux/mm.h`, `linux/kexec.h`, `linux/string.h`, `linux/gfp.h`, `linux/reboot.h`, `linux/numa.h`, `linux/ftrace.h`, `linux/io.h`.
- Detected declarations: `struct init_pgtable_data`, `function mem_region_callback`, `function map_acpi_tables`, `function map_acpi_tables`, `function map_mmio_serial`, `function map_efi_systab`, `function free_transition_pgtable`, `function init_transition_pgtable`, `function init_pgtable`, `function load_segments`.
- 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.