// SPDX-License-Identifier: GPL-2.0-only /* * handle transition of Linux booting another kernel * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com>
*/
/* * A architecture hook called to validate the * proposed image and prepare the control pages * as needed. The pages for KEXEC_CONTROL_PAGE_SIZE * have been allocated, but the segments have yet * been copied into the kernel. * * Do what every setup is needed on image and the * reboot code buffer to allow us to avoid allocations * later. * * - Make control page executable. * - Allocate page tables * - Setup page tables
*/ int machine_kexec_prepare(struct kimage *image)
{ int error;
/* * Undo anything leftover by machine_kexec_prepare * when an image is freed.
*/ void machine_kexec_cleanup(struct kimage *image)
{
set_memory_nx((unsignedlong)page_address(image->control_code_page), 1);
machine_kexec_free_page_tables(image);
}
/* * Do not allocate memory (or fail in any way) in machine_kexec(). * We are past the point of no return, committed to rebooting now.
*/ void machine_kexec(struct kimage *image)
{
relocate_kernel_fn *relocate_kernel_ptr; unsignedlong page_list[PAGES_NR]; void *control_page; int save_ftrace_enabled;
#ifdef CONFIG_KEXEC_JUMP if (image->preserve_context)
save_processor_state(); #endif
save_ftrace_enabled = __ftrace_enabled_save();
/* Interrupts aren't acceptable while we reboot */
local_irq_disable();
hw_breakpoint_disable();
if (image->preserve_context) { #ifdef CONFIG_X86_IO_APIC /* * We need to put APICs in legacy mode so that we can * get timer interrupts in second kernel. kexec/kdump * paths already have calls to restore_boot_irq_mode() * in one form or other. kexec jump path also need one.
*/
clear_IO_APIC();
restore_boot_irq_mode(); #endif
}
if (image->type == KEXEC_TYPE_DEFAULT)
page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
<< PAGE_SHIFT);
/* * The segment registers are funny things, they have both a * visible and an invisible part. Whenever the visible part is * set to a specific selector, the invisible part is loaded * with from a table in memory. At no other time is the * descriptor table in memory accessed. * * I take advantage of this here by force loading the * segments, before I zap the gdt with an invalid value.
*/
load_segments(); /* * The gdt & idt are now invalid. * If you want to load them you must set up your own idt & gdt.
*/
native_idt_invalidate();
native_gdt_invalidate();
/* now call it */
image->start = relocate_kernel_ptr((unsignedlong)image->head,
(unsignedlong)page_list,
image->start,
boot_cpu_has(X86_FEATURE_PAE),
image->preserve_context);
#ifdef CONFIG_KEXEC_JUMP if (image->preserve_context)
restore_processor_state(); #endif
__ftrace_enabled_restore(save_ftrace_enabled);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.