Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/cpuctl/arch All MSRs can only be read at privilege ...
details: https://anonhg.NetBSD.org/src/rev/e1adeff1f9ad
branches: trunk
changeset: 999138:e1adeff1f9ad
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Tue May 21 05:29:21 2019 +0000
description:
All MSRs can only be read at privilege level 0. The exact APIC ID cannot
be determined on some AMD CPUs.
diffstat:
usr.sbin/cpuctl/arch/cpuctl_i386.h | 3 +--
usr.sbin/cpuctl/arch/i386-asm.S | 10 +---------
usr.sbin/cpuctl/arch/i386.c | 6 ++++--
usr.sbin/cpuctl/arch/x86_64-asm.S | 10 +---------
4 files changed, 7 insertions(+), 22 deletions(-)
diffs (90 lines):
diff -r 3373f783548f -r e1adeff1f9ad usr.sbin/cpuctl/arch/cpuctl_i386.h
--- a/usr.sbin/cpuctl/arch/cpuctl_i386.h Tue May 21 04:57:02 2019 +0000
+++ b/usr.sbin/cpuctl/arch/cpuctl_i386.h Tue May 21 05:29:21 2019 +0000
@@ -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);
diff -r 3373f783548f -r e1adeff1f9ad usr.sbin/cpuctl/arch/i386-asm.S
--- a/usr.sbin/cpuctl/arch/i386-asm.S Tue May 21 04:57:02 2019 +0000
+++ b/usr.sbin/cpuctl/arch/i386-asm.S Tue May 21 05:29:21 2019 +0000
@@ -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 @@
movl $CPU_486DLC,%eax
ret
-ENTRY(rdmsr)
- movl 4(%esp), %ecx
- pushl %edi
- movl $OPTERON_MSR_PASSCODE, %edi
- rdmsr
- popl %edi
- ret
-END(rdmsr)
diff -r 3373f783548f -r e1adeff1f9ad usr.sbin/cpuctl/arch/i386.c
--- a/usr.sbin/cpuctl/arch/i386.c Tue May 21 04:57:02 2019 +0000
+++ b/usr.sbin/cpuctl/arch/i386.c Tue May 21 05:29:21 2019 +0000
@@ -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 @@
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 @@
(apic_id >> 5) | (node_id << 2);
}
}
+#endif
if (cpu_family == 0x17) {
x86_cpuid(0x8000001e, descs);
diff -r 3373f783548f -r e1adeff1f9ad usr.sbin/cpuctl/arch/x86_64-asm.S
--- a/usr.sbin/cpuctl/arch/x86_64-asm.S Tue May 21 04:57:02 2019 +0000
+++ b/usr.sbin/cpuctl/arch/x86_64-asm.S Tue May 21 05:29:21 2019 +0000
@@ -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 @@
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
Home |
Main Index |
Thread Index |
Old Index