Model-specific register

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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[edit]

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[edit]

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[edit]

  1. ^ [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[edit]