1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _UAPI_ASM_X86_SGX_H 20 #define _UAPI_ASM_X86_SGX_H 21 #include <linux/types.h> 22 #include <linux/ioctl.h> 23 enum sgx_page_flags { 24 SGX_PAGE_MEASURE = 0x01, 25 }; 26 #define SGX_MAGIC 0xA4 27 #define SGX_IOC_ENCLAVE_CREATE _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) 28 #define SGX_IOC_ENCLAVE_ADD_PAGES _IOWR(SGX_MAGIC, 0x01, struct sgx_enclave_add_pages) 29 #define SGX_IOC_ENCLAVE_INIT _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) 30 #define SGX_IOC_ENCLAVE_PROVISION _IOW(SGX_MAGIC, 0x03, struct sgx_enclave_provision) 31 #define SGX_IOC_VEPC_REMOVE_ALL _IO(SGX_MAGIC, 0x04) 32 struct sgx_enclave_create { 33 __u64 src; 34 }; 35 struct sgx_enclave_add_pages { 36 __u64 src; 37 __u64 offset; 38 __u64 length; 39 __u64 secinfo; 40 __u64 flags; 41 __u64 count; 42 }; 43 struct sgx_enclave_init { 44 __u64 sigstruct; 45 }; 46 struct sgx_enclave_provision { 47 __u64 fd; 48 }; 49 struct sgx_enclave_run; 50 typedef int(* sgx_enclave_user_handler_t) (long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run * run); 51 struct sgx_enclave_run { 52 __u64 tcs; 53 __u32 function; 54 __u16 exception_vector; 55 __u16 exception_error_code; 56 __u64 exception_addr; 57 __u64 user_handler; 58 __u64 user_data; 59 __u8 reserved[216]; 60 }; 61 typedef 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); 62 #endif 63