diff mbox series

[for_v23,04/16] x86/vdso: sgx: Move enclave exit handler declaration to UAPI header

Message ID 20191008044613.12350-5-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series x86/vdso: sgx: Major vDSO cleanup | expand

Commit Message

Sean Christopherson Oct. 8, 2019, 4:46 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S
index 5fbe07a03e6c..a382f3683b48 100644
--- a/arch/x86/entry/vdso/vsgx_enter_enclave.S
+++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S
@@ -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);
diff --git a/arch/x86/include/uapi/asm/sgx.h b/arch/x86/include/uapi/asm/sgx.h
index 8f4660e07f6b..0515de4e67cc 100644
--- a/arch/x86/include/uapi/asm/sgx.h
+++ b/arch/x86/include/uapi/asm/sgx.h
@@ -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 */