WRPKRU
Write Data to User Page Key Register
stableVMJITAOTinstruction
Encodings
| Opcode | Instruction | Op/En | 64-bit | Compat/Legacy | Description |
|---|---|---|---|---|---|
NP 0F 01 EF | WRPKRU | ZO | Valid | Valid | Writes EAX into PKRU. |
Measured cost
Loading measurements from arch-data...
Description
Writes the value of EAX into PKRU. ECX and EDX must be 0 when WRPKRU is executed; otherwise, a generalprotection exception (#GP) occurs.
WRPKRU can be executed only if CR4.PKE = 1; otherwise, an invalid-opcode exception (#UD) occurs. Software can discover the value of CR4.PKE by examining CPUID.07H.00H:ECX.OSPKE[4].
On processors that support the Intel 64 Architecture, the high-order 32-bits of RCX, RDX, and RAX are ignored.
WRPKRU will never execute speculatively. Memory accesses affected by PKRU register will not execute (even speculatively) until all prior executions of WRPKRU have completed execution and updated the PKRU register.
Operation
IF (ECX = 0 AND EDX = 0)
THEN PKRU := EAX;
ELSE #GP(0);
FI;Flags affected
None.
C/C++ Compiler Intrinsic Equivalent WRPKRU void _wrpkru(uint32_t);
Exceptions
Protected mode
#GP(0) | If ECX 0. If EDX 0. |
#UD | If the LOCK prefix is used. If CR4.PKE = 0. |
Real address mode
| Same exceptions as in protected mode. |
Virtual-8086 mode
| Same exceptions as in protected mode. |
Compatibility mode
| Same exceptions as in protected mode. |
64-bit mode
| Same exceptions as in protected mode. |