Module Name: src
Committed By: maxv
Date: Sat Sep 7 11:09:03 UTC 2019
Modified Files:
src/sys/arch/x86/include: cpufunc.h
Log Message:
Add a memory barrier on wrmsr, because some MSRs control memory access
rights (we don't use them though). Also add barriers on fninit and clts
for safety.
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x86/include/cpufunc.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.34 src/sys/arch/x86/include/cpufunc.h:1.35
--- src/sys/arch/x86/include/cpufunc.h:1.34 Fri Jul 5 17:08:55 2019
+++ src/sys/arch/x86/include/cpufunc.h Sat Sep 7 11:09:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.h,v 1.34 2019/07/05 17:08:55 maxv Exp $ */
+/* $NetBSD: cpufunc.h,v 1.35 2019/09/07 11:09:03 maxv Exp $ */
/*
* Copyright (c) 1998, 2007, 2019 The NetBSD Foundation, Inc.
@@ -271,7 +271,7 @@ union savefpu;
static inline void
fninit(void)
{
- __asm volatile ("fninit");
+ __asm volatile ("fninit" ::: "memory");
}
static inline void
@@ -303,7 +303,7 @@ fnstsw(uint16_t *val)
static inline void
clts(void)
{
- __asm volatile ("clts");
+ __asm volatile ("clts" ::: "memory");
}
void stts(void);
@@ -433,6 +433,7 @@ wrmsr(u_int msr, uint64_t val)
"wrmsr"
:
: "a" (low), "d" (high), "c" (msr)
+ : "memory"
);
}