Instruction
RDMSR
Reads a model-specific register into EDX:EAX, or with MSR_IMM into any 64-bit register from an MSR number given as an immediate; allowed only in ring 0.
RDMSR reads the model-specific register whose number is in ECX into EDX:EAX, the high half in EDX. In 64-bit mode bits 63:32 of RCX are ignored and those of RAX and RDX cleared, so a 64-bit value takes a shift and an OR to assemble, as with RDTSC. MSRs hold the processor’s configuration and its counters: EFER (C0000080H) with the long-mode and SYSCALL enables, the SYSCALL targets, the FS and GS bases, the time stamp counter (10H) and many more. Both vendors share some numbers and differ on many: Intel’s MSRs are listed in its manual’s Volume 4, AMD’s in its Volume 2 and in the documentation of each processor family.
Privileged, and strict about numbers
RDMSR runs only at CPL 0 (or in real mode); elsewhere it raises #GP(0). Zen 5 recorded that at CPL 3 for EFER and for the time stamp counter, with RAX and RDX left alone. At CPL 0 a number the processor does not implement raises #GP(0) too, rather than reading 0, so code that reads an MSR it is not sure of has to be ready for the fault. Bits that an MSR does not implement read as undefined, both manuals say.
Order
RDMSR is not serializing. Intel’s manual warns that a sequence of RDMSRs may read their MSRs in another order than the program’s, and offers IA32_BARRIER (2FH) to order the reads of RDMSRLIST, which reads up to 64 MSRs from a table in one instruction.
Other forms and kin
- With MSR_IMM, a VEX form (and an APX one) takes the number as a 32-bit immediate and writes all 64 bits to one register; Intel’s manual says it may be faster. No processor at hand has it.
- URDMSR reads, at any CPL, the MSRs that the OS marks in a bitmap given by IA32_USER_MSR_CTL.
- RDPMC and RDTSC read counters that are also MSRs, without needing CPL 0 where the OS allows.
Under a hypervisor, RDMSR may leave the guest: Intel’s VMX checks an MSR bitmap and AMD’s SVM an MSR permissions map, both set by the hypervisor, to decide which reads exit. WRMSR is the write. AMD’s Zen 5 guide lists RDMSR as microcoded.
Vulnerability mitigations
Mitigations of these processor vulnerabilities use RDMSR:
- CVE-2022-21233: Stale Data Read from Legacy xAPIC
- CVE-2020-8695: RAPL Energy Reporting (RAPL energy reporting)
- CVE-2018-3640: Rogue System Register Read
- CVE-2017-5754: Meltdown (Rogue Data Cache Load)
Forms
| Instruction | Encoding | Requires |
|---|---|---|
RDMSR
RDMSR | 0F 32 | Base instruction set |
RDMSR r64, imm32 64-bit mode only
RDMSR_GPR64u64_IMM32 | VEX.LZ.F2.MAP7.WIG F6 /0 id | MSR_IMM |
RDMSR r64, imm32
RDMSR_GPR64u64_IMM32_APX | EVEX.LLZ.F2.MAP7.WIG F6 /0 id | APX_F + MSR_IMM |
Latency and throughput
| Model | RDMSR |
|---|---|
| Sandy Bridge | 100 / 0.33p015 |
| Haswell, Broadwell, Skylake, Skylake-SP, Ice Lake | 100 / 0.25p0156 |
| Alder Lake, Sapphire Rapids | 100 / 13.25p0 p1 p5 p6 p11 |
| Lunar Lake | 100 / 0.17p012345 |
| Bonnell | 78 / 39p01 |
| Silvermont | 100 / 1FPC0 |
| Piledriver | 100 / 0.5EX0 EX1 |
| Zen, Zen 2 | 100 / 0.25 |
| Zen 3, Zen 4 | 100 / 25ALU0 ALU1 ALU2 ALU3 |
| Jaguar | 100 / 0.5ALU0 ALU1 |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
if CPL > 0:
fault(GP, 0)
n = ecx # bits 63:32 of RCX do not count
if not msr_exists(n):
fault(GP, 0) # reserved or not implemented
v = msr[n]
eax = v # bits 63:32 of RAX and RDX cleared
edx = v >> 32
# bits that the MSR does not implement read as undefined, Intel's
# manual saysRun on AMD Zen 5 (EPYC 9645): 2 cases. Every one raised an exception, at CPL 3, where the probe runs.
if CPL > 0:
fault(GP, 0)
n = src.read() # imm32: the MSR's number
if not msr_exists(n):
fault(GP, 0)
dest.write(msr[n]) # all 64 bits
Not run on a processor: no processor at hand has MSR_IMM, the immediate forms of RDMSR and WRMSRNS.
Operands
| Operand | Kind | Action |
|---|---|---|
RDMSR | ||
EAX | implicit | write |
EDX | implicit | write |
ECX | implicit | read |
MSRs | implicit | read |
RDMSR r64, imm32 64-bit mode only | ||
r64 | explicit | write |
imm32 | explicit | read |
MSRs | implicit | read |
Flags
None: XED records no flag that the forms test or change.
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- Legacy forms
- none in XED
- VEX forms
MSR-IMM-VEX- EVEX forms
MSR-IMM-EVEX
Attributes
What else XED records about the forms. How to read.
- All forms
- privileged: CPL 0 only; may abort a TSX transaction
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
PENTIUMREAL | No CPUID bit: part of the base instruction set. | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
MSR_IMM | MSR_IMM | Clearwater Forest |
APX_F_MSR_IMM | APX_F + MSR_IMM | None in XED’s chip model, which lists these instructions only under its placeholder for future processors. |
More System instructions
- ARPL
- CLTS
- HLT
- INVD
- INVLPG
- LAR
- LGDT
- LIDT
- LLDT
- LMSW
- LSL
- LTR
- RDPMC
- RDTSC
- RSM
- SGDT
- SIDT
- SLDT
- SMSW
- STR
- SWAPGS
- VERR
- VERW
- WBINVD
- WRMSR
More MSR_IMM instructions
More APX instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s
-marchfeature sets and AMD’s Processor Programming References, which the page of each processor cites. - LLVM 23.1.2's x86 scheduling models (commit
85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-544 (RDMSR)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 2026)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
- AMD64 Architecture Programmer's Manual, Volume 2: System Programming (24593, rev. 3.46, October 2026)
- AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.39, October 2026)
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The timings come from LLVM's scheduling models, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.