Module Name: src
Committed By: mlelstv
Date: Tue May 21 05:29:21 UTC 2019
Modified Files:
src/usr.sbin/cpuctl/arch: cpuctl_i386.h i386-asm.S i386.c x86_64-asm.S
Log Message:
All MSRs can only be read at privilege level 0. The exact APIC ID cannot
be determined on some AMD CPUs.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/cpuctl/arch/cpuctl_i386.h
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/cpuctl/arch/i386-asm.S \
src/usr.sbin/cpuctl/arch/x86_64-asm.S
cvs rdiff -u -r1.98 -r1.99 src/usr.sbin/cpuctl/arch/i386.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/cpuctl/arch/cpuctl_i386.h
diff -u src/usr.sbin/cpuctl/arch/cpuctl_i386.h:1.3 src/usr.sbin/cpuctl/arch/cpuctl_i386.h:1.4
--- src/usr.sbin/cpuctl/arch/cpuctl_i386.h:1.3 Fri May 10 16:42:57 2019
+++ src/usr.sbin/cpuctl/arch/cpuctl_i386.h Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuctl_i386.h,v 1.3 2019/05/10 16:42:57 mlelstv Exp $ */
+/* $NetBSD: cpuctl_i386.h,v 1.4 2019/05/21 05:29:21 mlelstv Exp $ */
/* Interfaces to code in i386-asm.S */
@@ -7,4 +7,3 @@
void x86_cpuid2(uint32_t, uint32_t, uint32_t *);
uint32_t x86_identify(void);
uint32_t x86_xgetbv(void);
-uint64_t rdmsr(u_int);
Index: src/usr.sbin/cpuctl/arch/i386-asm.S
diff -u src/usr.sbin/cpuctl/arch/i386-asm.S:1.6 src/usr.sbin/cpuctl/arch/i386-asm.S:1.7
--- src/usr.sbin/cpuctl/arch/i386-asm.S:1.6 Sat May 11 12:24:42 2019
+++ src/usr.sbin/cpuctl/arch/i386-asm.S Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: i386-asm.S,v 1.6 2019/05/11 12:24:42 mlelstv Exp $ */
+/* $NetBSD: i386-asm.S,v 1.7 2019/05/21 05:29:21 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc.
@@ -164,11 +164,3 @@ is486dlc:
movl $CPU_486DLC,%eax
ret
-ENTRY(rdmsr)
- movl 4(%esp), %ecx
- pushl %edi
- movl $OPTERON_MSR_PASSCODE, %edi
- rdmsr
- popl %edi
- ret
-END(rdmsr)
Index: src/usr.sbin/cpuctl/arch/x86_64-asm.S
diff -u src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.6 src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.7
--- src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.6 Fri May 10 16:42:57 2019
+++ src/usr.sbin/cpuctl/arch/x86_64-asm.S Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_64-asm.S,v 1.6 2019/05/10 16:42:57 mlelstv Exp $ */
+/* $NetBSD: x86_64-asm.S,v 1.7 2019/05/21 05:29:21 mlelstv Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -55,11 +55,3 @@ ENTRY(x86_identify)
movl $-1,%eax
ret
-ENTRY(rdmsr)
- movq %rdi, %rcx
- xorq %rax, %rax
- movl $OPTERON_MSR_PASSCODE, %edi
- rdmsr
- shlq $32, %rdx
- orq %rdx, %rax
- ret
Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.98 src/usr.sbin/cpuctl/arch/i386.c:1.99
--- src/usr.sbin/cpuctl/arch/i386.c:1.98 Sat May 11 17:21:07 2019
+++ src/usr.sbin/cpuctl/arch/i386.c Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: i386.c,v 1.98 2019/05/11 17:21:07 kre Exp $ */
+/* $NetBSD: i386.c,v 1.99 2019/05/21 05:29:21 mlelstv Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.98 2019/05/11 17:21:07 kre Exp $");
+__RCSID("$NetBSD: i386.c,v 1.99 2019/05/21 05:29:21 mlelstv Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -1959,6 +1959,7 @@ identifycpu_cpuids_amd(struct cpu_info *
if (core_bits == 0)
core_bits = ilog2(core_max - 1) + 1;
+#if 0 /* MSRs need kernel mode */
if (cpu_family < 0x11) {
const uint64_t reg = rdmsr(MSR_NB_CFG);
if ((reg & NB_CFG_INITAPICCPUIDLO) == 0) {
@@ -1968,6 +1969,7 @@ identifycpu_cpuids_amd(struct cpu_info *
(apic_id >> 5) | (node_id << 2);
}
}
+#endif
if (cpu_family == 0x17) {
x86_cpuid(0x8000001e, descs);