mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-07 06:14:24 +08:00
b564982fda
The Thread Control Structure (TCS) contains meta-data used by the hardware to save and restore thread specific information when entering/exiting the enclave. A TCS can be added to an initialized enclave by first adding a new regular enclave page, initializing the content of the new page from within the enclave, and then changing that page's type to a TCS. Support the initialization of a TCS from within the enclave. The variable information needed that should be provided from outside the enclave is the address of the TCS, address of the State Save Area (SSA), and the entry point that the thread should use to enter the enclave. With this information provided all needed fields of a TCS can be initialized. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lkml.kernel.org/r/bad6052056188bde753a54313da1ac8f1e29088a.1652137848.git.reinette.chatre@intel.com
80 lines
1.4 KiB
C
80 lines
1.4 KiB
C
/* 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))
|
|
|
|
#include "../../../../arch/x86/include/asm/sgx.h"
|
|
#include "../../../../arch/x86/include/asm/enclu.h"
|
|
#include "../../../../arch/x86/include/uapi/asm/sgx.h"
|
|
|
|
enum encl_op_type {
|
|
ENCL_OP_PUT_TO_BUFFER,
|
|
ENCL_OP_GET_FROM_BUFFER,
|
|
ENCL_OP_PUT_TO_ADDRESS,
|
|
ENCL_OP_GET_FROM_ADDRESS,
|
|
ENCL_OP_NOP,
|
|
ENCL_OP_EACCEPT,
|
|
ENCL_OP_EMODPE,
|
|
ENCL_OP_INIT_TCS_PAGE,
|
|
ENCL_OP_MAX,
|
|
};
|
|
|
|
struct encl_op_header {
|
|
uint64_t type;
|
|
};
|
|
|
|
struct encl_op_put_to_buf {
|
|
struct encl_op_header header;
|
|
uint64_t value;
|
|
};
|
|
|
|
struct encl_op_get_from_buf {
|
|
struct encl_op_header header;
|
|
uint64_t value;
|
|
};
|
|
|
|
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;
|
|
};
|
|
|
|
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;
|
|
};
|
|
|
|
struct encl_op_init_tcs_page {
|
|
struct encl_op_header header;
|
|
uint64_t tcs_page;
|
|
uint64_t ssa;
|
|
uint64_t entry;
|
|
};
|
|
|
|
#endif /* DEFINES_H */
|