defines.h 1.5 KB

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