#define pr_fmt(fmt) …
#include <linux/btf.h>
#include <linux/capability.h>
#include <linux/mm.h>
#include <linux/file.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/kexec.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/highmem.h>
#include <linux/syscalls.h>
#include <linux/reboot.h>
#include <linux/ioport.h>
#include <linux/hardirq.h>
#include <linux/elf.h>
#include <linux/elfcore.h>
#include <linux/utsname.h>
#include <linux/numa.h>
#include <linux/suspend.h>
#include <linux/device.h>
#include <linux/freezer.h>
#include <linux/panic_notifier.h>
#include <linux/pm.h>
#include <linux/cpu.h>
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/console.h>
#include <linux/vmalloc.h>
#include <linux/swap.h>
#include <linux/syscore_ops.h>
#include <linux/compiler.h>
#include <linux/hugetlb.h>
#include <linux/objtool.h>
#include <linux/kmsg_dump.h>
#include <asm/page.h>
#include <asm/sections.h>
#include <crypto/hash.h>
#include "kexec_internal.h"
atomic_t __kexec_lock = …;
bool kexec_in_progress = …;
bool kexec_file_dbg_print;
#define KIMAGE_NO_DEST …
#define PAGE_COUNT(x) …
static struct page *kimage_alloc_page(struct kimage *image,
gfp_t gfp_mask,
unsigned long dest);
int sanity_check_segment_list(struct kimage *image)
{ … }
struct kimage *do_kimage_alloc_init(void)
{ … }
int kimage_is_destination_range(struct kimage *image,
unsigned long start,
unsigned long end)
{ … }
static struct page *kimage_alloc_pages(gfp_t gfp_mask, unsigned int order)
{ … }
static void kimage_free_pages(struct page *page)
{ … }
void kimage_free_page_list(struct list_head *list)
{ … }
static struct page *kimage_alloc_normal_control_pages(struct kimage *image,
unsigned int order)
{ … }
#ifdef CONFIG_CRASH_DUMP
static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
unsigned int order)
{ … }
#endif
struct page *kimage_alloc_control_pages(struct kimage *image,
unsigned int order)
{ … }
static int kimage_add_entry(struct kimage *image, kimage_entry_t entry)
{ … }
static int kimage_set_destination(struct kimage *image,
unsigned long destination)
{ … }
static int kimage_add_page(struct kimage *image, unsigned long page)
{ … }
static void kimage_free_extra_pages(struct kimage *image)
{ … }
void kimage_terminate(struct kimage *image)
{ … }
#define for_each_kimage_entry(image, ptr, entry) …
static void kimage_free_entry(kimage_entry_t entry)
{ … }
void kimage_free(struct kimage *image)
{ … }
static kimage_entry_t *kimage_dst_used(struct kimage *image,
unsigned long page)
{ … }
static struct page *kimage_alloc_page(struct kimage *image,
gfp_t gfp_mask,
unsigned long destination)
{ … }
static int kimage_load_normal_segment(struct kimage *image,
struct kexec_segment *segment)
{ … }
#ifdef CONFIG_CRASH_DUMP
static int kimage_load_crash_segment(struct kimage *image,
struct kexec_segment *segment)
{ … }
#endif
int kimage_load_segment(struct kimage *image,
struct kexec_segment *segment)
{ … }
struct kexec_load_limit { … };
static struct kexec_load_limit load_limit_reboot = …;
static struct kexec_load_limit load_limit_panic = …;
struct kimage *kexec_image;
struct kimage *kexec_crash_image;
static int kexec_load_disabled;
#ifdef CONFIG_SYSCTL
static int kexec_limit_handler(const struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{ … }
static struct ctl_table kexec_core_sysctls[] = …;
static int __init kexec_core_sysctl_init(void)
{ … }
late_initcall(kexec_core_sysctl_init);
#endif
bool kexec_load_permitted(int kexec_image_type)
{ … }
int kernel_kexec(void)
{ … }