Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 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) |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 31 | #define SGX_IOC_VEPC_REMOVE_ALL _IO(SGX_MAGIC, 0x04) |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame^] | 32 | #define SGX_IOC_ENCLAVE_RESTRICT_PERMISSIONS _IOWR(SGX_MAGIC, 0x05, struct sgx_enclave_restrict_permissions) |
| 33 | #define SGX_IOC_ENCLAVE_MODIFY_TYPES _IOWR(SGX_MAGIC, 0x06, struct sgx_enclave_modify_types) |
| 34 | #define SGX_IOC_ENCLAVE_REMOVE_PAGES _IOWR(SGX_MAGIC, 0x07, struct sgx_enclave_remove_pages) |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 35 | struct sgx_enclave_create { |
| 36 | __u64 src; |
| 37 | }; |
| 38 | struct sgx_enclave_add_pages { |
| 39 | __u64 src; |
| 40 | __u64 offset; |
| 41 | __u64 length; |
| 42 | __u64 secinfo; |
| 43 | __u64 flags; |
| 44 | __u64 count; |
| 45 | }; |
| 46 | struct sgx_enclave_init { |
| 47 | __u64 sigstruct; |
| 48 | }; |
| 49 | struct sgx_enclave_provision { |
| 50 | __u64 fd; |
| 51 | }; |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame^] | 52 | struct sgx_enclave_restrict_permissions { |
| 53 | __u64 offset; |
| 54 | __u64 length; |
| 55 | __u64 permissions; |
| 56 | __u64 result; |
| 57 | __u64 count; |
| 58 | }; |
| 59 | struct sgx_enclave_modify_types { |
| 60 | __u64 offset; |
| 61 | __u64 length; |
| 62 | __u64 page_type; |
| 63 | __u64 result; |
| 64 | __u64 count; |
| 65 | }; |
| 66 | struct sgx_enclave_remove_pages { |
| 67 | __u64 offset; |
| 68 | __u64 length; |
| 69 | __u64 count; |
| 70 | }; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 71 | struct sgx_enclave_run; |
| 72 | typedef int(* sgx_enclave_user_handler_t) (long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run * run); |
| 73 | struct sgx_enclave_run { |
| 74 | __u64 tcs; |
| 75 | __u32 function; |
| 76 | __u16 exception_vector; |
| 77 | __u16 exception_error_code; |
| 78 | __u64 exception_addr; |
| 79 | __u64 user_handler; |
| 80 | __u64 user_data; |
| 81 | __u8 reserved[216]; |
| 82 | }; |
| 83 | 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); |
| 84 | #endif |