@@ -53,9 +53,6 @@
* -EFAULT if ENCL or the enclave faults or non-positive value is returned
* from the callback.
*/
-typedef int (*sgx_enclave_exit_handler_t)(long rdi, long rsi, long rdx, int ret,
- long r8, long r9, void *tcs, long ursp,
- struct sgx_enclave_exception *e);
int __vdso_sgx_enter_enclave(int leaf, void *tcs,
struct sgx_enclave_exception *e,
sgx_enclave_exit_handler_t handler);
@@ -81,4 +81,22 @@ struct sgx_enclave_exception {
__u64 reserved[2];
};
+/**
+ * typedef sgx_enclave_exit_handler_t - Exit handler function accepted by
+ * __vdso_sgx_enter_enclave()
+ *
+ * @rdi: RDI at the time of enclave exit
+ * @rsi: RSI at the time of enclave exit
+ * @rdx: RDX at the time of enclave exit
+ * @ret: 0 on success (EEXIT), -EFAULT on an exception
+ * @r8: R8 at the time of enclave exit
+ * @r9: R9 at the time of enclave exit
+ * @tcs: Thread Control Structure used to enter enclave
+ * @ursp: RSP at the time of enclave exit
+ * @e: Pointer to struct sgx_enclave_exception (as provided by caller)
+ */
+typedef int (*sgx_enclave_exit_handler_t)(long rdi, long rsi, long rdx, int ret,
+ long r8, long r9, void *tcs, long ursp,
+ struct sgx_enclave_exception *e);
+
#endif /* _UAPI_ASM_X86_SGX_H */
Move the typedef of the enclave exit handler to the UAPI header so that it can be consumed by userspace and kernel-doc. Add a proper comment, primarily to document the parameters. A future patch will update the comment for __vdso_sgx_enter_enclave() to better describe how the exit handler is used. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- arch/x86/entry/vdso/vsgx_enter_enclave.S | 3 --- arch/x86/include/uapi/asm/sgx.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-)