Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/include x86_lfence() calls mcount(), so inlin...



details:   https://anonhg.NetBSD.org/src/rev/3fe02af76faf
branches:  trunk
changeset: 814838:3fe02af76faf
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Apr 11 14:15:30 2016 +0000

description:
x86_lfence() calls mcount(), so inline lfence instructions in mcount
helper functions

diffstat:

 sys/arch/amd64/include/profile.h |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 5fb1c30f5a3a -r 3fe02af76faf sys/arch/amd64/include/profile.h
--- a/sys/arch/amd64/include/profile.h  Mon Apr 11 14:14:27 2016 +0000
+++ b/sys/arch/amd64/include/profile.h  Mon Apr 11 14:15:30 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: profile.h,v 1.17 2016/01/10 09:04:32 ryo Exp $ */
+/*     $NetBSD: profile.h,v 1.18 2016/04/11 14:15:30 bouyer Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -83,8 +83,9 @@
 static inline void
 mcount_disable_intr(void)
 {
-       /* works because __cli is a macro */
-       __cli();
+       /* should be __cli() but this calls x86_lfence() which calls mcount */
+       curcpu()->ci_vcpu->evtchn_upcall_mask = 1;
+       __asm volatile("lfence" ::: "memory"); /* x86_lfence() */
 }
 
 static inline u_long
@@ -97,7 +98,8 @@
 mcount_write_psl(u_long psl)
 {
        curcpu()->ci_vcpu->evtchn_upcall_mask = psl;
-       x86_lfence();
+       /* can't call x86_lfence because it calls mcount() */
+       __asm volatile("lfence" ::: "memory"); /* x86_lfence() */
        /* XXX can't call hypervisor_force_callback() because we're in mcount*/ 
 }
 



Home | Main Index | Thread Index | Old Index