generated-offsets.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #include <stddef.h>
  2. #include "sgx_arch.h"
  3. #include "sgx_tls.h"
  4. #include "pal_linux.h"
  5. #include "pal_linux_defs.h"
  6. #include "pal_security.h"
  7. #include <generated-offsets-build.h>
  8. void dummy(void)
  9. {
  10. /* sgx_arch_gpr_t */
  11. OFFSET_T(SGX_GPR_RAX, sgx_arch_gpr_t, rax);
  12. OFFSET_T(SGX_GPR_RCX, sgx_arch_gpr_t, rcx);
  13. OFFSET_T(SGX_GPR_RDX, sgx_arch_gpr_t, rdx);
  14. OFFSET_T(SGX_GPR_RBX, sgx_arch_gpr_t, rbx);
  15. OFFSET_T(SGX_GPR_RSP, sgx_arch_gpr_t, rsp);
  16. OFFSET_T(SGX_GPR_RBP, sgx_arch_gpr_t, rbp);
  17. OFFSET_T(SGX_GPR_RSI, sgx_arch_gpr_t, rsi);
  18. OFFSET_T(SGX_GPR_RDI, sgx_arch_gpr_t, rdi);
  19. OFFSET_T(SGX_GPR_R8, sgx_arch_gpr_t, r8);
  20. OFFSET_T(SGX_GPR_R9, sgx_arch_gpr_t, r9);
  21. OFFSET_T(SGX_GPR_R10, sgx_arch_gpr_t, r10);
  22. OFFSET_T(SGX_GPR_R11, sgx_arch_gpr_t, r11);
  23. OFFSET_T(SGX_GPR_R12, sgx_arch_gpr_t, r12);
  24. OFFSET_T(SGX_GPR_R13, sgx_arch_gpr_t, r13);
  25. OFFSET_T(SGX_GPR_R14, sgx_arch_gpr_t, r14);
  26. OFFSET_T(SGX_GPR_R15, sgx_arch_gpr_t, r15);
  27. OFFSET_T(SGX_GPR_RFLAGS, sgx_arch_gpr_t, rflags);
  28. OFFSET_T(SGX_GPR_RIP, sgx_arch_gpr_t, rip);
  29. OFFSET_T(SGX_GPR_EXITINFO, sgx_arch_gpr_t, exitinfo);
  30. DEFINE(SGX_GPR_SIZE, sizeof(sgx_arch_gpr_t));
  31. /* sgx_context_t */
  32. OFFSET_T(SGX_CONTEXT_RAX, sgx_context_t, rax);
  33. OFFSET_T(SGX_CONTEXT_RCX, sgx_context_t, rcx);
  34. OFFSET_T(SGX_CONTEXT_RDX, sgx_context_t, rdx);
  35. OFFSET_T(SGX_CONTEXT_RBX, sgx_context_t, rbx);
  36. OFFSET_T(SGX_CONTEXT_RSP, sgx_context_t, rsp);
  37. OFFSET_T(SGX_CONTEXT_RBP, sgx_context_t, rbp);
  38. OFFSET_T(SGX_CONTEXT_RSI, sgx_context_t, rsi);
  39. OFFSET_T(SGX_CONTEXT_RDI, sgx_context_t, rdi);
  40. OFFSET_T(SGX_CONTEXT_R8, sgx_context_t, r8);
  41. OFFSET_T(SGX_CONTEXT_R9, sgx_context_t, r9);
  42. OFFSET_T(SGX_CONTEXT_R10, sgx_context_t, r10);
  43. OFFSET_T(SGX_CONTEXT_R11, sgx_context_t, r11);
  44. OFFSET_T(SGX_CONTEXT_R12, sgx_context_t, r12);
  45. OFFSET_T(SGX_CONTEXT_R13, sgx_context_t, r13);
  46. OFFSET_T(SGX_CONTEXT_R14, sgx_context_t, r14);
  47. OFFSET_T(SGX_CONTEXT_R15, sgx_context_t, r15);
  48. OFFSET_T(SGX_CONTEXT_RFLAGS, sgx_context_t, rflags);
  49. OFFSET_T(SGX_CONTEXT_RIP, sgx_context_t, rip);
  50. DEFINE(SGX_CONTEXT_SIZE, sizeof(sgx_context_t));
  51. /* struct enclave_tls */
  52. OFFSET(SGX_ENCLAVE_SIZE, enclave_tls, enclave_size);
  53. OFFSET(SGX_TCS_OFFSET, enclave_tls, tcs_offset);
  54. OFFSET(SGX_INITIAL_STACK_OFFSET, enclave_tls, initial_stack_offset);
  55. OFFSET(SGX_AEP, enclave_tls, aep);
  56. OFFSET(SGX_SSA, enclave_tls, ssa);
  57. OFFSET(SGX_GPR, enclave_tls, gpr);
  58. OFFSET(SGX_EXIT_TARGET, enclave_tls, exit_target);
  59. OFFSET(SGX_FSBASE, enclave_tls, fsbase);
  60. OFFSET(SGX_STACK, enclave_tls, stack);
  61. OFFSET(SGX_USTACK_TOP, enclave_tls, ustack_top);
  62. OFFSET(SGX_USTACK, enclave_tls, ustack);
  63. OFFSET(SGX_THREAD, enclave_tls, thread);
  64. OFFSET(SGX_OCALL_PREPARED, enclave_tls, ocall_prepared);
  65. OFFSET(SGX_ECALL_CALLED, enclave_tls, ecall_called);
  66. OFFSET(SGX_READY_FOR_EXCEPTIONS, enclave_tls, ready_for_exceptions);
  67. OFFSET(SGX_MANIFEST_SIZE, enclave_tls, manifest_size);
  68. OFFSET(SGX_EXEC_ADDR, enclave_tls, exec_addr);
  69. OFFSET(SGX_EXEC_SIZE, enclave_tls, exec_size);
  70. /* sgx_arch_tcs_t */
  71. OFFSET_T(TCS_OSSA, sgx_arch_tcs_t, ossa);
  72. OFFSET_T(TCS_NSSA, sgx_arch_tcs_t, nssa);
  73. OFFSET_T(TCS_OENTRY, sgx_arch_tcs_t, oentry);
  74. OFFSET_T(TCS_OGSBASGX, sgx_arch_tcs_t, ogsbasgx);
  75. OFFSET_T(TCS_FSLIMIT, sgx_arch_tcs_t, fslimit);
  76. OFFSET_T(TCS_GSLIMIT, sgx_arch_tcs_t, gslimit);
  77. DEFINE(TCS_SIZE, sizeof(sgx_arch_tcs_t));
  78. /* sgx_arch_attributes_t */
  79. OFFSET_T(SGX_ARCH_ATTRIBUTES_XFRM, sgx_arch_attributes_t, xfrm);
  80. /* struct pal_sec */
  81. OFFSET(PAL_SEC_ENCLAVE_ATTRIBUTES, pal_sec, enclave_attributes);
  82. /* pal_linux_def.h */
  83. DEFINE(ENCLAVE_HIGH_ADDRESS, ENCLAVE_HIGH_ADDRESS);
  84. DEFINE(SSAFRAMENUM, SSAFRAMENUM);
  85. DEFINE(MEMORY_GAP, MEMORY_GAP);
  86. DEFINE(ENCLAVE_STACK_SIZE, ENCLAVE_STACK_SIZE);
  87. DEFINE(DEFAULT_HEAP_MIN, DEAFULT_HEAP_MIN);
  88. /* pal_linux.h */
  89. DEFINE(PAGESIZE, PRESET_PAGESIZE);
  90. }