diff options
author | 2013-06-01 22:22:50 +0000 | |
---|---|---|
committer | 2013-06-01 22:22:50 +0000 | |
commit | 29eb0eadeb1002c9f59dadd14fbffd4c443f2840 (patch) | |
tree | f759f14e5f7ca07219f141b7ef9f4a87107eaa82 | |
parent | Introduce a new amd64 IPI, x86_ipi_halt_realmode to park CPUS into real (diff) | |
download | wireguard-openbsd-29eb0eadeb1002c9f59dadd14fbffd4c443f2840.tar.xz wireguard-openbsd-29eb0eadeb1002c9f59dadd14fbffd4c443f2840.zip |
Call x86_ipi_halt_realmode to park APs in real mode before unpacking image
ok deraadt@
-rw-r--r-- | sys/arch/amd64/amd64/hibernate_machdep.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/hibernate_machdep.c b/sys/arch/amd64/amd64/hibernate_machdep.c index f6f7f8d7f9d..5e96b0266bd 100644 --- a/sys/arch/amd64/amd64/hibernate_machdep.c +++ b/sys/arch/amd64/amd64/hibernate_machdep.c @@ -395,11 +395,26 @@ hibernate_disable_intr_machdep(void) void hibernate_quiesce_cpus(void) { + int i; + + KASSERT(CPU_IS_PRIMARY(curcpu())); + /* Start the hatched (but idling) APs */ cpu_boot_secondary_processors(); sched_start_secondary_cpus(); - /* Now shut them down */ - acpi_sleep_mp(); + /* + * Wait for cpus to halt so we know their FPU state has been + * saved and their caches have been written back. + */ + x86_broadcast_ipi(X86_IPI_HALT_REALMODE); + for (i = 0; i < ncpus; i++) { + struct cpu_info *ci = cpu_info[i]; + + if (CPU_IS_PRIMARY(ci)) + continue; + while (ci->ci_flags & CPUF_RUNNING) + ; + } } #endif /* MULTIPROCESSOR */ |