Changeset View
Changeset View
Standalone View
Standalone View
lib/libthr/arch/i386/include/pthread_md.h
Show All 35 Lines | |||||
#define _PTHREAD_MD_H_ | #define _PTHREAD_MD_H_ | ||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <machine/tls.h> | #include <machine/tls.h> | ||||
#define CPU_SPINWAIT __asm __volatile("pause") | #define CPU_SPINWAIT __asm __volatile("pause") | ||||
/* For use in _Static_assert to check structs will fit in a page */ | |||||
#define THR_PAGE_SIZE_MIN PAGE_SIZE | |||||
static __inline struct pthread * | static __inline struct pthread * | ||||
_get_curthread(void) | _get_curthread(void) | ||||
{ | { | ||||
struct pthread *thr; | struct pthread *thr; | ||||
__asm __volatile("movl %%gs:%1, %0" : "=r" (thr) | __asm __volatile("movl %%gs:%1, %0" : "=r" (thr) | ||||
: "m" (*(volatile u_int *)offsetof(struct tcb, tcb_thread))); | : "m" (*(volatile u_int *)offsetof(struct tcb, tcb_thread))); | ||||
return (thr); | return (thr); | ||||
} | } | ||||
#define HAS__UMTX_OP_ERR 1 | #define HAS__UMTX_OP_ERR 1 | ||||
#endif | #endif |