2022-06-13 18:02:13 +00:00
|
|
|
#ifndef COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_
|
|
|
|
#define COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_
|
2022-09-10 18:55:39 +00:00
|
|
|
#include "libc/intrin/nopl.internal.h"
|
2022-09-10 09:56:25 +00:00
|
|
|
#include "libc/thread/tls.h"
|
2022-06-13 18:02:13 +00:00
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
|
|
|
int __gdtoa_lock(void);
|
|
|
|
int __gdtoa_unlock(void);
|
2022-06-19 08:13:03 +00:00
|
|
|
int __gdtoa_lock1(void);
|
|
|
|
int __gdtoa_unlock1(void);
|
2022-06-13 18:02:13 +00:00
|
|
|
|
2022-06-26 09:58:36 +00:00
|
|
|
#ifdef _NOPL0
|
2022-06-19 08:13:03 +00:00
|
|
|
#define __gdtoa_lock() _NOPL0("__threadcalls", __gdtoa_lock)
|
|
|
|
#define __gdtoa_unlock() _NOPL0("__threadcalls", __gdtoa_unlock)
|
|
|
|
#define __gdtoa_lock1() _NOPL0("__threadcalls", __gdtoa_lock1)
|
|
|
|
#define __gdtoa_unlock1() _NOPL0("__threadcalls", __gdtoa_unlock1)
|
2022-06-13 18:02:13 +00:00
|
|
|
#else
|
2022-06-19 08:13:03 +00:00
|
|
|
#define __gdtoa_lock() (__threaded ? __gdtoa_lock() : 0)
|
|
|
|
#define __gdtoa_unlock() (__threaded ? __gdtoa_unlock() : 0)
|
|
|
|
#define __gdtoa_lock1() (__threaded ? __gdtoa_lock1() : 0)
|
|
|
|
#define __gdtoa_unlock1() (__threaded ? __gdtoa_unlock1() : 0)
|
2022-06-13 18:02:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_THIRD_PARTY_GDTOA_LOCK_H_ */
|