0001
0002
0003
0004
0005
0006 #ifndef DEFINES_H
0007 #define DEFINES_H
0008
0009 #include <stdint.h>
0010
0011 #define PAGE_SIZE 4096
0012 #define PAGE_MASK (~(PAGE_SIZE - 1))
0013
0014 #define __aligned(x) __attribute__((__aligned__(x)))
0015 #define __packed __attribute__((packed))
0016
0017 #include "../../../../arch/x86/include/asm/sgx.h"
0018 #include "../../../../arch/x86/include/asm/enclu.h"
0019 #include "../../../../arch/x86/include/uapi/asm/sgx.h"
0020
0021 enum encl_op_type {
0022 ENCL_OP_PUT_TO_BUFFER,
0023 ENCL_OP_GET_FROM_BUFFER,
0024 ENCL_OP_PUT_TO_ADDRESS,
0025 ENCL_OP_GET_FROM_ADDRESS,
0026 ENCL_OP_NOP,
0027 ENCL_OP_EACCEPT,
0028 ENCL_OP_EMODPE,
0029 ENCL_OP_INIT_TCS_PAGE,
0030 ENCL_OP_MAX,
0031 };
0032
0033 struct encl_op_header {
0034 uint64_t type;
0035 };
0036
0037 struct encl_op_put_to_buf {
0038 struct encl_op_header header;
0039 uint64_t value;
0040 };
0041
0042 struct encl_op_get_from_buf {
0043 struct encl_op_header header;
0044 uint64_t value;
0045 };
0046
0047 struct encl_op_put_to_addr {
0048 struct encl_op_header header;
0049 uint64_t value;
0050 uint64_t addr;
0051 };
0052
0053 struct encl_op_get_from_addr {
0054 struct encl_op_header header;
0055 uint64_t value;
0056 uint64_t addr;
0057 };
0058
0059 struct encl_op_eaccept {
0060 struct encl_op_header header;
0061 uint64_t epc_addr;
0062 uint64_t flags;
0063 uint64_t ret;
0064 };
0065
0066 struct encl_op_emodpe {
0067 struct encl_op_header header;
0068 uint64_t epc_addr;
0069 uint64_t flags;
0070 };
0071
0072 struct encl_op_init_tcs_page {
0073 struct encl_op_header header;
0074 uint64_t tcs_page;
0075 uint64_t ssa;
0076 uint64_t entry;
0077 };
0078
0079 #endif