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#define __used __attribute__((used))
17#define __section(x)__attribute__((__section__(x)))
18
19#include "../../../../arch/x86/include/asm/sgx.h"
20#include "../../../../arch/x86/include/asm/enclu.h"
21#include "../../../../arch/x86/include/uapi/asm/sgx.h"
22
23enum encl_op_type {
24 ENCL_OP_PUT_TO_BUFFER,
25 ENCL_OP_GET_FROM_BUFFER,
26 ENCL_OP_PUT_TO_ADDRESS,
27 ENCL_OP_GET_FROM_ADDRESS,
28 ENCL_OP_NOP,
29 ENCL_OP_EACCEPT,
30 ENCL_OP_EMODPE,
31 ENCL_OP_INIT_TCS_PAGE,
32 ENCL_OP_MAX,
33};
34
35struct encl_op_header {
36 uint64_t type;
37};
38
39struct encl_op_put_to_buf {
40 struct encl_op_header header;
41 uint64_t value;
42};
43
44struct encl_op_get_from_buf {
45 struct encl_op_header header;
46 uint64_t value;
47};
48
49struct encl_op_put_to_addr {
50 struct encl_op_header header;
51 uint64_t value;
52 uint64_t addr;
53};
54
55struct encl_op_get_from_addr {
56 struct encl_op_header header;
57 uint64_t value;
58 uint64_t addr;
59};
60
61struct encl_op_eaccept {
62 struct encl_op_header header;
63 uint64_t epc_addr;
64 uint64_t flags;
65 uint64_t ret;
66};
67
68struct encl_op_emodpe {
69 struct encl_op_header header;
70 uint64_t epc_addr;
71 uint64_t flags;
72};
73
74struct encl_op_init_tcs_page {
75 struct encl_op_header header;
76 uint64_t tcs_page;
77 uint64_t ssa;
78 uint64_t entry;
79};
80
81#endif /* DEFINES_H */
82

source code of linux/tools/testing/selftests/sgx/defines.h