summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2010-07-02 05:04:33 +0000
committerjsing <jsing@openbsd.org>2010-07-02 05:04:33 +0000
commit9e88ded37b42f43691982861596bebfef0b1e879 (patch)
tree82ba22a742dabc1a9934852b1fac942f1b07dfc2
parentApparently volatile does not mean what it is supposed to mean... avoid a (diff)
downloadwireguard-openbsd-9e88ded37b42f43691982861596bebfef0b1e879.tar.xz
wireguard-openbsd-9e88ded37b42f43691982861596bebfef0b1e879.zip
Add a comment to explain why the sync is necessary in the while loop.
-rw-r--r--sys/arch/hppa/hppa/fpu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/arch/hppa/hppa/fpu.c b/sys/arch/hppa/hppa/fpu.c
index 6296dcb4fa9..2e76b72b3cd 100644
--- a/sys/arch/hppa/hppa/fpu.c
+++ b/sys/arch/hppa/hppa/fpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu.c,v 1.3 2010/07/02 04:51:13 jsing Exp $ */
+/* $OpenBSD: fpu.c,v 1.4 2010/07/02 05:04:33 jsing Exp $ */
/*
* Copyright (c) 2010 Joel Sing <jsing@openbsd.org>
@@ -64,6 +64,11 @@ fpu_proc(struct proc *p, int save)
if (hppa_ipi_send(fpuci, HPPA_IPI_FPU_SAVE))
panic("FPU shootdown failed!\n");
+ /*
+ * The sync is essential here since the volatile on hfp_cpu
+ * is ignored by gcc. Without this we will deadlock since
+ * hfp_cpu is never reloaded within the loop.
+ */
while (hfp->hfp_cpu != NULL)
asm volatile ("sync" ::: "memory");