blob: f2498269f6b2e7446e741a4ee0cc26860a45e445 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 */
Christopher Ferris05667cd2021-02-16 16:01:34 -08007#ifndef _UAPI_ASM_X86_SGX_H
8#define _UAPI_ASM_X86_SGX_H
9#include <linux/types.h>
10#include <linux/ioctl.h>
11enum 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)
Christopher Ferrisa4792612022-01-10 13:51:15 -080019#define SGX_IOC_VEPC_REMOVE_ALL _IO(SGX_MAGIC, 0x04)
Christopher Ferris7447a1c2022-10-04 18:24:44 -070020#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)
Christopher Ferris05667cd2021-02-16 16:01:34 -080023struct sgx_enclave_create {
24 __u64 src;
25};
26struct sgx_enclave_add_pages {
27 __u64 src;
28 __u64 offset;
29 __u64 length;
30 __u64 secinfo;
31 __u64 flags;
32 __u64 count;
33};
34struct sgx_enclave_init {
35 __u64 sigstruct;
36};
37struct sgx_enclave_provision {
38 __u64 fd;
39};
Christopher Ferris7447a1c2022-10-04 18:24:44 -070040struct sgx_enclave_restrict_permissions {
41 __u64 offset;
42 __u64 length;
43 __u64 permissions;
44 __u64 result;
45 __u64 count;
46};
47struct sgx_enclave_modify_types {
48 __u64 offset;
49 __u64 length;
50 __u64 page_type;
51 __u64 result;
52 __u64 count;
53};
54struct sgx_enclave_remove_pages {
55 __u64 offset;
56 __u64 length;
57 __u64 count;
58};
Christopher Ferris05667cd2021-02-16 16:01:34 -080059struct sgx_enclave_run;
60typedef int(* sgx_enclave_user_handler_t) (long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run * run);
61struct 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};
71typedef 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