12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #ifndef _TD_MNGR_H_
- #define _TD_MNGR_H_
- #include "arch.h"
- #include "rts.h"
- typedef struct _tcs_sim_t
- {
- uintptr_t saved_aep;
- size_t tcs_state;
- uintptr_t saved_dtv;
- uintptr_t saved_fs_gs_0;
- } tcs_sim_t;
- #define TCS_STATE_INACTIVE 0
- #define TCS_STATE_ACTIVE 1
- #ifdef SE_GNU64
- #define GET_TCS_PTR(xbp) (tcs_t *)(*(uintptr_t *)((size_t)(xbp) - 10 * sizeof(uintptr_t)))
- #else
- #define GET_TCS_PTR(xbp) (tcs_t *)(*(uintptr_t *)((size_t)(xbp) + 2 * sizeof(uintptr_t)))
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "gnu_tls.h"
- extern uint8_t __ImageBase;
- int td_mngr_set_td(void *enclave_base, tcs_t *tcs);
- int td_mngr_restore_td(tcs_t *tcs);
- #ifdef __cplusplus
- }
- #endif
- #endif
|