Instruction
WRMSRNS
Writes a model-specific register like WRMSR but without serializing the processor; the MSR_IMM form takes the MSR number as an immediate.
WRMSRNS writes a model-specific register as WRMSR does, EDX:EAX into the MSR whose number is in ECX, with the same checks: CPL 0 or real mode, an MSR that exists, no reserved bit set and, for the MSRs that hold addresses, a canonical address, each failure raising #GP(0). What it drops is serialization. WRMSR waits for everything before it to finish and its buffered stores to reach memory before the next instruction starts; WRMSRNS does not. Intel’s manual still promises that instructions before it use the old value of the MSR and those after it the new one, and that an MSR whose write invalidates the TLBs, such as an MTRR, does so here too. Some processors may serialize anyway for certain MSRs, but nothing may rely on it.
Where it pays
Intel’s manual suggests WRMSRNS in place of WRMSR wherever the
serialization is not needed, for speed. Linux’s wrmsrns() helper uses
WRMSRNS where CPUID leaf 7, sub-leaf 1, reports it (EAX bit 19) and is
patched to an ordinary WRMSR elsewhere, written with a redundant DS
prefix so that both take 3 bytes. KVM, for one, uses it for MSRs that it
writes while a guest’s values are loaded. Code that relied on WRMSR to
serialize needs SERIALIZE instead, which Intel’s
manual suggests also ahead of a WRMSRNS that changes the controls of
performance-monitoring events that count stores only as they drain to
memory: without it, stores from before the write may be counted under
the new controls.
The immediate form
With MSR_IMM (CPUID leaf 7, sub-leaf 1, ECX bit 5), a VEX form in 64-bit mode takes the MSR number as a 32-bit immediate and the whole 64-bit value from one general-purpose register, so no ECX, EDX or EAX need setting up; APX adds an EVEX form that can name the new registers. It is the write that the immediate form of RDMSR pairs with. Outside 64-bit mode, or without the feature, the form raises #UD.
Not run here
The probe runs at CPL 3, and the Zen 5 guest it ran on reports neither WRMSRNS nor MSR_IMM, so it never ran either form; AMD’s manuals do not describe the instruction. GCC 14 and Clang 23 have no intrinsic for it, and their assemblers know the mnemonic, encoding it as 0F 01 C6.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
WRMSRNS
WRMSRNS | NP 0F 01 C6 | WRMSRNS |
WRMSRNS imm32, r64 64-bit mode only
WRMSRNS_IMM32_GPR64u64 | VEX.LZ.F3.MAP7.WIG F6 /0 id | MSR_IMM |
WRMSRNS imm32, r64
WRMSRNS_IMM32_GPR64u64_APX | EVEX.LLZ.F3.MAP7.WIG F6 /0 id | APX_F + MSR_IMM |
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, RAX and RDX do
v = edx << 32 | eax # not count
if not msr_allows(n, v):
fault(GP, 0) # as WRMSR's checks
msr[n] = v # not serializing, unlike WRMSR:
# what follows sees the new value,
# but stores before it may still
# be on their way to memory
Not run on a processor: the Zen 5 guest that ran the probe does not report WRMSRNS in CPUID.
if CPL > 0:
fault(GP, 0)
n = dest.read() # imm32: the MSR's number
v = src.read() # all 64 bits of the register
if not msr_allows(n, v):
fault(GP, 0)
msr[n] = v # not serializing
Not run on a processor: no processor at hand has MSR_IMM, the immediate forms of RDMSR and WRMSRNS.
Operands
| Operand | Kind | Action |
|---|---|---|
WRMSRNS | ||
EAX | implicit | read |
EDX | implicit | read |
ECX | implicit | read |
MSRs | implicit | write |
WRMSRNS imm32, r64 64-bit mode only | ||
imm32 | explicit | read |
r64 | explicit | read |
MSRs | implicit | write |
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 |
|---|---|---|
WRMSRNS | WRMSRNS | Panther Lake, Nova Lake, Diamond Rapids, Sierra Forest, Clearwater Forest |
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 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. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2D, page 6-12 (WRMSRNS)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
- Linux 7.3: arch/x86/include/asm/msr.h, lines 230-243 (wrmsrns(): WRMSRNS, or a WRMSR with a DS prefix where it is missing)
- Linux 7.3: arch/x86/kvm/vmx/ (KVM on Intel's VMX: vmenter.S, vmx_ops.h and vmx.c)
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 text is our own.