Model-specific register
A model-specific register (MSR) is any of various control registers in the x86 system architecture 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" (TR6 and TR7) that enabled testing of the processor's translation lookaside buffer (TLB); a special variant of the MOV instruction allowed moving to and from the test registers.[1] Three additional test registers followed in the 80486 (TR3–TR5) that enabled testing of the processor's caches for code and data.[2] None of these five registers were implemented in the subsequent Pentium processor; the special variant of MOV generated an invalid opcode exception.[3][4]
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.[5]
Using MSRs
Reading and writing to these registers is handled by the rdmsr
and wrmsr
instructions, respectively. As these are privileged instructions, they can be executed only 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[6] 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).
See also
References
- ↑ 80386 PROGRAMMER'S REFERENCE MANUAL. Intel. 1986. http://www.bitsavers.org/components/intel/80386/230985-001_80386_Programmers_Reference_Manual_1986.pdf.
- ↑ i486 PROCESSOR PROGRAMMER'S REFERENCE MANUAL. Intel. 1990. http://www.bitsavers.org/components/intel/80486/i486_Processor_Programmers_Reference_Manual_1990.pdf.
- ↑ Pentium Processor User's Manual Volume 3: Architecture and Programming Manual. Intel. 1993. http://www.bitsavers.org/components/intel/pentium/1993_Intel_Pentium_Processor_Users_Manual_Volume_3.pdf.
- ↑ Alan Cruse. "Model-Specific Registers" (PPT). Lecture notes, Advanced Microcomputer Programming class, University of San Francisco, 2006. https://www.cs.usfca.edu/~cruse/cs630f06/lesson27.ppt.
- ↑ Intel 64 and IA-32 Architectures Software Developer's Manual Volume 4: Model-Specific Registers. Intel. May 2020. https://software.intel.com/content/www/us/en/develop/download/intel-64-and-ia-32-architectures-software-developers-manual-volume-4-model-specific-registers.html.
- ↑ msr-tools at 01.org
External links
Original source: https://en.wikipedia.org/wiki/Model-specific register.
Read more |