RDPKRU

Read Protection Key Rights for User Pages

stableVMJITAOTinstruction

Encodings

OpcodeInstructionOp/En64-bitCompat/LegacyDescription
NP 0F 01 EERDPKRUZOValidValidReads PKRU into EAX.

Measured cost

Loading measurements from arch-data...

Description

Reads the value of PKRU into EAX and clears EDX. ECX must be 0 when RDPKRU is executed; otherwise, a generalprotection exception (#GP) occurs.

RDPKRU 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 are ignored and the high-order 32-bits of RDX and RAX are cleared.

Operation

IF (ECX = 0)
    THEN
          EAX := PKRU;
          EDX := 0;
    ELSE #GP(0);

FI;

Flags affected

None.

C/C++ Compiler Intrinsic Equivalent RDPKRU uint32_t _rdpkru_u32(void);

Exceptions

Protected mode
#GP(0)If ECX 0.
#UDIf 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.

Sources