diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-08-19 19:31:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-08-19 19:31:54 +0000 |
commit | b0821890140f70e9e8358a5d7d1764f182999781 (patch) | |
tree | 269754d725155853cce4958e189eb7ddcc5c4547 /sys | |
parent | 42e8573202cb07e421faa5868d0b14d286d51eda (diff) |
Add "memory" clobber to lidt inline asm, to prevent the GCC optimizer from
getting stupid ideas like optimizing away stores to the descriptor that we're
setting. This may be overkill, but this code is far from performance
critical and it may prevent future surprises. Fixes instant reboots
with bsd.rd on Pentiums with the F00F bug.
Thanks to espie@, for narrowing the issue down enough for me to find the
problem. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/include/cpufunc.h | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/cpufunc.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h index 31a2c67ebc3..d57afa55048 100644 --- a/sys/arch/amd64/include/cpufunc.h +++ b/sys/arch/amd64/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.4 2009/12/09 14:28:46 oga Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.5 2010/08/19 19:31:53 kettenis Exp $ */ /* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */ /*- @@ -61,7 +61,7 @@ invlpg(u_int64_t addr) static __inline void lidt(void *p) { - __asm __volatile("lidt (%0)" : : "r" (p)); + __asm __volatile("lidt (%0)" : : "r" (p) : "memory"); } static __inline void diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h index 3f37e86627c..0da7c4807a6 100644 --- a/sys/arch/i386/include/cpufunc.h +++ b/sys/arch/i386/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.16 2009/12/09 14:28:46 oga Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.17 2010/08/19 19:31:53 kettenis Exp $ */ /* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */ /* @@ -78,7 +78,7 @@ invlpg(u_int addr) static __inline void lidt(void *p) { - __asm __volatile("lidt (%0)" : : "r" (p)); + __asm __volatile("lidt (%0)" : : "r" (p) : "memory"); } static __inline void |