Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Briefly document the basic RDMSR/WRMSR functions.
details: https://anonhg.NetBSD.org/src/rev/98f05f2cd694
branches: trunk
changeset: 770602:98f05f2cd694
user: jruoho <jruoho%NetBSD.org@localhost>
date: Tue Oct 25 05:03:55 2011 +0000
description:
Briefly document the basic RDMSR/WRMSR functions.
diffstat:
distrib/sets/lists/comp/mi | 11 +++-
share/man/man9/man9.x86/Makefile | 7 +-
share/man/man9/man9.x86/rdmsr.9 | 112 +++++++++++++++++++++++++++++++++++++++
3 files changed, 127 insertions(+), 3 deletions(-)
diffs (191 lines):
diff -r bedf69c0af74 -r 98f05f2cd694 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Tue Oct 25 00:02:30 2011 +0000
+++ b/distrib/sets/lists/comp/mi Tue Oct 25 05:03:55 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1696 2011/10/24 07:33:26 yamt Exp $
+# $NetBSD: mi,v 1.1697 2011/10/25 05:03:55 jruoho Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -10857,11 +10857,14 @@
./usr/share/man/cat9/x86/nmi.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/nmi_disestablish.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/nmi_establish.0 comp-sys-catman .cat
+./usr/share/man/cat9/x86/rdmsr.0 comp-sys-catman .cat
+./usr/share/man/cat9/x86/rdmsr_safe.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/tsc.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/tsc_sync_ap.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/tsc_sync_bp.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/tsc_sync_drift.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/tsc_tc_init.0 comp-sys-catman .cat
+./usr/share/man/cat9/x86/wrmsr.0 comp-sys-catman .cat
./usr/share/man/cat9/x86/x86_msr_xcall.0 comp-sys-catman .cat
./usr/share/man/cat9/xc_broadcast.0 comp-sys-catman .cat
./usr/share/man/cat9/xc_unicast.0 comp-sys-catman .cat
@@ -16902,11 +16905,14 @@
./usr/share/man/html9/x86/nmi.html comp-sys-htmlman html
./usr/share/man/html9/x86/nmi_disestablish.html comp-sys-htmlman html
./usr/share/man/html9/x86/nmi_establish.html comp-sys-htmlman html
+./usr/share/man/html9/x86/rdmsr.html comp-sys-htmlman html
+./usr/share/man/html9/x86/rdmsr_safe.html comp-sys-htmlman html
./usr/share/man/html9/x86/tsc.html comp-sys-htmlman html
./usr/share/man/html9/x86/tsc_sync_ap.html comp-sys-htmlman html
./usr/share/man/html9/x86/tsc_sync_bp.html comp-sys-htmlman html
./usr/share/man/html9/x86/tsc_sync_drift.html comp-sys-htmlman html
./usr/share/man/html9/x86/tsc_tc_init.html comp-sys-htmlman html
+./usr/share/man/html9/x86/wrmsr.html comp-sys-htmlman html
./usr/share/man/html9/x86/x86_msr_xcall.html comp-sys-htmlman html
./usr/share/man/html9/xc_broadcast.html comp-sys-htmlman html
./usr/share/man/html9/xc_unicast.html comp-sys-htmlman html
@@ -23204,11 +23210,14 @@
./usr/share/man/man9/x86/nmi.9 comp-sys-man .man
./usr/share/man/man9/x86/nmi_disestablish.9 comp-sys-man .man
./usr/share/man/man9/x86/nmi_establish.9 comp-sys-man .man
+./usr/share/man/man9/x86/rdmsr.9 comp-sys-man .man
+./usr/share/man/man9/x86/rdmsr_safe.9 comp-sys-man .man
./usr/share/man/man9/x86/tsc.9 comp-sys-man .man
./usr/share/man/man9/x86/tsc_sync_ap.9 comp-sys-man .man
./usr/share/man/man9/x86/tsc_sync_bp.9 comp-sys-man .man
./usr/share/man/man9/x86/tsc_sync_drift.9 comp-sys-man .man
./usr/share/man/man9/x86/tsc_tc_init.9 comp-sys-man .man
+./usr/share/man/man9/x86/wrmsr.9 comp-sys-man .man
./usr/share/man/man9/x86/x86_msr_xcall.9 comp-sys-man .man
./usr/share/man/man9/xc_broadcast.9 comp-sys-man .man
./usr/share/man/man9/xc_unicast.9 comp-sys-man .man
diff -r bedf69c0af74 -r 98f05f2cd694 share/man/man9/man9.x86/Makefile
--- a/share/man/man9/man9.x86/Makefile Tue Oct 25 00:02:30 2011 +0000
+++ b/share/man/man9/man9.x86/Makefile Tue Oct 25 05:03:55 2011 +0000
@@ -1,12 +1,15 @@
-# $NetBSD: Makefile,v 1.3 2011/03/11 19:50:33 jruoho Exp $
+# $NetBSD: Makefile,v 1.4 2011/10/25 05:03:57 jruoho Exp $
-MAN= nmi.9 tsc.9 x86_msr_xcall.9
+MAN= nmi.9 rdmsr.9 tsc.9 x86_msr_xcall.9
MANSUBDIR=/x86
MLINKS+=nmi.9 nmi_establish.9 \
nmi.9 nmi_disestablish.9
+MLINKS+=rdmsr.9 rdmsr_safe.9 \
+ rdmsr.9 wrmsr.9
+
MLINKS+=tsc.9 tsc_tc_init.9 \
tsc.9 tsc_sync_ap.9 \
tsc.9 tsc_sync_bp.9 \
diff -r bedf69c0af74 -r 98f05f2cd694 share/man/man9/man9.x86/rdmsr.9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man9/man9.x86/rdmsr.9 Tue Oct 25 05:03:55 2011 +0000
@@ -0,0 +1,112 @@
+.\" $NetBSD: rdmsr.9,v 1.1 2011/10/25 05:03:57 jruoho Exp $
+.\"
+.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jukka Ruohonen.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd October 25, 2011
+.Dt RDMSR 9 x86
+.Os
+.Sh NAME
+.Nm rdmsr ,
+.Nm rdmsr_safe ,
+.Nm wrmsr
+.Nd functions for x86 model-specific registers
+.Sh SYNOPSIS
+.In x86/cpufunc.h
+.Ft uint64_t
+.Fn rdmsr "u_int msr"
+.\" .Ft uint64_t
+.\" .Fn rdmsr_locked "u_int msr"
+.Ft int
+.Fn rdmsr_safe "u_int msr" "uint64_t *valp"
+.Ft void
+.Fn wrmsr "u_int msr" "uint64_t val"
+.\" .Ft void
+.\" .Fn wrmsr_locked "u_int msr" "u_int" "uint64_t val"
+.Sh DESCRIPTION
+The
+.Dv RDMSR
+instruction reads from a x86 model-specific register
+.Pq Dv MSR .
+Conversely, the
+.Dv WRMSR
+instruction is used to write to a
+.Dv MSR .
+In
+.Nx
+the
+.Fn rdmsr ,
+.Fn rdmsr_safe ,
+and
+.Fn wrmsr
+functions are used to access
+.Dv MSRs .
+.Sh FUNCTIONS
+.Bl -tag -width abcd
+.It Fn rdmsr "msr"
+Returns the value read from
+.Fa msr .
+.\" .It Fn rdmsr_locked "msr"
+.It Fn rdmsr_safe "msr" "valp"
+The
+.Fn rdmsr_safe
+function is a safer variant of
+.Fn rdmsr .
+Upon successful completion,
+the function returns zero and the value read from the register
+.Fa msr
+is returned in
+.Fa valp .
+If a fault occurs while accessing
+.Fa msr ,
+.Fn rdmsr_safe
+returns
+.Dv EFAULT .
+.It Fn wrmsr "msr" "val"
+The
+.Fn wrmsr
+function writes
+.Fa val
+to the register
+.Fa msr .
+.\" .It Fn wrmsr_locked "msr" "xxx" "val"
+.El
+.Pp
+Note that even though
+.Fn rdmsr_safe
+provides support for reading
+.Dv MSRs
+in a safe manner, it is still a good practice
+to always verify that the given model-specific register
+is present by using the
+.Dv CPUID
+instruction, available in
+.Nx
+via
+.Fn x86_cpuid .
+.Sh SEE ALSO
+.Xr x86_msr_xcall 9
Home |
Main Index |
Thread Index |
Old Index