libcpuid
Data Fields
cpu_sgx_t Struct Reference

This contains information about SGX features of the processor Example usage: More...

#include <libcpuid.h>

Data Fields

uint32_t present
 
uint8_t max_enclave_32bit
 
uint8_t max_enclave_64bit
 
uint8_t flags [SGX_FLAGS_MAX]
 
int num_epc_sections
 
uint32_t misc_select
 
uint64_t secs_attributes
 
uint64_t secs_xfrm
 

Detailed Description

This contains information about SGX features of the processor Example usage:

...
struct cpu_raw_data_t raw;
struct cpu_id_t id;
if (cpuid_get_raw_data(&raw) == 0 && cpu_identify(&raw, &id) == 0 && id.sgx.present) {
printf("SGX is present.\n");
printf("SGX1 instructions: %s.\n", id.sgx.flags[INTEL_SGX1] ? "present" : "absent");
printf("SGX2 instructions: %s.\n", id.sgx.flags[INTEL_SGX2] ? "present" : "absent");
printf("Max 32-bit enclave size: 2^%d bytes.\n", id.sgx.max_enclave_32bit);
printf("Max 64-bit enclave size: 2^%d bytes.\n", id.sgx.max_enclave_64bit);
for (int i = 0; i < id.sgx.num_epc_sections; i++) {
struct cpu_epc_t epc = cpuid_get_epc(i, NULL);
printf("EPC section #%d: address = %x, size = %d bytes.\n", epc.address, epc.size);
}
} else {
printf("SGX is not present.\n");
}
int cpu_identify(struct cpu_raw_data_t *raw, struct cpu_id_t *data)
Identifies the CPU.
int cpuid_get_raw_data(struct cpu_raw_data_t *data)
Obtains the raw CPUID data from the current CPU.
struct cpu_epc_t cpuid_get_epc(int index, const struct cpu_raw_data_t *raw)
Fetches information about an EPC (Enclave Page Cache) area.
@ INTEL_SGX1
Definition: libcpuid.h:1181
@ INTEL_SGX2
Definition: libcpuid.h:1182
The return value of cpuid_get_epc().
Definition: libcpuid.h:1698
This contains the recognized CPU features/info.
Definition: libcpuid.h:529
struct cpu_sgx_t sgx
Definition: libcpuid.h:751
Contains just the raw CPUID data.
Definition: libcpuid.h:288
uint8_t max_enclave_32bit
Definition: libcpuid.h:442
uint8_t flags[SGX_FLAGS_MAX]
Definition: libcpuid.h:453
uint8_t max_enclave_64bit
Definition: libcpuid.h:447
uint32_t present
Definition: libcpuid.h:437

Field Documentation

◆ flags

uint8_t cpu_sgx_t::flags[SGX_FLAGS_MAX]

contains SGX feature flags. See the INTEL_SGX* macros below.

◆ max_enclave_32bit

uint8_t cpu_sgx_t::max_enclave_32bit

Max enclave size in 32-bit mode. This is a power-of-two value: if it is "31", then the max enclave size is 2^31 bytes (2 GiB).

◆ max_enclave_64bit

uint8_t cpu_sgx_t::max_enclave_64bit

Max enclave size in 64-bit mode. This is a power-of-two value: if it is "36", then the max enclave size is 2^36 bytes (64 GiB).

◆ misc_select

uint32_t cpu_sgx_t::misc_select

bit vector of the supported extended features that can be written to the MISC region of the SSA (Save State Area)

◆ num_epc_sections

int cpu_sgx_t::num_epc_sections

number of Enclave Page Cache (EPC) sections. Info for each section is available through the cpuid_get_epc() function

◆ present

uint32_t cpu_sgx_t::present

Whether SGX is present (boolean)

◆ secs_attributes

uint64_t cpu_sgx_t::secs_attributes

a bit vector of the attributes that can be set to SECS.ATTRIBUTES via ECREATE. Corresponds to bits 0-63 (incl.) of SECS.ATTRIBUTES.

◆ secs_xfrm

uint64_t cpu_sgx_t::secs_xfrm

a bit vector of the bits that can be set in the XSAVE feature request mask; Corresponds to bits 64-127 of SECS.ATTRIBUTES.


The documentation for this struct was generated from the following file: