STRUCT SGX_TCS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

okay so we’re in the Kernel API Manual, and this page is struct sgx_tcs(9) β€” aka Thread Control Structure (TCS) πŸ’–. It’s giving β€œenclave entry-point documentation but make it cute,” and we are keeping every single deet, no cap.

🌸 SYNOPSIS 🌸

       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];
        };

slay, that’s the whole struct β€” no missing fields, fr fr 🧚.

πŸŽ€ Members πŸŽ€

  • state β€” used to mark an entered TCS.
  • flags β€” execution flags, and they are cleared by EADD. EADD said β€œnot today,” periodt. πŸ’…
  • ssa_offset β€” SSA stack offset relative to the enclave base.
  • ssa_index β€” the current SSA frame index. The source spells it cleard by EADD 😭, meaning it’s cleared by EADD β€” typo deets preserved, bestie.
  • nr_ssa_frames β€” the number of frame in the SSA stack. (Original wording says frame, singular 🫢.)
  • 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).

πŸ¦‹ Description πŸ¦‹

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 β€” that’s the whole vibe check πŸ”₯.

🌈 SEE ALSO 🌈

Kernel file ./arch/x86/include/asm/sgx.h β€” and here’s the full squad, bestie:

  • SGX_ENCLS_FAULT_FLAG(9)
  • enum sgx_return_code(9)
  • enum sgx_miscselect(9)
  • enum sgx_attribute(9)
  • struct sgx_secs(9)
  • enum sgx_tcs_flags(9)
  • struct sgx_pageinfo(9)
  • enum sgx_page_type(9)
  • enum sgx_secinfo_flags(9)
  • struct sgx_secinfo(9)
  • struct sgx_pcmd(9)
  • struct sgx_sigstruct_header(9)
  • struct sgx_sigstruct_body(9)
  • struct sgx_sigstruct(9)

okay bye bestie 🫢 struct sgx_tcs(9) is out πŸ’… β€” source/version: ./arch/x86/include/asm, dated October 2026. Iconic. Done. Periodt. πŸ’œ

πŸ“¦ where this page comes from