mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 13:30:29 +00:00
Apply even more fixups
- Finish cleaning up the stdio unlocked APIs - Make __cxa_finalize() properly thread safe - Don't log locks if threads aren't being used - Add some more mutex guards to places using _mmi - Specific lock names now appear in the --ftrace logs - Fix mkdeps.com generating invalid Makefiles sometimes - Simplify and fix bugs in the test runner infrastructure - Fix issue where sometimes some functions wouldn't be logged
This commit is contained in:
parent
4ddfc47d6e
commit
8cdec62f5b
87 changed files with 955 additions and 899 deletions
27
libc/nexgen32e/gettls.h
Normal file
27
libc/nexgen32e/gettls.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_GETTLS_H_
|
||||
#define COSMOPOLITAN_LIBC_NEXGEN32E_GETTLS_H_
|
||||
#include "libc/dce.h"
|
||||
#include "libc/nexgen32e/threaded.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
char *__get_tls(void) libcesque nosideeffect;
|
||||
|
||||
#if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__)
|
||||
static noasan inline char *__get_tls_inline(void) {
|
||||
char *tib, *lin = (char *)0x30;
|
||||
if (IsLinux() || IsFreebsd() || IsNetbsd() || IsOpenbsd()) {
|
||||
asm("mov\t%%fs:(%1),%0" : "=a"(tib) : "r"(lin) : "memory");
|
||||
} else {
|
||||
asm("mov\t%%gs:(%1),%0" : "=a"(tib) : "r"(lin) : "memory");
|
||||
if (IsWindows()) {
|
||||
tib = *(char **)(tib + 0x1480 + __tls_index * 8);
|
||||
}
|
||||
}
|
||||
return tib;
|
||||
}
|
||||
#endif /* GNU x86-64 */
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_GETTLS_H_ */
|
|
@ -1,6 +1,5 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NEXGEN32E_THREADED_H_
|
||||
#define COSMOPOLITAN_LIBC_NEXGEN32E_THREADED_H_
|
||||
#include "libc/dce.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
|
@ -8,25 +7,9 @@ extern int __threaded;
|
|||
extern bool __tls_enabled;
|
||||
extern unsigned __tls_index;
|
||||
|
||||
char *__get_tls(void) libcesque nosideeffect;
|
||||
void *__initialize_tls(char[64]);
|
||||
void __install_tls(char[64]);
|
||||
|
||||
#if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__)
|
||||
static noasan inline char *__get_tls_inline(void) {
|
||||
char *tib, *lin = (char *)0x30;
|
||||
if (IsLinux() || IsFreebsd() || IsNetbsd() || IsOpenbsd()) {
|
||||
asm("mov\t%%fs:(%1),%0" : "=a"(tib) : "r"(lin) : "memory");
|
||||
} else {
|
||||
asm("mov\t%%gs:(%1),%0" : "=a"(tib) : "r"(lin) : "memory");
|
||||
if (IsWindows()) {
|
||||
tib = *(char **)(tib + 0x1480 + __tls_index * 8);
|
||||
}
|
||||
}
|
||||
return tib;
|
||||
}
|
||||
#endif /* GNU x86-64 */
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_THREADED_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue