HOME

TheInfoList



OR:

Memory type range registers (MTRRs) are a set of processor supplementary capability
control register A control register is a processor register which changes or controls the general behavior of a CPU or other digital device. Common tasks performed by control registers include interrupt control, switching the addressing mode, paging control, ...
s that provide
system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android and Microsoft Windows, computational science software, game engines, search engin ...
with control of how accesses to
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remember ...
ranges by the
CPU A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
are cached. It uses a set of programmable model-specific registers (MSRs) which are special registers provided by most modern CPUs. Possible access modes to memory ranges can be uncached,
write-through In computing, a cache ( ) is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhe ...
,
write-combining Write combining (WC) is a computer bus technique for allowing data to be combined and temporarily stored in a buffer the write combine buffer (WCB) to be released together later in burst mode instead of writing (immediately) as single bits or smal ...
, write-protect, and
write-back In computing, a cache ( ) is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhe ...
. In write-back mode, writes are written to the
CPU A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, a ...
's
cache Cache, caching, or caché may refer to: Places United States * Cache, Idaho, an unincorporated community * Cache, Illinois, an unincorporated community * Cache, Oklahoma, a city in Comanche County * Cache, Utah, Cache County, Utah * Cache County ...
and the cache is marked dirty, so that its contents are written to memory later. Write-combining allows
bus A bus (contracted from omnibus, with variants multibus, motorbus, autobus, etc.) is a road vehicle that carries significantly more passengers than an average car or van. It is most commonly used in public transport, but is also in use for cha ...
write transfers to be combined into a larger transfer before
bursting Bursting, or burst firing, is an extremely diverse general phenomenon of the activation patterns of neurons in the central nervous system and spinal cord where periods of rapid action potential spiking are followed by quiescent periods much longe ...
them over the bus to allow more efficient writes to system resources like
graphics card A graphics card (also called a video card, display card, graphics adapter, VGA card/VGA, video adapter, display adapter, or mistakenly GPU) is an expansion card which generates a feed of output images to a display device, such as a computer mo ...
memory. This often increases the speed of image write operations by several times, at the cost of losing the simple sequential read/write semantics of normal memory. Additional bits which are provided on some
computer architecture In computer engineering, computer architecture is a description of the structure of a computer system made from component parts. It can sometimes be a high-level description that ignores details of the implementation. At a more detailed level, the ...
s, such as
AMD64 x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging m ...
, allow the shadowing of ROM contents in system memory (shadow ROM), and the configuration of
memory-mapped I/O Memory-mapped I/O (MMIO) and port-mapped I/O (PMIO) are two complementary methods of performing input/output (I/O) between the central processing unit (CPU) and peripheral devices in a computer. An alternative approach is using dedicated I/O pr ...
.


MTRRs in x86-PC processors

