This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

hack to get sysinfo initialized


Yesterday, I managed to boostrap an ia64 machine with the new
light-weight syscall stub.  It's all working very well.  The main
issue I had with glibc was making sure that [r13-8] always contains a
valid sysinfo pointer.  To this end, I had to hack
linuxthreads/{manager,pthread}.c as shown below.  I suspect there is
something else wrong here, but to be honest, I don't quite understand
how the various INIT_TP macros etc.  are intended to be used for the
various configurations.  Would someone be kind enough to enlighten me?

For reference, here are the key-macros that I'm using in
linuxthreads/sysdeps/ia64/tls.h:

#  define TLS_INIT_TP(tcbp, secondcall)			\
  (__thread_self = (tcbp),				\
   THREAD_SELF->p_header.data.sysinfo = GL(dl_sysinfo),	\
   NULL)

#  define INIT_THREAD_SELF(descr, nr) \
  (__thread_self = (struct _pthread_descr_struct *)(descr) + 1)

#  define NONTLS_INIT_TP \
  do { 									\
    static const tcbhead_t nontls_init_tp = { .multiple_threads = 0 };	\
    __thread_self = (__typeof (__thread_self)) &nontls_init_tp;		\
  } while (0)

Thanks!

	--david

Index: linuxthreads/manager.c
===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/manager.c,v
retrieving revision 1.90
diff -u -r1.90 manager.c
--- linuxthreads/manager.c	12 Jan 2003 08:42:38 -0000	1.90
+++ linuxthreads/manager.c	30 Jan 2003 06:28:23 -0000
@@ -645,6 +666,8 @@
 #endif
   new_thread->p_header.data.self = new_thread;
   new_thread->p_header.data.multiple_threads = 1;
+  /* XXX why isn't this done already??? */
+  new_thread->p_header.data.sysinfo = GL(dl_sysinfo);
   new_thread->p_tid = new_thread_id;
   new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
   new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE;
Index: linuxthreads/pthread.c
===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/pthread.c,v
retrieving revision 1.119
diff -u -r1.119 pthread.c
--- linuxthreads/pthread.c	16 Jan 2003 18:16:32 -0000	1.119
+++ linuxthreads/pthread.c	30 Jan 2003 06:28:23 -0000
@@ -353,6 +353,9 @@
 
   self = THREAD_SELF;
 
+  /* XXX why isn't this done already??? */
+  self->p_header.data.sysinfo = GL(dl_sysinfo);
+
   /* The memory for the thread descriptor was allocated elsewhere as
      part of the TLS allocation.  We have to initialize the data
      structure by hand.  This initialization must mirror the struct
@@ -614,6 +617,8 @@
   mgr->p_header.data.tcb = tcbp;
   mgr->p_header.data.self = mgr;
   mgr->p_header.data.multiple_threads = 1;
+  /* XXX why isn't this done already??? */
+  mgr->p_header.data.sysinfo = GL(dl_sysinfo);
   mgr->p_lock = &__pthread_handles[1].h_lock;
 # ifndef HAVE___THREAD
   mgr->p_errnop = &mgr->p_errno;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]