background image

37-6 Vol. 3D

INTRODUCTION TO INTEL® SOFTWARE GUARD EXTENSIONS

On processors that support Intel SGX1 and SGX2, CPUID leaf 12H sub-leaf 2 report physical memory resources 
available for use with Intel SGX. These physical memory sections are typically allocated by BIOS as Processor 
Reserved Memory
, and available to the OS to manage as EPC. 
To enumerate how many EPC sections are available to the EPC manager, software can enumerate CPUID leaf 12H 
with sub-leaf index starting from 2, and decode the sub-leaf-type encoding (returned in EAX[3:0]) until the sub-
leaf type is invalid. All invalid sub-leaves of CPUID leaf 12H return EAX/EBX/ECX/EDX with 0.

ECX

31:0

Report the valid bits of SECS.ATTRIBUTES[95:64] that software can set with ECREATE. 

SECS.ATTRIBUTES[n+64] can be set to 1 using ECREATE only if ECX[n] is 1, where n < 32.

EDX

31:0

Report the valid bits of SECS.ATTRIBUTES[127:96] that software can set with ECREATE. 

SECS.ATTRIBUTES[n+96] can be set to 1 using ECREATE only if EDX[n] is 1, where n < 32.

Table 37-6.  CPUID Leaf 12H, Sub-Leaf Index 2 or Higher Enumeration of Intel® SGX Resources

CPUID.(EAX=12H,ECX > 1)

Description Behavior

Register

Bits

EAX

3:0

0000b: This sub-leaf is invalid; EDX:ECX:EBX:EAX return 0.
0001b: This sub-leaf enumerates an EPC section. EBX:EAX and EDX:ECX provide information on the 

Enclave Page Cache (EPC) section.
All other encoding are reserved.

11:4

Reserved (enumerate 0).

31:12

If EAX[3:0] = 0001b, these are bits 31:12 of the physical address of the base of the EPC section.

EBX

19:0

If EAX[3:0] = 0001b, these are bits 51:32 of the physical address of the base of the EPC section.

31:20

Reserved.

ECX

3: 0

If EAX[3:0] 0000b, then all bits of the EDX:ECX pair are enumerated as 0.
If EAX[3:0] 0001b, then this section has confidentiality and integrity protection.
All other encoding are reserved.

11:4

Reserved (enumerate 0).

31:12

If EAX[3:0] = 0001b, these are bits 31:12 of the size of the corresponding EPC section within the 

Processor Reserved Memory.

EDX

19: 0

If EAX[3:0] = 0001b, these are bits 51:32 of the size of the corresponding EPC section within the 

Processor Reserved Memory.

31:20

Reserved.

Table 37-5.  CPUID Leaf 12H, Sub-Leaf 1 Enumeration of Intel® SGX Capabilities

CPUID.(EAX=12H,ECX=1)

Description Behavior

Register

Bits