~ubuntu-branches/ubuntu/precise/eglibc/precise

« back to all changes in this revision

Viewing changes to sysdeps/mach/hurd/i386/tls.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-10-04 17:48:26 UTC
  • mfrom: (216.1.23 oneiric)
  • Revision ID: package-import@ubuntu.com-20111004174826-2cyb9ewn3ucymlsx
Tags: 2.13-20ubuntu5
libc6-dev: Don't break the current {gnat,gcj}-4.4-base versons. LP: #853688.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Definitions for thread-local data handling.  Hurd/i386 version.
2
 
   Copyright (C) 2003, 2004, 2006, 2007, 2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
3
3
   This file is part of the GNU C Library.
4
4
 
5
5
   The GNU C Library is free software; you can redistribute it and/or
20
20
#ifndef _I386_TLS_H
21
21
#define _I386_TLS_H
22
22
 
 
23
#if defined HAVE_TLS_SUPPORT
23
24
 
24
25
/* Some things really need not be machine-dependent.  */
25
 
#include <sysdeps/mach/hurd/tls.h>
 
26
# include <sysdeps/mach/hurd/tls.h>
26
27
 
27
28
/* The TCB can have any size and the memory following the address the
28
29
   thread pointer points to is unspecified.  Allocate the TCB there.  */
29
 
#define TLS_TCB_AT_TP   1
 
30
# define TLS_TCB_AT_TP  1
30
31
 
31
 
#ifndef __ASSEMBLER__
 
32
# ifndef __ASSEMBLER__
32
33
 
33
34
/* Use i386-specific RPCs to arrange that %gs segment register prefix
34
35
   addresses the TCB in each thread.  */
41
42
# include <errno.h>
42
43
# include <assert.h>
43
44
 
44
 
# define HURD_TLS_DESC_DECL(desc, tcb)                                        \
 
45
#define HURD_TLS_DESC_DECL(desc, tcb)                                         \
45
46
  struct descriptor desc =                                                    \
46
47
    {                           /* low word: */                               \
47
48
      0xffff                    /* limit 0..15 */                             \
122
123
# define TLS_INIT_TP_EXPENSIVE 1
123
124
 
124
125
/* Return the TCB address of the current thread.  */
125
 
# define THREAD_SELF                                                          \
 
126
# define THREAD_SELF                                                          \
126
127
  ({ tcbhead_t *__tcb;                                                        \
127
128
     __asm__ ("movl %%gs:%c1,%0" : "=r" (__tcb)                               \
128
129
              : "i" (offsetof (tcbhead_t, tcb)));                             \
134
135
                   : : "ir" (dtvp), "i" (offsetof (tcbhead_t, dtv))); })
135
136
 
136
137
/* Return the address of the dtv for the current thread.  */
137
 
# define THREAD_DTV()                                                         \
 
138
# define THREAD_DTV()                                                         \
138
139
  ({ dtv_t *_dtv;                                                             \
139
140
     asm ("movl %%gs:%P1,%0" : "=q" (_dtv) : "i" (offsetof (tcbhead_t, dtv)));\
140
141
     _dtv; })
141
142
 
142
 
# include <mach/machine/thread_status.h>
 
143
#include <mach/machine/thread_status.h>
143
144
 
144
145
/* Set up TLS in the new thread of a fork child, copying from our own.  */
145
146
static inline error_t __attribute__ ((unused))
164
165
  return err;
165
166
}
166
167
 
167
 
#endif  /* !__ASSEMBLER__ */
 
168
# endif /* !__ASSEMBLER__ */
 
169
#endif /* HAVE_TLS_SUPPORT */
168
170
 
169
171
#endif  /* i386/tls.h */