Instruction
URDMSR
Reads a model-specific register from user mode, if the operating system allows that register in its user-MSR bitmap.
URDMSR reads a 64-bit model-specific register into a general-purpose register at any privilege level, as RDMSR reads it at CPL 0, but only the MSRs that the operating system has opened to it. The kernel writes IA32_USER_MSR_CTL (MSR 1CH): bit 0 enables the instruction, and the rest gives the address of a 4-KiB bitmap. Its first 2 KiB hold one bit per MSR from 0 to 3FFFH, and URDMSR reads an MSR only where that bit is 1; a clear bit, a number above 3FFFH, or an MSR that RDMSR itself could not read raises #GP. The processor reads the bitmap as a supervisor access, whatever the CPL. With the enable bit clear, or without USER_MSR, CPUID.(EAX=07H,ECX=1):EDX[15], it raises #UD.
Two forms
Both exist only in 64-bit mode and write all 64 bits of the destination, where RDMSR splits the value into EDX:EAX. F2 0F38 F8 takes the MSR number in the register of ModRM.reg and writes the register of ModRM.rm; a VEX form in map 7 takes the number as a 32-bit immediate, like RDMSR’s MSR_IMM form, and APX adds EVEX forms for its new registers. The SDM’s list of #GP causes gives the bitmap’s range as 0 to 3FFH, where its description, and the #GP for any number with bits 63:14 set, give 0 to 3FFFH.
In our builds
GCC 14 and Clang 23 at -O2 with -musermsr compile _urdmsr(n) from
<x86gprintrin.h> to urdmsr rax, rdi, and _urdmsr(0x1b01) to the
immediate form, c4 e7 7b f8 c0 01 1b 00 00; both turn the option on
for -march=clearwaterforest. The register forms differ in their bytes,
though. GCC 14 and GNU as 2.44 encode urdmsr rax, rdi as F2 0F 38 F8
F8, with RDI, the number, in ModRM.reg, as the SDM and XED have it;
Clang 23 prints the same text but emits F2 0F 38 F8 C7, which GNU
objdump shows as urdmsr rdi, rax: by the SDM’s encoding, the number
comes from RAX and the result goes to RDI.
Not run here
The Zen 5 guest behind this site’s recorded cases reports 0 in CPUID.(EAX=07H,ECX=1):EDX, so the probe ran no form of URDMSR. AMD’s manuals do not describe the instruction.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
URDMSR r64, r64 64-bit mode only
URDMSR_GPR64u64_GPR64u64 | F2 0F 38 F8 /r | USER_MSR |
URDMSR r64, imm32 64-bit mode only
URDMSR_GPR64u64_IMM32 | VEX.LZ.F2.MAP7.W0 F8 /0 id | USER_MSR |
URDMSR r64, r64
URDMSR_GPR64u64_GPR64u64_APX | EVEX.LLZ.F2.MAP4.W0 F8 /r | APX_F + USER_MSR |
URDMSR r64, imm32
URDMSR_GPR64u64_IMM32_APX | EVEX.LLZ.F2.MAP7.W0 F8 /0 id | APX_F + USER_MSR |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
URDMSR r64, r64 64-bit mode onlyc = msr[0x1C] # IA32_USER_MSR_CTL
if not c & 1:
fault(UD) # the OS has not enabled them
n = src.read() # all 64 bits of the register
if n >> 14:
fault(GP, 0) # MSRs 0 to 3FFFH only
b = load((c & ~0xFFF) + n // 8, 8)
if not b >> n % 8 & 1: # the read bitmap: 2 KiB at the
fault(GP, 0) # page of USER_MSR_CTL[63:12],
# read as the kernel reads
if not msr_exists(n):
fault(GP, 0) # as RDMSR's checks
dest.write(msr[n]) # at any CPL
Not run on a processor: no processor at hand has USER_MSR.
URDMSR r64, imm32 64-bit mode onlyc = msr[0x1C] # IA32_USER_MSR_CTL
if not c & 1:
fault(UD) # the OS has not enabled them
n = src.read() # imm32: the MSR's number
if n >> 14:
fault(GP, 0) # MSRs 0 to 3FFFH only
b = load((c & ~0xFFF) + n // 8, 8)
if not b >> n % 8 & 1: # the read bitmap: 2 KiB at the
fault(GP, 0) # page of USER_MSR_CTL[63:12]
if not msr_exists(n):
fault(GP, 0)
dest.write(msr[n])Not run on a processor: no processor at hand has USER_MSR.
Operands
| Operand | Kind | Action |
|---|---|---|
URDMSR r64, r64 64-bit mode only | ||
r64 | explicit | write |
r64 | explicit | read |
MSRs | implicit | read |
URDMSR 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
USER-MSR-LEGACY- VEX forms
USER-MSR-VEX- EVEX forms
USER-MSR-EVEX
Attributes
What else XED records about the forms. How to read.
- All forms
- may abort a TSX transaction
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to URDMSR, each with the form it compiles to and the Clang options it needs. The forms come from compiling every intrinsic and decoding the result with Intel XED; all intrinsics A–Z explains the method.
| Intrinsic | Compiles to |
|---|---|
_urdmsr
unsigned long long _urdmsr(unsigned long long __A) |
|
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 |
|---|---|---|
USER_MSR | USER_MSR | Clearwater Forest |
APX_F_USER_MSR | APX_F + USER_MSR | None in XED’s chip model, which lists these instructions only under its placeholder for future processors. |
More USER_MSR 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. - Clang's x86 intrinsic headers, LLVM 23.1.2 (commit
85ac56026243): the intrinsics, their signatures and doc comments, and the Clang of that release, which compiled each of them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-760 (URDMSR)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
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 intrinsics and their signatures come from Clang, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.