Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Mar 2019 14:35:15 +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: r345413 - in stable/12/sys: amd64/amd64 i386/i386
Message-ID:  <201903221435.x2MEZFqa060537@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Mar 22 14:35:15 2019
New Revision: 345413
URL: https://svnweb.freebsd.org/changeset/base/345413

Log:
  MFC r345190:
  Provide deterministic (and somewhat useful) value for RDPID result,
  and for %ecx after RDTSCP.

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

Modified: stable/12/sys/amd64/amd64/initcpu.c
==============================================================================
--- stable/12/sys/amd64/amd64/initcpu.c	Fri Mar 22 11:46:35 2019	(r345412)
+++ stable/12/sys/amd64/amd64/initcpu.c	Fri Mar 22 14:35:15 2019	(r345413)
@@ -265,6 +265,10 @@ initializecpu(void)
 		init_via();
 		break;
 	}
+
+	if ((amd_feature & AMDID_RDTSCP) != 0 ||
+	    (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
+		wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
 }
 
 void

Modified: stable/12/sys/i386/i386/initcpu.c
==============================================================================
--- stable/12/sys/i386/i386/initcpu.c	Fri Mar 22 11:46:35 2019	(r345412)
+++ stable/12/sys/i386/i386/initcpu.c	Fri Mar 22 14:35:15 2019	(r345413)
@@ -754,6 +754,9 @@ initializecpu(void)
 		elf32_nxstack = 1;
 	}
 #endif
+	if ((amd_feature & AMDID_RDTSCP) != 0 ||
+	    (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
+		wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
 }
 
 void



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