mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-04-23 15:24:43 +00:00
This makes breaking changes to add underscores to many non-standard
function names provided by the c library. MODE=tiny is now tinier and
we now use smaller locks that are better for tiny apps in this mode.
Some headers have been renamed to be in the same folder as the build
package, so it'll be easier to know which build dependency is needed.
Certain old misguided interfaces have been removed. Intel intrinsics
headers are now listed in libc/isystem (but not in the amalgamation)
to help further improve open source compatibility. Header complexity
has also been reduced. Lastly, more shell scripts are now available.
Compared to 6f7d0cb1c3
, some tiny corrections were made in libc/intrin/g_fds.c and libc/zipos/open.c including double semi colons and incorrect indentation for existing vista changes that were manually pulled from this commit previously.
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
#ifndef COSMOPOLITAN_LIBC_THREAD_TLS_H_
|
|
#define COSMOPOLITAN_LIBC_THREAD_TLS_H_
|
|
|
|
#define TLS_ALIGNMENT 64
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
struct CosmoFtrace { /* 16 */
|
|
bool ft_once; /* 0 */
|
|
bool ft_noreentry; /* 1 */
|
|
int ft_skew; /* 4 */
|
|
int64_t ft_lastaddr; /* 8 */
|
|
};
|
|
|
|
struct CosmoTib {
|
|
struct CosmoTib *tib_self; /* 0x00 */
|
|
struct CosmoFtrace tib_ftrace; /* 0x08 */
|
|
void *tib_garbages; /* 0x18 */
|
|
intptr_t tib_locale; /* 0x20 */
|
|
intptr_t tib_pthread; /* 0x28 */
|
|
struct CosmoTib *tib_self2; /* 0x30 */
|
|
_Atomic(int32_t) tib_tid; /* 0x38 */
|
|
int32_t tib_errno; /* 0x3c */
|
|
};
|
|
|
|
extern int __threaded;
|
|
extern bool __tls_enabled;
|
|
extern unsigned __tls_index;
|
|
|
|
void __require_tls(void);
|
|
|
|
#if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__)
|
|
/**
|
|
* Returns location of thread information block.
|
|
*
|
|
* This can't be used in privileged functions.
|
|
*/
|
|
static inline struct CosmoTib *__get_tls(void) {
|
|
struct CosmoTib *_tib;
|
|
asm("mov\t%%fs:0,%0" : "=r"(_tib) : /* no inputs */ : "memory");
|
|
return _tib;
|
|
}
|
|
#endif /* GNU x86-64 */
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_THREAD_TLS_H_ */
|