arch/x86/include/asm/sgx.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/sgx.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/sgx.h- Extension
.h- Size
- 13487 bytes
- Lines
- 431
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bits.hlinux/types.h
Detected Declarations
struct sgx_secsstruct sgx_tcsstruct sgx_pageinfostruct sgx_secinfostruct sgx_pcmdstruct sgx_sigstruct_headerstruct sgx_sigstruct_bodystruct sgx_sigstructenum sgx_encls_functionenum sgx_return_codeenum sgx_miscselectenum sgx_attributeenum sgx_tcs_flagsenum sgx_page_typeenum sgx_secinfo_flags
Annotated Snippet
struct sgx_secs {
u64 size;
u64 base;
u32 ssa_frame_size;
u32 miscselect;
u8 reserved1[24];
u64 attributes;
u64 xfrm;
u32 mrenclave[8];
u8 reserved2[32];
u32 mrsigner[8];
u8 reserved3[32];
u32 config_id[16];
u16 isv_prod_id;
u16 isv_svn;
u16 config_svn;
u8 reserved4[3834];
} __packed;
/**
* enum sgx_tcs_flags - execution flags for TCS
* @SGX_TCS_DBGOPTIN: If enabled allows single-stepping and breakpoints
* inside an enclave. It is cleared by EADD but can
* be set later with EDBGWR.
*/
enum sgx_tcs_flags {
SGX_TCS_DBGOPTIN = 0x01,
};
#define SGX_TCS_RESERVED_MASK GENMASK_ULL(63, 1)
#define SGX_TCS_RESERVED_SIZE 4024
/**
* struct sgx_tcs - Thread Control Structure (TCS)
* @state: used to mark an entered TCS
* @flags: execution flags (cleared by EADD)
* @ssa_offset: SSA stack offset relative to the enclave base
* @ssa_index: the current SSA frame index (cleard by EADD)
* @nr_ssa_frames: the number of frame in the SSA stack
* @entry_offset: entry point offset relative to the enclave base
* @exit_addr: address outside the enclave to exit on an exception or
* interrupt
* @fs_offset: offset relative to the enclave base to become FS
* segment inside the enclave
* @gs_offset: offset relative to the enclave base to become GS
* segment inside the enclave
* @fs_limit: size to become a new FS-limit (only 32-bit enclaves)
* @gs_limit: size to become a new GS-limit (only 32-bit enclaves)
*
* Thread Control Structure (TCS) is an enclave page visible in its address
* space that defines an entry point inside the enclave. A thread enters inside
* an enclave by supplying address of TCS to ENCLU(EENTER). A TCS can be entered
* by only one thread at a time.
*/
struct sgx_tcs {
u64 state;
u64 flags;
u64 ssa_offset;
u32 ssa_index;
u32 nr_ssa_frames;
u64 entry_offset;
u64 exit_addr;
u64 fs_offset;
u64 gs_offset;
u32 fs_limit;
u32 gs_limit;
u8 reserved[SGX_TCS_RESERVED_SIZE];
} __packed;
/**
* struct sgx_pageinfo - an enclave page descriptor
* @addr: address of the enclave page
* @contents: pointer to the page contents
* @metadata: pointer either to a SECINFO or PCMD instance
* @secs: address of the SECS page
*/
struct sgx_pageinfo {
u64 addr;
u64 contents;
u64 metadata;
u64 secs;
} __packed __aligned(32);
/**
* enum sgx_page_type - bits in the SECINFO flags defining the page type
* @SGX_PAGE_TYPE_SECS: a SECS page
* @SGX_PAGE_TYPE_TCS: a TCS page
* @SGX_PAGE_TYPE_REG: a regular page
* @SGX_PAGE_TYPE_VA: a VA page
Annotation
- Immediate include surface: `linux/bits.h`, `linux/types.h`.
- Detected declarations: `struct sgx_secs`, `struct sgx_tcs`, `struct sgx_pageinfo`, `struct sgx_secinfo`, `struct sgx_pcmd`, `struct sgx_sigstruct_header`, `struct sgx_sigstruct_body`, `struct sgx_sigstruct`, `enum sgx_encls_function`, `enum sgx_return_code`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.