Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/include Add a memory barrier on wrmsr, because ...



details:   https://anonhg.NetBSD.org/src/rev/1da6ada4016b
branches:  trunk
changeset: 454156:1da6ada4016b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Sep 07 11:09:03 2019 +0000

description:
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.

diffstat:

 sys/arch/x86/include/cpufunc.h |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 5142f06bfa0d -r 1da6ada4016b sys/arch/x86/include/cpufunc.h
--- a/sys/arch/x86/include/cpufunc.h    Sat Sep 07 10:24:01 2019 +0000
+++ b/sys/arch/x86/include/cpufunc.h    Sat Sep 07 11:09:03 2019 +0000
@@ -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 @@
 static inline void
 fninit(void)
 {
-       __asm volatile ("fninit");
+       __asm volatile ("fninit" ::: "memory");
 }
 
 static inline void
@@ -303,7 +303,7 @@
 static inline void
 clts(void)
 {
-       __asm volatile ("clts");
+       __asm volatile ("clts" ::: "memory");
 }
 
 void   stts(void);
@@ -433,6 +433,7 @@
                "wrmsr"
                :
                : "a" (low), "d" (high), "c" (msr)
+               : "memory"
        );
 }
 



Home | Main Index | Thread Index | Old Index