diff options
Diffstat (limited to 'sysdeps/mach/hurd/tls.h')
-rw-r--r-- | sysdeps/mach/hurd/tls.h | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/sysdeps/mach/hurd/tls.h b/sysdeps/mach/hurd/tls.h index dbe73f5035..487c84ae16 100644 --- a/sysdeps/mach/hurd/tls.h +++ b/sysdeps/mach/hurd/tls.h @@ -22,32 +22,13 @@ #ifndef __ASSEMBLER__ # include <stddef.h> +# include <stdint.h> # include <stdbool.h> +# include <sysdep.h> # include <mach/mig_errors.h> # include <mach.h> -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - - -/* Type of the TCB. */ -typedef struct -{ - void *tcb; /* Points to this structure. */ - dtv_t *dtv; /* Vector of pointers to TLS data. */ - thread_t self; /* This thread's control port. */ -} tcbhead_t; - - /* This is the size of the initial TCB. */ # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) @@ -72,5 +53,18 @@ typedef struct #endif /* !ASSEMBLER */ +#ifndef __ASSEMBLER__ +#include <mach/mach_traps.h> +#include <atomic.h> +/* Temporary poor-man's global scope switch support: just busy-waits */ +#define THREAD_GSCOPE_SET_FLAG() \ + asm volatile ("lock incl %0":"=m"(GL(dl_thread_gscope_count))) +#define THREAD_GSCOPE_RESET_FLAG() \ + asm volatile ("lock decl %0":"=m"(GL(dl_thread_gscope_count))) +#define THREAD_GSCOPE_WAIT() \ + while (GL(dl_thread_gscope_count)) { \ + __swtch_pri (0); \ + } +#endif #endif /* tls.h */ |