summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-12-06 22:56:20 +0000
committerkettenis <kettenis@openbsd.org>2013-12-06 22:56:20 +0000
commit0db66cf4bfc7cca6ba79e05552408379f470ffbc (patch)
treeaafb04a2d2fe7a5f314a45028a9ceadce8d4a946
parentAdd a DVACT_WAKEUP op to the *_activate() API. This is called after the (diff)
downloadwireguard-openbsd-0db66cf4bfc7cca6ba79e05552408379f470ffbc.tar.xz
wireguard-openbsd-0db66cf4bfc7cca6ba79e05552408379f470ffbc.zip
Make clflush() flush the cache line specified by the address we pass it
instead of the cache line containing the local variable used to specify the address. Fixes the gnome corruption and hangs people have been experiencing for the last couple of months or so. ok deraadt@, mlarkin@
-rw-r--r--sys/arch/amd64/include/cpufunc.h4
-rw-r--r--sys/arch/i386/include/cpufunc.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h
index 2e0001645c5..f48a3abe807 100644
--- a/sys/arch/amd64/include/cpufunc.h
+++ b/sys/arch/amd64/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.9 2013/10/05 16:58:30 guenther Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.10 2013/12/06 22:56:20 kettenis Exp $ */
/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
/*-
@@ -267,7 +267,7 @@ wbinvd(void)
static __inline void
clflush(u_int64_t addr)
{
- __asm __volatile("clflush %0" : "+m" (addr));
+ __asm __volatile("clflush %0" : "+m" (*(volatile char *)addr));
}
static __inline void
diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h
index 117679c9eb3..b9e7bea23af 100644
--- a/sys/arch/i386/include/cpufunc.h
+++ b/sys/arch/i386/include/cpufunc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpufunc.h,v 1.20 2013/10/09 01:48:41 guenther Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.21 2013/12/06 22:56:20 kettenis Exp $ */
/* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */
/*
@@ -224,7 +224,7 @@ wbinvd(void)
static __inline void
clflush(u_int32_t addr)
{
- __asm __volatile("clflush %0" : "+m" (addr));
+ __asm __volatile("clflush %0" : "+m" (*(volatile char *)addr));
}
static __inline void