defines.h 1.4 KB

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