* mach/errsystems.awk: Include <errno.h> in generated output.

This commit is contained in:
Roland McGrath 2003-02-16 03:55:27 +00:00
parent 8321ef15ae
commit b0104b6f8d
4 changed files with 40 additions and 13 deletions

View File

@ -3,6 +3,8 @@
* sysdeps/mach/hurd/tls.h: New file. * sysdeps/mach/hurd/tls.h: New file.
* sysdeps/mach/hurd/i386/tls.h: New file. * sysdeps/mach/hurd/i386/tls.h: New file.
* mach/errsystems.awk: Include <errno.h> in generated output.
* sysdeps/mach/Makefile (mach-before-compile rule): Pass generating=t, * sysdeps/mach/Makefile (mach-before-compile rule): Pass generating=t,
use target mach-before-compile instead of generated. use target mach-before-compile instead of generated.
(mach-before-compile): New target. (mach-before-compile): New target.

View File

@ -1,6 +1,8 @@
BEGIN { BEGIN {
print "#include <mach/error.h>\n#include <errorlib.h>"; print "#include <errno.h>";
print "#define static static const" print "#include <mach/error.h>";
print "#include <errorlib.h>";
print "#define static static const";
nsubs = split(subsys, subs); nsubs = split(subsys, subs);
while (nsubs > 0) printf "#include \"%s\"\n", subs[nsubs--]; while (nsubs > 0) printf "#include \"%s\"\n", subs[nsubs--];
print "\n\n\ print "\n\n\

View File

@ -28,22 +28,28 @@
/* Indiciate that TLS support is available. */ /* Indiciate that TLS support is available. */
# define USE_TLS 1 # define USE_TLS 1
/* The TCB can have any size and the memory following the address the
thread pointer points to is unspecified. Allocate the TCB there. */
# define TLS_TCB_AT_TP 1
# ifndef ASSEMBLER
/* Use i386-specific RPCs to arrange that %gs segment register prefix /* Use i386-specific RPCs to arrange that %gs segment register prefix
addresses the TCB in each thread. */ addresses the TCB in each thread. */
# include <mach/i386/mach_i386.h> # include <mach/i386/mach_i386.h>
#ifndef HAVE_I386_SET_GDT # ifndef HAVE_I386_SET_GDT
# define __i386_set_gdt(thr, sel, desc) ((thr), (sel), (desc), MIG_BAD_ID) # define __i386_set_gdt(thr, sel, desc) ((thr), (sel), (desc), MIG_BAD_ID)
#endif # endif
static inline int _hurd_tls_init (tcbhead_t *, int secondcall) # include <errno.h>
__attribute__ ((unused)); # include <assert.h>
static inline const char * static inline const char * __attribute__ ((unused))
_hurd_tls_init (tcbhead_t *tcb, int secondcall) _hurd_tls_init (tcbhead_t *tcb, int secondcall)
{ {
const unsigned int base = (unsigned int) tcb; const unsigned int base = (unsigned int) tcb;
const struct descriptor desc = struct descriptor desc =
{ /* low word: */ { /* low word: */
0xffff /* limit 0..15 */ 0xffff /* limit 0..15 */
| (base << 16) /* base 0..15 */ | (base << 16) /* base 0..15 */
@ -62,7 +68,7 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
/* Get the first available selector. */ /* Get the first available selector. */
int sel = -1; int sel = -1;
error_t err = __i386_set_gdt (tcb->self, &sel, &desc); error_t err = __i386_set_gdt (tcb->self, &sel, desc);
if (err == MIG_BAD_ID) if (err == MIG_BAD_ID)
{ {
/* Old kernel, use a per-thread LDT. */ /* Old kernel, use a per-thread LDT. */
@ -93,7 +99,7 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
} }
else else
{ {
error_t err = __i386_set_gdt (tcb->self, &sel, &desc); error_t err = __i386_set_gdt (tcb->self, &sel, desc);
assert_perror (err); assert_perror (err);
return "i386_set_gdt failed"; return "i386_set_gdt failed";
} }
@ -116,7 +122,7 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
# define THREAD_DTV() \ # define THREAD_DTV() \
({ void *_dtv; __asm__ ("movl %%gs:0, %0" : "=r" (_dtv)); _dtv; }) ({ void *_dtv; __asm__ ("movl %%gs:0, %0" : "=r" (_dtv)); _dtv; })
# endif /* !ASSEMBLER */
#endif /* HAVE_TLS_SUPPORT */ #endif /* HAVE_TLS_SUPPORT */
#endif /* i386/tls.h */ #endif /* i386/tls.h */

View File

@ -20,7 +20,12 @@
#ifndef _TLS_H #ifndef _TLS_H
#define _TLS_H #define _TLS_H
#ifdef HAVE_TLS_SUPPORT #if defined HAVE_TLS_SUPPORT && !defined ASSEMBLER
# include <stddef.h>
# include <mach/mig_errors.h>
# include <mach.h>
/* Type for the dtv. */ /* Type for the dtv. */
typedef union dtv typedef union dtv
@ -38,6 +43,7 @@ typedef struct
thread_t self; /* This thread's control port. */ thread_t self; /* This thread's control port. */
} tcbhead_t; } tcbhead_t;
/* This is the size of the initial TCB. */ /* This is the size of the initial TCB. */
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
@ -50,6 +56,17 @@ typedef struct
/* Alignment requirements for the TCB. */ /* Alignment requirements for the TCB. */
# define TLS_TCB_ALIGN TLS_INIT_TCB_ALIGN /* XXX */ # define TLS_TCB_ALIGN TLS_INIT_TCB_ALIGN /* XXX */
/* Install the dtv pointer. The pointer passed is to the element with
index -1 which contain the length. */
# define INSTALL_DTV(descr, dtvp) \
((tcbhead_t *) (descr))->dtv = (dtvp) + 1
/* Return dtv of given thread descriptor. */
# define GET_DTV(descr) \
(((tcbhead_t *) (descr))->dtv)
#endif /* HAVE_TLS_SUPPORT */ #endif /* HAVE_TLS_SUPPORT */
#endif /* tls.h */ #endif /* tls.h */