|
|
@@ -1,21 +1,8 @@
|
|
|
#ifndef _SHIM_TLS_H_
|
|
|
#define _SHIM_TLS_H_
|
|
|
|
|
|
-#ifdef IN_SHIM
|
|
|
-
|
|
|
#include <atomic.h>
|
|
|
|
|
|
-#else /* !IN_SHIM */
|
|
|
-/* workaround to make glibc build
|
|
|
- * the following structure must match to the one defined in pal/lib/atomic.h
|
|
|
- */
|
|
|
-#ifdef __x86_64__
|
|
|
-struct atomic_int {
|
|
|
- volatile int64_t counter;
|
|
|
-};
|
|
|
-#endif
|
|
|
-#endif /* IN_SHIM */
|
|
|
-
|
|
|
#define SHIM_TLS_CANARY 0xdeadbeef
|
|
|
|
|
|
struct shim_regs {
|
|
|
@@ -68,14 +55,11 @@ struct shim_tcb {
|
|
|
} test_range;
|
|
|
};
|
|
|
|
|
|
-#ifdef IN_SHIM
|
|
|
-
|
|
|
-#include <stddef.h>
|
|
|
-
|
|
|
void init_tcb (shim_tcb_t * tcb);
|
|
|
|
|
|
static inline shim_tcb_t * shim_get_tcb(void)
|
|
|
{
|
|
|
+ /* TODO: optimize to use single movq %gs:<offset> */
|
|
|
PAL_TCB * tcb = pal_get_tcb();
|
|
|
return (shim_tcb_t*)tcb->libos_tcb;
|
|
|
}
|
|
|
@@ -87,6 +71,4 @@ static inline bool shim_tls_check_canary(void)
|
|
|
return shim_tcb->canary == SHIM_TLS_CANARY;
|
|
|
}
|
|
|
|
|
|
-#endif /* IN_SHIM */
|
|
|
-
|
|
|
#endif /* _SHIM_H_ */
|