vdso_sgx_enter_enclave_t(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ 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 for RDI πŸ’…
  • rsi β€” pass-through value for RSI
  • rdx β€” pass-through value for RDX
  • function β€” ENCLU function, must be EENTER or ERESUME πŸ‘‘
  • r8 β€” pass-through value for R8
  • r9 β€” pass-through value for R9
  • run β€” 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: ENCLU function was successfully executed. ✨
  • -EINVAL: Invalid ENCL number (neither EENTER nor ERESUME). πŸ™ˆ

🌈 SEE ALSO 🌈

Kernel file ./arch/x86/include/uapi/asm/sgx.h is the hangout spot, and these are the linked besties:


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