summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2013-06-01 22:22:51 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2013-06-01 22:22:51 +0000
commit86db52ef5b5a59e654c209e52fd06afa076a9c68 (patch)
treead1b16f806ccec01c43ff6b6412f9100a0e78a16 /sys
parent59e37e11197b0f3b7044ff5b75f4da666c47de0c (diff)
Call x86_ipi_halt_realmode to park APs in real mode before unpacking image
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/hibernate_machdep.c19
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 */