arch/x86/kernel/setup.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/setup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/setup.c- Extension
.c- Size
- 33518 bytes
- Lines
- 1316
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/acpi.hlinux/console.hlinux/cpu.hlinux/crash_dump.hlinux/dma-map-ops.hlinux/efi.hlinux/hugetlb.hlinux/ima.hlinux/init_ohci1394_dma.hlinux/initrd.hlinux/iscsi_ibft.hlinux/memblock.hlinux/panic_notifier.hlinux/pci.hlinux/random.hlinux/root_dev.hlinux/static_call.hlinux/sysfb.hlinux/swiotlb.hlinux/tboot.hlinux/usb/xhci-dbgp.hlinux/vmalloc.huapi/linux/mount.hxen/xen.hasm/apic.hasm/bios_ebda.hasm/bugs.hasm/cacheinfo.hasm/coco.hasm/cpu.hasm/efi.hasm/gart.h
Detected Declarations
function init_x86_sysctlfunction copy_eddfunction copy_eddfunction cleanup_highmapfunction get_ramdisk_imagefunction get_ramdisk_sizefunction relocate_initrdfunction early_reserve_initrdfunction reserve_initrdfunction early_reserve_initrdfunction ima_free_kexec_bufferfunction ima_get_kexec_bufferfunction add_khofunction parse_setup_datafunction parse_boot_paramsfunction memblock_x86_reserve_range_setup_datafunction arch_reserve_crashkernelfunction reserve_standard_io_resourcesfunction setup_kernel_resourcesfunction snb_gfx_workaround_neededfunction trim_snb_memoryfunction trim_bios_rangefunction e820_add_kernel_rangefunction early_reserve_memoryfunction dump_kernel_offsetfunction x86_configure_nxfunction x86_report_nxfunction systemsfunction i386_reserve_resourcesfunction register_kernel_offset_dumperfunction arch_cpu_is_hotpluggableexport apm_infoexport ist_infoexport boot_cpu_dataexport sysfb_primary_displayexport edd
Annotated Snippet
PFN_DOWN(ramdisk_end))) {
/* All are mapped, easy case */
initrd_start = ramdisk_image + PAGE_OFFSET;
initrd_end = initrd_start + ramdisk_size;
return;
}
relocate_initrd();
memblock_phys_free(ramdisk_image, ramdisk_end - ramdisk_image);
}
#else
static void __init early_reserve_initrd(void)
{
}
static void __init reserve_initrd(void)
{
}
#endif /* CONFIG_BLK_DEV_INITRD */
static void __init add_early_ima_buffer(u64 phys_addr)
{
#ifdef CONFIG_IMA
struct ima_setup_data *data;
data = early_memremap(phys_addr + sizeof(struct setup_data), sizeof(*data));
if (!data) {
pr_warn("setup: failed to memremap ima_setup_data entry\n");
return;
}
if (data->size) {
memblock_reserve_kern(data->addr, data->size);
ima_kexec_buffer_phys = data->addr;
ima_kexec_buffer_size = data->size;
}
early_memunmap(data, sizeof(*data));
#else
pr_warn("Passed IMA kexec data, but CONFIG_IMA not set. Ignoring.\n");
#endif
}
#if defined(CONFIG_HAVE_IMA_KEXEC) && !defined(CONFIG_OF_FLATTREE)
int __init ima_free_kexec_buffer(void)
{
if (!ima_kexec_buffer_size)
return -ENOENT;
memblock_phys_free(ima_kexec_buffer_phys,
ima_kexec_buffer_size);
ima_kexec_buffer_phys = 0;
ima_kexec_buffer_size = 0;
return 0;
}
int __init ima_get_kexec_buffer(void **addr, size_t *size)
{
int ret;
if (!ima_kexec_buffer_size)
return -ENOENT;
ret = ima_validate_range(ima_kexec_buffer_phys, ima_kexec_buffer_size);
if (ret)
return ret;
*addr = __va(ima_kexec_buffer_phys);
*size = ima_kexec_buffer_size;
return 0;
}
#endif
static void __init add_kho(u64 phys_addr, u32 data_len)
{
struct kho_data *kho;
u64 addr = phys_addr + sizeof(struct setup_data);
u64 size = data_len - sizeof(struct setup_data);
if (!IS_ENABLED(CONFIG_KEXEC_HANDOVER)) {
pr_warn("Passed KHO data, but CONFIG_KEXEC_HANDOVER not set. Ignoring.\n");
return;
}
kho = early_memremap(addr, size);
if (!kho) {
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/console.h`, `linux/cpu.h`, `linux/crash_dump.h`, `linux/dma-map-ops.h`, `linux/efi.h`, `linux/hugetlb.h`, `linux/ima.h`.
- Detected declarations: `function init_x86_sysctl`, `function copy_edd`, `function copy_edd`, `function cleanup_highmap`, `function get_ramdisk_image`, `function get_ramdisk_size`, `function relocate_initrd`, `function early_reserve_initrd`, `function reserve_initrd`, `function early_reserve_initrd`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.