Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2018 05:45:47 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r340606 - stable/12/sys/amd64/amd64
Message-ID:  <201811190545.wAJ5jlfj001047@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Nov 19 05:45:47 2018
New Revision: 340606
URL: https://svnweb.freebsd.org/changeset/base/340606

Log:
  MFC r339895:
  amd64: Use ifuncs to select suitable implementation of set_pcb_flags().

Modified:
  stable/12/sys/amd64/amd64/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/12/sys/amd64/amd64/machdep.c	Mon Nov 19 05:43:41 2018	(r340605)
+++ stable/12/sys/amd64/amd64/machdep.c	Mon Nov 19 05:45:47 2018	(r340606)
@@ -2628,15 +2628,14 @@ set_pcb_flags_raw(struct pcb *pcb, const u_int flags)
  * the PCB_FULL_IRET flag is set.  We disable interrupts to sync with
  * context switches.
  */
-void
-set_pcb_flags(struct pcb *pcb, const u_int flags)
+static void
+set_pcb_flags_fsgsbase(struct pcb *pcb, const u_int flags)
 {
 	register_t r;
 
 	if (curpcb == pcb &&
 	    (flags & PCB_FULL_IRET) != 0 &&
-	    (pcb->pcb_flags & PCB_FULL_IRET) == 0 &&
-	    (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0) {
+	    (pcb->pcb_flags & PCB_FULL_IRET) == 0) {
 		r = intr_disable();
 		if ((pcb->pcb_flags & PCB_FULL_IRET) == 0) {
 			if (rfs() == _ufssel)
@@ -2649,6 +2648,13 @@ set_pcb_flags(struct pcb *pcb, const u_int flags)
 	} else {
 		set_pcb_flags_raw(pcb, flags);
 	}
+}
+
+DEFINE_IFUNC(, void, set_pcb_flags, (struct pcb *, const u_int), static)
+{
+
+	return ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0 ?
+	    set_pcb_flags_fsgsbase : set_pcb_flags_raw);
 }
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811190545.wAJ5jlfj001047>