Instruction
RDPKRU
Reads PKRU, the access- and write-disable bits of the 16 protection keys, into EAX; ECX must be zero.
- 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
| Instruction | Encoding | Requires |
|---|---|---|
RDPKRU
RDPKRU | NP 0F 01 EE | PKU + OSPKU |
Latency and throughput
| Model | RDPKRU |
|---|---|
| Skylake, Skylake-SP, Ice Lake | 100 / 0.25p0156 |
| Alder Lake, Sapphire Rapids | 100 / 1p0 p1 p5 p6 p11 |
| Zen 3, Zen 4 | 100 / 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 interruptsRun on AMD Zen 5 (EPYC 9645): 3 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
RDPKRU | ||
EDX | implicit | write |
EAX | implicit | write |
ECX | implicit | read |
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.
| ISA set | CPUID | Processors |
|---|---|---|
PKU | PKU + OSPKU | Comet Lake, Cannon Lake, Ice Lake (client), Tiger Lake, Alder Lake, Arrow Lake, Panther Lake, Nova Lake, Skylake-SP, Cascade Lake, Cooper Lake, Ice Lake (server), Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Sierra Forest, Clearwater Forest, Zen 3, Zen 4, Zen 5, Zen 6 |
More PKU 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-549 (RDPKRU)
- Linux kernel documentation: Memory Protection Keys
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.38, July 2026)
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
- 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.