Commit Graph

51 Commits

Author SHA1 Message Date
obrien
d3499a87ee style.Makefile(5) 2008-02-13 05:25:43 +00:00
obrien
d8f894d961 style(9) 2008-02-13 05:12:05 +00:00
davidxu
ca27871833 - Remove variable _thr_scope_system, all threads are system scope.
- Rename _thr_smp_cpus to boolean variable _thr_is_smp.
- Define CPU_SPINWAIT macro for each arch, only X86 supports it.
2006-12-15 11:52:01 +00:00
marcel
d21513035e Stylize: avoid using a global register variable. 2006-09-01 21:01:11 +00:00
marcel
2d71eb396a Rename TLS_TP_OFFSET back to TP_OFFSET. The former clashes with rtld. 2006-09-01 06:36:00 +00:00
marcel
1125db3243 Stylize. 2006-09-01 06:15:00 +00:00
marcel
6a1762d589 Stylize. 2006-08-31 23:31:18 +00:00
marcel
5ffd88a18e TLS fixes:
o  The TLS pointer (r2) points 0x7000 after the *end* of the TCB.
o  _rtld_allocate_tls() gets a pointer to the current TCB, not the
   current TLS pointer.
o  _rtld_free_tls() gets the size of the TCB structure.
2006-08-31 19:16:47 +00:00
marcel
c088f26c25 Fix harmless bug: sizeof(tcb) equals sizeof(void*) not sizeof(struct tcb).
The argument is (currently) not used by _rtld_free_tls().
2006-08-31 19:06:30 +00:00
marcel
4736b1fdce o Set TP using inline assembly to avoid dead code elimination.
o  Eliminate _tcb.
2006-08-30 03:31:32 +00:00
ru
4d582ffe09 Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
davidxu
f921934131 Remove declaration of _thr_initial from MD header file, it is no longer
needed.
2006-04-04 03:35:26 +00:00
davidxu
8bff50a485 Simplify _get_curthread() and _tcb_ctor because libc and rtld now
already allocate thread pointer space in tls block for initial thread.
Only i386 and amd64 have been done, others still have to be tested.
2006-04-04 03:26:06 +00:00
davidxu
f04292bb19 Remove functions i386_get_gsbase and i386_set_gsbase, they were already
in libc.
2006-01-07 06:01:43 +00:00
davidxu
2039945090 Remove unused variable.
Reviewed by: cognet
2005-10-29 13:40:31 +00:00
davidxu
3882c07f39 Kill unused variable declaration. 2005-10-29 03:08:43 +00:00
davidxu
094168eea8 Remove COMPAT_32BIT, it is no longer needed. 2005-04-27 01:29:03 +00:00
davidxu
9f7f211673 Remove unused variable. 2005-04-23 03:34:43 +00:00
davidxu
8d38949442 Now libthr only uses GDT based tls on i386. using LDT can only increase
clock cycles and has 8191 threads limitation.
2005-04-23 03:31:59 +00:00
davidxu
d75a2adc3f Add i386_get_gsbase, i386_set_gsbase since old libc doesn't have the
functions, otherwise user ports have to be rebuilt.
2005-04-23 02:14:38 +00:00
peter
c1d476c931 Adapt the libpthread patch for using i386_set_gsbase() to libthr. 2005-04-14 00:44:07 +00:00
cognet
c7b04f713a Use the new atomic_cmpset_32(). 2005-04-07 22:06:05 +00:00
davidxu
f066519e91 Import my recent 1:1 threading working. some features improved includes:
1. fast simple type mutex.
 2. __thread tls works.
 3. asynchronous cancellation works ( using signal ).
 4. thread synchronization is fully based on umtx, mainly, condition
    variable and other synchronization objects were rewritten by using
    umtx directly. those objects can be shared between processes via
    shared memory, it has to change ABI which does not happen yet.
 5. default stack size is increased to 1M on 32 bits platform, 2M for
    64 bits platform.
As the result, some mysql super-smack benchmarks show performance is
improved massivly.

