vdso_sgx_enter_enclave_t(9)
π NAME π
okay so bestie, welcome to the vdso_sgx_enter_enclave_t(9) page in the Kernel API Manual β this is literally the prototype for __vdso_sgx_enter_enclave(), the vDSO function that enters an SGX enclave. π§β¨
πΈ SYNOPSIS πΈ
int vdso_sgx_enter_enclave_t (unsigned long rdi , unsigned long rsi , unsigned long rdx , unsigned int function , unsigned long r8 , unsigned long r9 , struct sgx_enclave_run *run );
β¨ ARGUMENTS β¨
rdiβ pass-through value forRDIπrsiβ pass-through value forRSIrdxβ pass-through value forRDXfunctionβENCLUfunction, must beEENTERorERESUMEπr8β pass-through value forR8r9β pass-through value forR9runβstruct sgx_enclave_run, must be non-NULLπ«Ά
π NOTE π
okay so huge vibe check: __vdso_sgx_enter_enclave does not ensure full compliance with the x86-64 ABI, e.g. it doesn't handle XSAVE state. Except for non-volatile general purpose registers, EFLAGS.DF, and RSP alignment, preserving/setting state in accordance with the x86-64 ABI is the responsibility of the enclave and its runtime. i.e. __vdso_sgx_enter_enclave cannot be called from C code without careful consideration by both the enclave and its runtime. π
All general purpose registers except RAX, RBX and RCX are passed as-is to the enclave. RAX, RBX and RCX are consumed by EENTER and ERESUME and are loaded with function, asynchronous exit pointer, and run.tcs respectively. π
RBP and the stack are used to anchor __vdso_sgx_enter_enclave to the pre-enclave state, e.g. to retrieve run.exception and run.user_handler after an enclave exit. All other registers are available for use by the enclave and its runtime, e.g. an enclave can push additional data onto the stack (and modify RSP) to pass information to the optional user handler (see below). π¦
Most exceptions reported on ENCLU, including those that occur within the enclave, are fixed up and reported synchronously instead of being delivered via a standard signal. Debug Exceptions (#DB) and Breakpoints (#BP) are never fixed up and are always delivered via standard signals. On synchronously reported exceptions, -EFAULT is returned and details about the exception are recorded in run.exception, the optional sgx_enclave_exception struct. π
π¦ RETURN π¦
the receipts, bestie π
0:ENCLUfunction was successfully executed. β¨-EINVAL: InvalidENCLnumber (neitherEENTERnorERESUME). π
π SEE ALSO π
Kernel file ./arch/x86/include/uapi/asm/sgx.h is the hangout spot, and these are the linked besties:
enum sgx_page_flags(9)struct sgx_enclave_create(9)struct sgx_enclave_add_pages(9)struct sgx_enclave_init(9)struct sgx_enclave_provision(9)struct sgx_enclave_restrict_permissions(9)struct sgx_enclave_modify_types(9)struct sgx_enclave_remove_pages(9)sgx_enclave_user_handler_t(9)struct sgx_enclave_run(9)
byeee bestie π«Ά this page comes from source/version ./arch/x86/include/uapi/asm, dated October 2026, and it's vdso_sgx_enter_enclave_t(9) β periodt. π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms