-/* overwrites random kernel memory. Should not be kernel .text */
-#define WARMBOOT_TRAMP 0x1000UL
-
-static void reboot_warm(void)
-{
- extern unsigned char warm_reboot[], warm_reboot_end[];
- printk("warm reboot\n");
-
- local_irq_disable();
-
- /* restore identity mapping */
- init_level4_pgt[0] = __pml4(__pa(level3_ident_pgt) | 7);
- __flush_tlb_all();
-
- /* Move the trampoline to low memory */
- memcpy(__va(WARMBOOT_TRAMP), warm_reboot, warm_reboot_end - warm_reboot);
-
- /* Start it in compatibility mode. */
- asm volatile( " pushq $0\n" /* ss */
- " pushq $0x2000\n" /* rsp */
- " pushfq\n" /* eflags */
- " pushq %[cs]\n"
- " pushq %[target]\n"
- " iretq" ::
- [cs] "i" (__KERNEL_COMPAT32_CS),
- [target] "b" (WARMBOOT_TRAMP));
-}
-
-#ifdef CONFIG_SMP
-static void smp_halt(void)
-{
- int cpuid = safe_smp_processor_id();
- static int first_entry = 1;
-
- if (first_entry) {
- first_entry = 0;
- smp_call_function((void *)machine_restart, NULL, 1, 0);
- }
-
- smp_stop_cpu();
-
- /* AP calling this. Just halt */
- if (cpuid != boot_cpu_id) {
- for (;;)
- asm("hlt");
- }
-
- /* Wait for all other CPUs to have run smp_stop_cpu */
- while (!cpus_empty(cpu_online_map))
- rep_nop();
-}
-#endif
-