Okayed by: jeff, mtm, rwatson, scottl
2005-04-02 01:20:00 +00:00
peter
5d3a1b43b0 Fix inverted #ifdef that I added. Who had the pointy hat last?
Submitted by:  kan
2004-12-06 20:41:09 +00:00
peter
6185c69a2b Use the recently exposed fs/gs set functions when compiling libthr to
run as a 32 bit support library for an amd64 kernel.  32 bit consumers of
libthr have zero chance of running on an amd64 kernel since we don't
implement the i386_set_ldt() family of functions.  Note that this commit
doesn't make it actually work, it just removes one more obstacle.
2004-11-06 03:30:53 +00:00
davidxu
1d227ebfe2 Adjust code to support AMD64, on AMD64, thread needs to set fsbase by
itself before it can execute any other code, so new thread should be
created with all signals are masked until after fsbase is set.
2004-08-19 23:49:04 +00:00
davidxu
be1d6f4eb1 Add AMD64 support code. 2004-08-19 23:41:12 +00:00
dfr
eebd52f2bb Add TLS support for libthr on i386. 2004-08-15 16:21:30 +00:00
markm
0b0ae8e16e Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64
2004-03-05 08:10:19 +00:00
grehan
a0da296615 libthr powerpc support.
Submitted by:  Suleiman Souhlal <refugee@segfaulted.com>
Tested with: most libpthread tests, Apache 'worker' MDM
2004-03-02 06:25:20 +00:00
mtm
6e3062e1d3 Bump up the maximum number concurrent threads on x86. 2004-02-01 15:33:01 +00:00
mtm
9449459c17 Use dynamic instead of static LDT allocation.
Approved by: re (scottl)
2003-12-02 16:00:26 +00:00
marcel
e6af3a1393 Implement _get_curthread and _set_curthread. We use GCCs builtin
function this, which expands to PAL calls (rduniq and wruniq).
This needs adjustment when TLS is implemented.
2003-07-24 07:51:49 +00:00
mtm
85a3d8b88c This commit was generated by cvs2svn to compensate for changes in r117783,
which included commits to RCS files with non-trunk default branches.
2003-07-19 15:57:52 +00:00
mtm
73635d5ae5 The MD framework for libthr on alpha 2003-07-19 15:57:52 +00:00
mtm
dffd0ee5d1 The move to _retire() a thread in the GC instead of in the thread's
exit function has invalidated the need for _spin[un]lock_pthread().
The _spin[un]lock() functions can now dereference curthread without
the danger that the ldtentry containing the pointer to the thread
has been cleared out from under them.
2003-06-29 00:12:40 +00:00
obrien
5e3258c2fc .S comments must be C comments, not ASM ones. 2003-06-02 02:32:56 +00:00
mtm
c9c9423632 Missing unlock.
Approved by:	re/jhb
2003-05-29 20:49:17 +00:00
mtm
d8e0ed54e3 Return gracefully, rather than aborting, when the maximum concurrent
threads per process has been reached. Return EAGAIN, as per spec.

Approved by:	re/blanket libthr
2003-05-25 22:40:57 +00:00
marcel
06e2620846 The struct mcontext has changed. It's using the register sets. Bring
this in line.
2003-05-25 06:49:19 +00:00
mtm
3c92bdad80 Add two functions: _spinlock_pthread() and _spinunlock_pthread()
that take the address of a struct pthread as their first argument.
_spin[un]lock() just become wrappers arround these two functions.
These new functions are for use in situations where curthread can't be
used. One example is _thread_retire(), where we invalidate the array index
curthread uses to get its pointer..

Approved by:	re/blanket libthr
2003-05-23 23:39:31 +00:00
mtm
6356a9c88e Make WARNS2 clean. The fixes mostly included:
o removed unused variables
	o explicit inclusion of header files
	o prototypes for externally defined functions

Approved by:    re/blanket libthr
2003-05-23 09:48:20 +00:00
mtm
e91b0202f9 o Make the defenition of _set_curthread() match its declaration
in thr_private.h

o Lock down the ldt_entries array and ldt_free, which points to
  the next free slot. As noted in the comments, it's necessary
  to special case the initial_thread because %gs is not setup
  for it yet. This is ok because that early in the program there
  won't be any reentrancy issues anyways.

Approved by:	re/blanket libthr
2003-05-21 08:21:24 +00:00
mtm
bbd203a216 Fix a null dereference leading to a core dump when
the number of threads exceeds the number of open slots
in ldt_entries[].

Approved by:	markm (mentor)(implicit)
Reviewed by:	jeff
2003-05-06 02:33:49 +00:00
marcel
8b257c5e50 Add support for ia64.
Note that the tp register (r13) is reserved as the TLS pointer in
the same way that that gp register (r1) is reserved as the global
pointer. This implementation uses the tp register to point to the
thread structure used by the threads implementation. This is not
in violation with the runtime specification provided the TLS is
a fixed distance from the thread structure. This is only an issue
when code used the __thread keyword to create TLS. This is not
supported at the moment.
2003-04-20 03:06:42 +00:00
jake
5b2b2811a1 - Pass a ucontext_t to _set_curthread. If non-NULL the new thread is set
as curthread in the new context, so that it will be set automatically when
  the thread is switched to.  This fixes a race where we'd run for a little
  while with curthread unset in _thread_start.

Reviewed by:	jeff
2003-04-03 03:34:50 +00:00
jeff
de8dcf74da - Don't overrun the ldt buffer.
Submitted by:	gordan@freebsd.org
2003-04-02 22:53:52 +00:00
jake
58f97af564 Implement _get_curthread and _set_curthread. This is especially easy. 2003-04-02 08:15:07 +00:00
jake
dc2ed57595 Add MD makefile. 2003-04-01 23:52:24 +00:00
jeff
e8890ccacd - Adjust the makefiles so we have a per architecture makefile. 2003-04-01 07:07:38 +00:00