rdmsr(9) - NetBSD Manual Pages

RDMSR(9)             NetBSD/x86 Kernel Developer's Manual             RDMSR(9)


NAME
msr, rdmsr, rdmsr_safe, wrmsr -- functions for x86 MSRs
SYNOPSIS
#include <x86/cpufunc.h> uint64_t rdmsr(u_int msr); int rdmsr_safe(u_int msr, uint64_t *valp); void wrmsr(u_int msr, uint64_t val);
DESCRIPTION
The RDMSR instruction reads from a x86 model-specific register (MSR). Conversely, the WRMSR instruction is used to write to a MSR. In NetBSD the rdmsr(), rdmsr_safe(), and wrmsr() functions are used to access MSRs. The header <x86/specialreg.h> includes definitions for some of the com- monly used MSRs, that is, control registers that are present in some x86 processor models but unavailable in others.
FUNCTIONS
rdmsr(msr) Returns the value read from msr. rdmsr_safe(msr, valp) The rdmsr_safe() function is a safer variant of rdmsr(). Upon suc- cessful completion, the function returns zero and the value read from the register msr is returned in valp. If a fault occurs while accessing msr, rdmsr_safe() returns EFAULT. wrmsr(msr, val) The wrmsr() function writes val to the register msr. Note that even though rdmsr_safe() provides support for reading 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 CPUID instruction, avail- able in NetBSD via x86_cpuid().
SEE ALSO
rdtsc(9), x86_msr_xcall(9) NetBSD 6.1.5 October 28, 2011 NetBSD 6.1.5

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.