Extensions
Forms
1 (1 Legacy)
Data
Intel XED v2026.08.23

RDPKRU copies PKRU into EAX and clears EDX; as with other 32-bit writes, bits 63:32 of RAX and RDX become 0. ECX must be 0, or it raises #GP, and it raises #UD unless the kernel has set CR4.PKE. The register and how protection keys guard pages are described under WRPKRU; this page is about reading it.

Read before writing

WRPKRU replaces the rights of all 16 keys at once, so code that changes one key reads the register first, changes that key’s two bits and writes the result back. With -mpku, GCC 14 and Clang 23 at -O2 compile _rdpkru_u32() to xor ecx, ecx and RDPKRU, and a function that closes key k to writes to RDPKRU, two shifts of the key’s bit pair by 2k, a NOT, an AND and an OR, then zeroed ECX and EDX and WRPKRU. A guarded access saves the value RDPKRU returned and writes it back afterwards, which restores whatever rights the caller had rather than a fixed set.

Checking for keys

CPUID leaf 7, ECX bit 3 (PKU) says the processor has protection keys; bit 4 (OSPKE) says the kernel has set CR4.PKE, and only then do RDPKRU and WRPKRU run. AMD’s manual names the same bits. PKRU is also state component 9 of XSAVE, through which a kernel switches it between threads when XCR0 bit 9 is set (see XGETBV); that bit governs only XSAVE, not whether these instructions run (Intel’s manual, volume 1).

On Zen 5

The probe’s cases started from PKRU 55555554H, the value Linux 7.3 gives a new process, and from AAAAAAA8H, which closes keys 1 to 15 to writes alone: RDPKRU returned each in EAX with random bits 63:32 of RAX and RDX cleared and the flags unchanged, accepted ECX = 0 under random bits 63:32, and raised #GP for ECX = 1. AMD’s manual adds that the operand size does not matter. With an F3 prefix these bytes are CLUI on Intel’s processors with user interrupts. AMD’s Zen 5 guide lists RDPKRU as microcoded.

Forms

Every encoding of RDPKRU that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
RDPKRU RDPKRUNP 0F 01 EEPKU + OSPKU

Latency and throughput

What the scheduling models of LLVM 23.1.2 give for each form, not measurements: latency / reciprocal throughput in cycles, the ports under them. A row is a model, or models that agree; a dash, a form that its processors lack. Memory forms: latency from the address, ports without the load and store units. Which processors each model covers.
ModelRDPKRU
Skylake, Skylake-SP, Ice Lake100 / 0.25p0156
Alder Lake, Sapphire Rapids100 / 1p0 p1 p5 p6 p11
Zen 3, Zen 4100 / 25ALU0 ALU1 ALU2 ALU3

Operation

What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.

if ecx != 0:                         # bits 63:32 of RCX do not count
    fault(GP, 0)
eax = pkru                           # RAX and RDX: bits 63:32 cleared
edx = 0
# Intel's manual allows no 66, F2 or F3 prefix here: with F3 the
# bytes are CLUI on its processors with user interrupts

Run on AMD Zen 5 (EPYC 9645): 3 cases.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
RDPKRU
EDXimplicitwrite
EAXimplicitwrite
ECXimplicitread

Flags

None: XED records no flag that the forms test or change.

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.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.

More PKU instructions

Sources

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s -march feature sets and AMD’s Processor Programming References, which the page of each processor cites.
  3. LLVM 23.1.2's x86 scheduling models (commit 85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them.
  4. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-549 (RDPKRU)
  5. Linux kernel documentation: Memory Protection Keys
  6. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
  7. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.38, July 2026)
  8. Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
  9. Linux 7.3: arch/x86/mm/pkeys.c, lines 112-127 (init_pkru_value, the PKRU of a new process)

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.