00001 #if !defined(CMITLS_H)
00002 #define CMITLS_H
00003 
00004 #include "conv-config.h"
00005 
00006 #if CMK_HAS_TLS_VARIABLES
00007 
00008 #if CMK_HAS_ELF_H \
00009     && ((CMK_DLL_USE_DLOPEN && CMK_HAS_RTLD_DEFAULT) || CMK_HAS_DL_ITERATE_PHDR)
00010 
00011 #include <elf.h>
00012 
00013 #if ( defined(__LP64__) || defined(_LP64) )
00014 #define ELF64
00015 #else
00016 #define ELF32
00017 #endif
00018 
00019 #endif
00020 
00021 #endif
00022 
00023 #if defined ELF32
00024 typedef Elf32_Addr Addr;
00025 typedef Elf32_Ehdr Ehdr;
00026 typedef Elf32_Phdr Phdr;
00027 #elif defined ELF64
00028 typedef Elf64_Addr Addr;
00029 typedef Elf64_Ehdr Ehdr;
00030 typedef Elf64_Phdr Phdr;
00031 #else
00032 typedef void * Addr;
00033 #endif
00034 
00035 typedef struct tlsseg {
00036   Addr memseg;
00037   size_t size;
00038   size_t align;
00039 } tlsseg_t;
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 void CmiTLSInit(void);
00046 void allocNewTLSSeg(tlsseg_t* t, CthThread th);
00047 void switchTLS(tlsseg_t*, tlsseg_t*);
00048 void currentTLS(tlsseg_t*);
00049 
00050 #ifdef __cplusplus
00051 }
00052 #endif
00053 
00054 #endif