include/linux/kexec.h
Source file repositories/reference/linux-study-clean/include/linux/kexec.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/kexec.h- Extension
.h- Size
- 14819 bytes
- Lines
- 558
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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/vmcore_info.hlinux/crash_reserve.hasm/io.hlinux/range.huapi/linux/kexec.hlinux/verification.hlinux/prandom.hlinux/list.hlinux/compat.hlinux/ioport.hlinux/module.hlinux/highmem.hasm/kexec.hlinux/crash_core.h
Detected Declarations
struct kexec_segmentstruct compat_kexec_segmentstruct purgatory_infostruct kimagestruct kexec_file_opsstruct kexec_bufstruct kexec_elf_infostruct kimagestruct pt_regsstruct task_structstruct kimagefunction kexec_random_range_startfunction kexec_random_range_startfunction arch_kexec_kernel_image_probefunction arch_kimage_file_post_load_cleanupfunction arch_check_excluded_rangefunction arch_kexec_locate_mem_holefunction arch_kexec_apply_relocations_addfunction arch_kexec_apply_relocationsfunction machine_kexec_post_loadfunction page_to_boot_pfnfunction phys_to_boot_physfunction boot_phys_to_physfunction crash_free_reserved_phys_rangefunction virt_to_boot_physfunction arch_kexec_post_alloc_pagesfunction arch_kexec_pre_free_pagesfunction __crash_kexecfunction kexec_crash_loadedfunction kimage_unmap_segmentfunction set_kexec_sig_enforced
Annotated Snippet
struct kexec_segment {
/*
* This pointer can point to user memory if kexec_load() system
* call is used or will point to kernel memory if
* kexec_file_load() system call is used.
*
* Use ->buf when expecting to deal with user memory and use ->kbuf
* when expecting to deal with kernel memory.
*/
union {
void __user *buf;
void *kbuf;
};
size_t bufsz;
unsigned long mem;
size_t memsz;
};
#ifdef CONFIG_COMPAT
struct compat_kexec_segment {
compat_uptr_t buf;
compat_size_t bufsz;
compat_ulong_t mem; /* User space sees this as a (void *) ... */
compat_size_t memsz;
};
#endif
#ifdef CONFIG_KEXEC_FILE
struct purgatory_info {
/*
* Pointer to elf header at the beginning of kexec_purgatory.
* Note: kexec_purgatory is read only
*/
const Elf_Ehdr *ehdr;
/*
* Temporary, modifiable buffer for sechdrs used for relocation.
* This memory can be freed post image load.
*/
Elf_Shdr *sechdrs;
/*
* Temporary, modifiable buffer for stripped purgatory used for
* relocation. This memory can be freed post image load.
*/
void *purgatory_buf;
};
struct kimage;
typedef int (kexec_probe_t)(const char *kernel_buf, unsigned long kernel_size);
typedef void *(kexec_load_t)(struct kimage *image, char *kernel_buf,
unsigned long kernel_len, char *initrd,
unsigned long initrd_len, char *cmdline,
unsigned long cmdline_len);
typedef int (kexec_cleanup_t)(void *loader_data);
#ifdef CONFIG_KEXEC_SIG
typedef int (kexec_verify_sig_t)(const char *kernel_buf,
unsigned long kernel_len);
#endif
struct kexec_file_ops {
kexec_probe_t *probe;
kexec_load_t *load;
kexec_cleanup_t *cleanup;
#ifdef CONFIG_KEXEC_SIG
kexec_verify_sig_t *verify_sig;
#endif
};
extern const struct kexec_file_ops * const kexec_file_loaders[];
int kexec_image_probe_default(struct kimage *image, void *buf,
unsigned long buf_len);
int kexec_image_post_load_cleanup_default(struct kimage *image);
/*
* If kexec_buf.mem is set to this value, kexec_locate_mem_hole()
* will try to allocate free memory. Arch may overwrite it.
*/
#ifndef KEXEC_BUF_MEM_UNKNOWN
#define KEXEC_BUF_MEM_UNKNOWN 0
#endif
/**
* struct kexec_buf - parameters for finding a place for a buffer in memory
* @image: kexec image in which memory to search.
* @buffer: Contents which will be copied to the allocated memory.
* @bufsz: Size of @buffer.
* @mem: On return will have address of the buffer in memory.
* @memsz: Size for the buffer in memory.
Annotation
- Immediate include surface: `linux/vmcore_info.h`, `linux/crash_reserve.h`, `asm/io.h`, `linux/range.h`, `uapi/linux/kexec.h`, `linux/verification.h`, `linux/prandom.h`, `linux/list.h`.
- Detected declarations: `struct kexec_segment`, `struct compat_kexec_segment`, `struct purgatory_info`, `struct kimage`, `struct kexec_file_ops`, `struct kexec_buf`, `struct kexec_elf_info`, `struct kimage`, `struct pt_regs`, `struct task_struct`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.