In early
x86 architecture x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was int ...
systems, especially where the
cache Cache, caching, or caché may refer to: Places United States * Cache, Idaho, an unincorporated community * Cache, Illinois, an unincorporated community * Cache, Oklahoma, a city in Comanche County * Cache, Utah, Cache County, Utah * Cache County ...
was provided by separate chips outside of the CPU package, this function was controlled by the
chipset In a computer system, a chipset is a set of electronic components in one or more integrated circuits known as a "Data Flow Management System" that manages the data flow between the processor, memory and peripherals. It is usually found on the mo ...
itself and configured through
BIOS In computing, BIOS (, ; Basic Input/Output System, also known as the System BIOS, ROM BIOS, BIOS ROM or PC BIOS) is firmware used to provide runtime services for operating systems and programs and to perform hardware initialization during the b ...
settings. When the CPU cache was moved inside the CPU, the CPUs implemented ''fixed-range MTRRs'' which cover the first
megabyte The megabyte is a multiple of the unit byte for digital information. Its recommended unit symbol is MB. The unit prefix ''mega'' is a multiplier of (106) in the International System of Units (SI). Therefore, one megabyte is one million bytes o ...
of memory to be compatible to what PC-BIOSes provided at that time. These are used to control the cache policy needed for
VGA Video Graphics Array (VGA) is a video display controller and accompanying de facto graphics standard, first introduced with the IBM PS/2 line of computers in 1987, which became ubiquitous in the PC industry within three years. The term can now ...
accesses and all other memory-accesses done while the system is in
real mode Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory. Real mode is characterized by a 20- bit ...
. Above 1 MB, CPUs provide a number of ''variable-range MTRRs'', which can be freely placed and even overlap. These variable-range MTRRs can be used to set the caching policy of graphics memory and other memory ranges used by PCI devices. Starting with the Intel P6 family of processors (
Pentium Pro The Pentium Pro is a sixth-generation x86 microprocessor developed and manufactured by Intel and introduced on November 1, 1995. It introduced the P6 microarchitecture (sometimes termed i686) and was originally intended to replace the original ...
,
Pentium II The Pentium II brand refers to Intel's sixth-generation microarchitecture (" P6") and x86-compatible microprocessors introduced on May 7, 1997. Containing 7.5 million transistors (27.4 million in the case of the mobile Dixon with 256  K ...
and later), MTRRs may be used to control the processor access to memory ranges. The
Cyrix Cyrix Corporation was a microprocessor developer that was founded in 1988 in Richardson, Texas, as a specialist supplier of floating point units for 286 and 386 microprocessors. The company was founded by Tom Brightman and Jerry Rogers. In ...
6x86 The Cyrix 6x86 is a line of sixth-generation, 32-bit x86 microprocessors designed and released by Cyrix in 1995. Cyrix, being a fabless company, had the chips manufactured by IBM and SGS-Thomson. The 6x86 was made as a direct competitor to Int ...
, 6x86MX and
MII A Mii ( ) is a customizable avatar used on several Nintendo video game consoles and mobile apps. Miis were first introduced on the Wii console in 2006 and later appeared on the 3DS, Wii U, the Switch, and various apps for smart devices. Miis c ...
processors have Address Range Registers (ARRs) which provide a similar functionality to MTRRs. The AMD
K6-2 The K6-2 is an x86 microprocessor introduced by AMD on May 28, 1998, and available in speeds ranging from 266 to 550 MHz. An enhancement of the original K6, the K6-2 introduced AMD's 3DNow! SIMD instruction set, featured a larger 64 KiB ...
(stepping 8 and above) and K6-III processors have two MTRRs. The AMD
Athlon Athlon is the brand name applied to a series of x86-compatible microprocessors designed and manufactured by Advanced Micro Devices (AMD). The original Athlon (now called Athlon Classic) was the first seventh-generation x86 processor and the fi ...
family provide 8 Intel-style MTRRs. The
Centaur A centaur ( ; grc, κένταυρος, kéntauros; ), or occasionally hippocentaur, is a creature from Greek mythology with the upper body of a human and the lower body and legs of a horse. Centaurs are thought of in many Greek myths as bein ...
C6
WinChip The WinChip series was a low-power Socket 7-based x86 processor designed by Centaur Technology and marketed by its parent company IDT. Overview Design The design of the WinChip was quite different from other processors of the time. Instead of ...
has 8 MCRs, allowing write-combining. The
VIA Via or VIA may refer to the following: Science and technology * MOS Technology 6522, Versatile Interface Adapter * ''Via'' (moth), a genus of moths in the family Noctuidae * Via (electronics), a through-connection * VIA Technologies, a Taiwa ...
Cyrix III Cyrix III is an x86-compatible Socket 370 CPU. VIA Technologies launched the processor in February 2000. VIA had purchased both Centaur Technology and Cyrix. Cyrix III was to be based upon a core from one of the two companies. History The Cyrix ...
and
VIA C3 The VIA C3 is a family of x86 central processing units for personal computers designed by Centaur Technology and sold by VIA Technologies. The different CPU cores are built following the design methodology of Centaur Technology. In addition to ...
CPUs offer 8 Intel-style MTRRs. The memory interface of
AMD K8 The AMD K8 Hammer, also code-named SledgeHammer, is a computer processor microarchitecture designed by AMD as the successor to the AMD K7 Athlon microarchitecture. The K8 was the first implementation of the AMD64 64-bit extension to the x86 inst ...
CPUs supports "Extended fixed-range MTRR Type-Field Encodings" which allows one to specify whether accesses to certain address ranges are executed by accessing
RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater tropical fish People * Ram (given name) * Ram (surname) * Ram (director) (Ramsubramaniam), an Indian Tamil film director * RAM (musician) (born 1974), Dutch * ...
through the
Direct Connect Architecture HyperTransport (HT), formerly known as Lightning Data Transport, is a technology for interconnection of computer processors. It is a bidirectional serial/parallel high-bandwidth, low- latency point-to-point link that was introduced on April ...
or by executing
memory-mapped I/O Memory-mapped I/O (MMIO) and port-mapped I/O (PMIO) are two complementary methods of performing input/output (I/O) between the central processing unit (CPU) and peripheral devices in a computer. An alternative approach is using dedicated I/O pr ...
. This allows, for example,
shadow RAM Random-access memory (RAM; ) is a form of computer memory that can be read and changed in any order, typically used to store working data and machine code. A random-access memory device allows data items to be read or written in almost the s ...
to be implemented by copying ROM contents into RAM.


Successor

Newer x86 CPUs support a more advanced technique called
page attribute table The page attribute table (PAT) is a processor supplementary capability extension to the page table format of certain x86 and x86-64 microprocessors. Like memory type range registers (MTRRs), they allow for fine-grained control over how areas ...
s (PATs) that allow for per-page setting of these modes, instead of having a limited number of low-granularity registers to deal with modern memory sizes that can be as high as 64  GB even on a laptop, and several times that amount on a desktop system. Details on how MTRRs work are described in the processor manuals from CPU vendors.


See also

* Address-range register *
Page attribute table The page attribute table (PAT) is a processor supplementary capability extension to the page table format of certain x86 and x86-64 microprocessors. Like memory type range registers (MTRRs), they allow for fine-grained control over how areas ...
(PAT) * Write barrier


References

{{Reflist


External links


Speeding up graphics with MTRR
includes explanation
AMD64 Architecture Programmer's Manual Volume 2: System Programming
(
PDF Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
)
Intel 64 and IA-32 Architectures Software Developer's Manuals
See ''Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3A: System Programming Guide'' section 11.11 ''MEMORY TYPE RANGE REGISTERS (MTRRS)''

- it can set caching modes for VGA and LFB memory range to significantly boost performance of DOS graphics apps. On modern Core 2 Duo PC with PCI-E VGA it can be 10-times faster when write combining is set.
MTRR (Memory Type Range Register) control
by Richard Gooch Digital registers