2020-11-13 00:01:31 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright(c) 2016-20 Intel Corporation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DEFINES_H
|
|
|
|
#define DEFINES_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define PAGE_SIZE 4096
|
|
|
|
#define PAGE_MASK (~(PAGE_SIZE - 1))
|
|
|
|
|
|
|
|
#define __aligned(x) __attribute__((__aligned__(x)))
|
|
|
|
#define __packed __attribute__((packed))
|
2023-10-05 17:38:51 +02:00
|
|
|
#define __used __attribute__((used))
|
2023-10-05 17:38:52 +02:00
|
|
|
#define __section(x)__attribute__((__section__(x)))
|
2020-11-13 00:01:31 +02:00
|
|
|
|
2021-03-19 20:23:03 +13:00
|
|
|
#include "../../../../arch/x86/include/asm/sgx.h"
|
2020-11-13 00:01:31 +02:00
|
|
|
#include "../../../../arch/x86/include/asm/enclu.h"
|
|
|
|
#include "../../../../arch/x86/include/uapi/asm/sgx.h"
|
|
|
|
|
2021-06-10 11:30:21 +03:00
|
|
|
enum encl_op_type {
|
2021-11-15 10:35:23 -08:00
|
|
|
ENCL_OP_PUT_TO_BUFFER,
|
|
|
|
ENCL_OP_GET_FROM_BUFFER,
|
2021-11-15 10:35:24 -08:00
|
|
|
ENCL_OP_PUT_TO_ADDRESS,
|
|
|
|
ENCL_OP_GET_FROM_ADDRESS,
|
2021-11-15 10:35:26 -08:00
|
|
|
ENCL_OP_NOP,
|
2022-05-10 11:08:58 -07:00
|
|
|
ENCL_OP_EACCEPT,
|
|
|
|
ENCL_OP_EMODPE,
|
2022-05-10 11:09:02 -07:00
|
|
|
ENCL_OP_INIT_TCS_PAGE,
|
2021-11-15 10:35:22 -08:00
|
|
|
ENCL_OP_MAX,
|
2021-06-10 11:30:21 +03:00
|
|
|
};
|
|
|
|
|
2021-11-15 10:35:22 -08:00
|
|
|
struct encl_op_header {
|
2021-06-10 11:30:21 +03:00
|
|
|
uint64_t type;
|
2021-11-15 10:35:22 -08:00
|
|
|
};
|
|
|
|
|
2021-11-15 10:35:23 -08:00
|
|
|
struct encl_op_put_to_buf {
|
2021-11-15 10:35:22 -08:00
|
|
|
struct encl_op_header header;
|
|
|
|
uint64_t value;
|
|
|
|
};
|
|
|
|
|
2021-11-15 10:35:23 -08:00
|
|
|
struct encl_op_get_from_buf {
|
2021-11-15 10:35:22 -08:00
|
|
|
struct encl_op_header header;
|
|
|
|
uint64_t value;
|
2021-06-10 11:30:21 +03:00
|
|
|
};
|
|
|
|
|
2021-11-15 10:35:24 -08:00
|
|
|
struct encl_op_put_to_addr {
|
|
|
|
struct encl_op_header header;
|
|
|
|
uint64_t value;
|
|
|
|
uint64_t addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct encl_op_get_from_addr {
|
|
|
|
struct encl_op_header header;
|
|
|
|
uint64_t value;
|
|
|
|
uint64_t addr;
|
|
|
|
};
|
|
|
|
|
2022-05-10 11:08:58 -07:00
|
|
|
struct encl_op_eaccept {
|
|
|
|
struct encl_op_header header;
|
|
|
|
uint64_t epc_addr;
|
|
|
|
uint64_t flags;
|
|
|
|
uint64_t ret;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct encl_op_emodpe {
|
|
|
|
struct encl_op_header header;
|
|
|
|
uint64_t epc_addr;
|
|
|
|
uint64_t flags;
|
|
|
|
};
|
|
|
|
|
2022-05-10 11:09:02 -07:00
|
|
|
struct encl_op_init_tcs_page {
|
|
|
|
struct encl_op_header header;
|
|
|
|
uint64_t tcs_page;
|
|
|
|
uint64_t ssa;
|
|
|
|
uint64_t entry;
|
|
|
|
};
|
|
|
|
|
2020-11-13 00:01:31 +02:00
|
|
|
#endif /* DEFINES_H */
|