1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _UAPI_ASM_X86_SGX_H 8 #define _UAPI_ASM_X86_SGX_H 9 #include <linux/types.h> 10 #include <linux/ioctl.h> 11 enum sgx_page_flags { 12 SGX_PAGE_MEASURE = 0x01, 13 }; 14 #define SGX_MAGIC 0xA4 15 #define SGX_IOC_ENCLAVE_CREATE _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) 16 #define SGX_IOC_ENCLAVE_ADD_PAGES _IOWR(SGX_MAGIC, 0x01, struct sgx_enclave_add_pages) 17 #define SGX_IOC_ENCLAVE_INIT _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) 18 #define SGX_IOC_ENCLAVE_PROVISION _IOW(SGX_MAGIC, 0x03, struct sgx_enclave_provision) 19 #define SGX_IOC_VEPC_REMOVE_ALL _IO(SGX_MAGIC, 0x04) 20 #define SGX_IOC_ENCLAVE_RESTRICT_PERMISSIONS _IOWR(SGX_MAGIC, 0x05, struct sgx_enclave_restrict_permissions) 21 #define SGX_IOC_ENCLAVE_MODIFY_TYPES _IOWR(SGX_MAGIC, 0x06, struct sgx_enclave_modify_types) 22 #define SGX_IOC_ENCLAVE_REMOVE_PAGES _IOWR(SGX_MAGIC, 0x07, struct sgx_enclave_remove_pages) 23 struct sgx_enclave_create { 24 __u64 src; 25 }; 26 struct sgx_enclave_add_pages { 27 __u64 src; 28 __u64 offset; 29 __u64 length; 30 __u64 secinfo; 31 __u64 flags; 32 __u64 count; 33 }; 34 struct sgx_enclave_init { 35 __u64 sigstruct; 36 }; 37 struct sgx_enclave_provision { 38 __u64 fd; 39 }; 40 struct sgx_enclave_restrict_permissions { 41 __u64 offset; 42 __u64 length; 43 __u64 permissions; 44 __u64 result; 45 __u64 count; 46 }; 47 struct sgx_enclave_modify_types { 48 __u64 offset; 49 __u64 length; 50 __u64 page_type; 51 __u64 result; 52 __u64 count; 53 }; 54 struct sgx_enclave_remove_pages { 55 __u64 offset; 56 __u64 length; 57 __u64 count; 58 }; 59 struct sgx_enclave_run; 60 typedef int(* sgx_enclave_user_handler_t) (long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run * run); 61 struct sgx_enclave_run { 62 __u64 tcs; 63 __u32 function; 64 __u16 exception_vector; 65 __u16 exception_error_code; 66 __u64 exception_addr; 67 __u64 user_handler; 68 __u64 user_data; 69 __u8 reserved[216]; 70 }; 71 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); 72 #endif 73