1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright(c) 2016-20 Intel Corporation. 4 */ 5 6 #ifndef DEFINES_H 7 #define DEFINES_H 8 9 #include <stdint.h> 10 11 #define PAGE_SIZE 4096 12 #define PAGE_MASK (~(PAGE_SIZE - 1)) 13 14 #define __aligned(x) __attribute__((__aligned__(x))) 15 #define __packed __attribute__((packed)) 16 17 #include "../../../../arch/x86/include/asm/sgx.h" 18 #include "../../../../arch/x86/include/asm/enclu.h" 19 #include "../../../../arch/x86/include/uapi/asm/sgx.h" 20 21 enum encl_op_type { 22 ENCL_OP_PUT_TO_BUFFER, 23 ENCL_OP_GET_FROM_BUFFER, 24 ENCL_OP_PUT_TO_ADDRESS, 25 ENCL_OP_GET_FROM_ADDRESS, 26 ENCL_OP_NOP, 27 ENCL_OP_MAX, 28 }; 29 30 struct encl_op_header { 31 uint64_t type; 32 }; 33 34 struct encl_op_put_to_buf { 35 struct encl_op_header header; 36 uint64_t value; 37 }; 38 39 struct encl_op_get_from_buf { 40 struct encl_op_header header; 41 uint64_t value; 42 }; 43 44 struct encl_op_put_to_addr { 45 struct encl_op_header header; 46 uint64_t value; 47 uint64_t addr; 48 }; 49 50 struct encl_op_get_from_addr { 51 struct encl_op_header header; 52 uint64_t value; 53 uint64_t addr; 54 }; 55 56 #endif /* DEFINES_H */ 57