Model-specific register

A model-specific register (MSR) is any of various control registers in the x86 instruction set used for debugging, program execution tracing, computer performance monitoring, and toggling certain CPU features.

History

With the introduction of the 80386 processor, Intel began introducing "experimental" features that would not necessarily be present in future versions of the processor. The first of these were two "test registers" (T6 and T7) that allowed the 80386 to speed up virtual-to-physical address conversions. Three additional test registers followed in the 80486 (TR3–TR5) that enabled testing of the processor's caches for code and data. None of these five registers were implemented in the subsequent Pentium processor.[1]

With the introduction of the Pentium processor, Intel provided a pair of instructions (rdmsr and wrmsr) to access current and future "model-specific registers", as well as the CPUID instruction to determine which features are present on a particular model. Many of these registers have proven useful enough to be retained. Intel has classified these as architectural model-specific registers and has committed to their inclusion in future product lines.[2]

Using MSRs

Reading and writing to these registers is handled by the rdmsr and wrmsr instructions, respectively. As these are privileged instructions they must be executed by the operating system. Use of the Linux msr kernel module creates a pseudo file "/dev/cpu/x/msr" (with a unique x for each processor or processor core). A user with permissions to read and/or write to this file can use the file I/O API to access these registers. The msr-tools[3] package provides a reference implementation.

Documentation regarding which MSRs a certain processor implementation supports is usually found in the processor documentation of the CPU vendor. Examples for rather well-known MSRs are the memory type range registers (MTRRs) and the address-range registers (ARRs).

References

  1. ↑ Alan Cruse, lecture notes, Advanced Microcomputer Programming class, University of San Francisco, 2006
  2. ↑ Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3: System Programming Guide, 325384-042US, Section 34.1, March, 2012.
  3. ↑ msr-tools at 01.org

External links

This article is issued from Wikipedia - version of the 9/11/2014. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.