summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
Commit message (Collapse)AuthorAgeFilesLines
* Add alpha support to libpthread. It compiles but hasn't been tested;deischen2003-08-096-1/+761
| | | | | | there is still some missing kernel support. Reviewed by: marcel
* o Add code to GC freed KSEs and KSE groupsdavidxu2003-08-081-25/+116
| | | | | | | o Fix a bug in kse_free_unlocked(), kcb_dtor shouldn't be called because the KSE is cached and will be resued in _kse_alloc(). Reviewed by: deischen
* Allow gcc driver to process -r option iself, do not use -Wl,-r tokan2003-08-081-1/+1
| | | | | | | bypass it. Doing otherwise did not allow compiler to detect and disable conflicting options generated from specs. Reported by: jake
* Grok async contexts. When a thread is interrupted and an upcallmarcel2003-08-072-9/+41
| | | | | | | | | | | | | | | | | | | | | happens, the context of the interrupted thread is exported to userland. Unlike most contexts, it will be an async context and we cannot easily use our existing functions to set such a context. To avoid a lot of complexity that may possibly interfere with the common case, we simply let the kernel deal with it. However, we don't use the EPC based syscall path to invoke setcontext(2). No, we use the break-based syscall path. That way the trapframe will be compatible with the context we're trying to restore and we save the kernel a lot of trouble. The kind of trouble we did not want to go though ourselves... However, we also need to set the threads mailbox and there's no syscall to help us out. To avoid creating a new syscall, we use the context itself to pass the information to the kernel so that the kernel can update the mailbox. This involves setting a flag (_MC_FLAGS_KSE_SET_MBOX) and setting ifa (the address) and isr (the value).
* Fix a typo. s/Line/Like/deischen2003-08-061-1/+1
|
* Avoid a level of indirection to get from the thread pointer to themarcel2003-08-062-39/+27
| | | | | | | | | | | TCB. We know that the thread pointer points to &tcb->tcb_tp, so all we have to do is subtract offsetof(struct tcb, tcb_tp) from the thread pointer to get to the TCB. Any reasonably smart compiler will translate accesses to fields in the TCB as negative offsets from TP. In _tcb_set() make sure the fake TCB gets a pointer to the current KCB, just like any other TCB. This fixes a NULL-pointer dereference in _thr_ref_add() when it tried to get the current KSE.
* Don't call kse_set_curthread() when scheduling a new bounddeischen2003-08-061-2/+3
| | | | | | | thread. It should only be called by the current kse and never by a KSE on behalf of another. Submitted by: davidxu
* Fix an off by one error in the number of arguments passed tomarcel2003-08-061-1/+1
| | | | | | makecontext(). We only supply 3, not 4. This is mostly harmless, except that on ia64 the garbage can include NaT bits, resulting in NaT consumption faults.
* Define the static TLS as an array of long double. This will guaranteemarcel2003-08-061-2/+6
| | | | | | | that the TLS is 16-byte aligned, as well as guarantee that the thread pointer is 16-byte aligned as it points to struct ia64_tp. Likewise, struct tcb and struct ksd are also guaranteed to be 16-byte aligned (if they weren't already).
* Use auto LDT allocation for i386.deischen2003-08-051-63/+6
|
* Rethink the MD interfaces for libpthread to account fordeischen2003-08-0520-676/+983
| | | | | | | | | archs that can (or are required to) have per-thread registers. Tested on i386, amd64; marcel is testing on ia64 and will have some follow-up commits. Reviewed by: davidxu
* Define THR_GETCONTEXT and THR_SETCONTEXT in terms of the userlandmarcel2003-08-051-4/+5
| | | | | | | | | context functions. We don't need to enter the kernel anymore. The contexts are compatible (ie a context created by getcontext() can be restored by _ia64_restore_context()). While here, make the use of THR_ALIGNBYTES and THR_ALIGN a no-op. They are going to be removed anyway.
* o In _ia64_save_context() clear the return registers except for r8.marcel2003-08-051-13/+25
| | | | | | | | | | We write 1 for r8 in the context so that _ia64_restore_context() will return with a non-zero value. _ia64_save_context() always return 0. o In _ia64_restore_context(), don't restore the thread pointer. It is not normally part of the context. Also, restore the return registers. We get called for contexts created by getcontext(), which means we have to restore all the syscall return values.
* -15 is incorrect to be used to align stack to 16 bytes, use ~15 instead.davidxu2003-08-021-1/+1
|
* Use FSBase to map kse, GCC generates code which uses %fs to access TLS data.davidxu2003-07-311-4/+4
| | | | Reminded by: marcel
* This file hasn't been used for some time; nuke it.deischen2003-07-311-42/+0
|
* Take the same approach for i386 as that for ia64 and amd64. Usedeischen2003-07-315-226/+75
| | | | | | | | | the userland version of [gs]etcontext to switch between a thread and the UTS scheduler (and back again). This also fixes a bug in i386 _thr_setcontext() which wasn't properly restoring the context. Reviewed by: davidxu
* Set GSBASE for kse. Finally make libkse work on AMD64.davidxu2003-07-311-6/+3
|
* Fix some typos, correctly jump into UTS.davidxu2003-07-311-2/+2
|
* sysctlbyname needs size_t type, not int.davidxu2003-07-311-1/+1
|
* Don't forget to unlock the scheduler lock. Somehow this got removeddeischen2003-07-301-0/+1
| | | | | | | from one of my last commits. This only affected priority ceiling mutexes. Pointy hat to: deischen
* Simplify sigwait code a bit by using a waitset and removing oldsigmask.davidxu2003-07-273-22/+17
| | | | Reviewed by: deischen
* Fix typo.davidxu2003-07-261-5/+5
|
* Move idle kse wakeup to outside of regions where locks are held.deischen2003-07-238-73/+130
| | | | | | | | This eliminates ping-ponging of locks, where the idle KSE wakes up only to find the lock it needs is being held. This gives little or no gain to M:N mode but greatly speeds up 1:1 mode. Reviewed & Tested by: davidxu
* Add missing arguments to _amd64_restore_context() when called fromdeischen2003-07-201-2/+4
| | | | THR_SETCONTEXT().
* Override libc function raise(), in threading mode, raise() willdavidxu2003-07-193-0/+56
| | | | | | send signal to current thread. Reviewed by: deischen
* Add some very beta amd64 bits. These will also need some tweaking.deischen2003-07-196-0/+528
|
* Cleanup thread accounting. Don't reset a threads timeslicedeischen2003-07-183-38/+27
| | | | | | | | when it blocks; it only gets reset when it yields. Properly set a thread's default stack guardsize. Reviewed by: davidxu
* Add a preemption point when a mutex or condition variable isdeischen2003-07-182-6/+18
| | | | | | | | | | | | | | | handed-off/signaled to a higher priority thread. Note that when there are idle KSEs that could run the higher priority thread, we still add the preemption point because it seems to take the kernel a while to schedule an idle KSE. The drawbacks are that threads will be swapped more often between CPUs (KSEs) and that there will be an extra userland context switch (the idle KSE is still woken and will probably resume the preempted thread). We'll revisit this if and when idle CPU/KSE wakeup times improve. Inspired by: Petri Helenius <pete@he.iki.fi> Reviewed by: davidxu
* Clean up KSE specific data (KSD) macros a bit.deischen2003-07-181-29/+8
| | | | Reviewed by: davidxu
* o Eliminate upcall for PTHREAD_SYSTEM_SCOPE thread, now itdavidxu2003-07-1716-395/+602
| | | | | | | | | | | | | is system bound thread and when it is blocked, no upcall is generated. o Add ability to libkse to allow it run in pure 1:1 threading mode, defining SYSTEM_SCOPE_ONLY in Makefile can turn on this option. o Eliminate code for installing dummy signal handler for sigwait call. o Add hash table to find thread. Reviewed by: deischen
* Don't resume sigwait thread If signal is masked.davidxu2003-07-091-8/+12
|
* POSIX says if a thread is in sigwait state, although a signal may not indavidxu2003-07-092-11/+29
| | | | | | | | its waitset, but if the signal is not masked by the thread, the signal can interrupt the thread and signal action can be invoked by the thread, sigwait should return with errno set to EINTR. Also save and restore thread internal state(timeout and interrupted) around signal handler invoking.
* Restore signal mask correctly after fork().davidxu2003-07-092-4/+6
|
* Save and restore thread's error code around signal handling.davidxu2003-07-091-1/+2
| | | | Reviewed by: deischen
* Correctly print signal mask, the bug was introduced by cut and pastedavidxu2003-07-071-11/+20
| | | | in last commit.
* Add a newline to debug message.davidxu2003-07-071-1/+1
|
* Avoid accessing user provided parameters in critical region.davidxu2003-07-079-46/+65
| | | | Reviewed by: deischen
* Print thread's scope, also print signal mask for every thread and printdavidxu2003-07-071-17/+13
| | | | it in one line.
* Correctly lock/unlock signal lock. I must be in bad state, need to sleep.davidxu2003-07-041-1/+2
|
* Always check and restore sigaction previously set, also access user parameterdavidxu2003-07-041-4/+7
| | | | outside of lock.
* If select() is only used for sleep, convert it to nanosleep,davidxu2003-07-031-4/+9
| | | | it only need purely wait in user space.
* Check if thread is in critical region, only testing check_pendingdavidxu2003-07-031-1/+2
| | | | is not enough.
* Style.ru2003-07-021-2/+2
|
* Take thr_support.c out of SRCS so that it does not end up in libraries.ru2003-07-022-3/+8
| | | | | | Record the missing dependency of thr_libc.So on the libc_pic.a library. OK'ed by: kan
* Set unlock_mutex to 1 after locked mutex.davidxu2003-07-021-2/+4
| | | | | Use THR_CONDQ_CLEAR not THR_COND_SET in cond_queue_deq, current cond_queue_deq is not used.
* Fix typo.davidxu2003-07-021-1/+1
|
* Unbreak "make checkdpadd".ru2003-07-011-1/+1
|
* Axe AINC.ru2003-07-011-1/+0
| | | | Submitted by: bde
* Because there are only _SIG_MAXSIG elements in thread siginfo array,davidxu2003-06-303-16/+16
| | | | use [signal number - 1] as subscript to access the array.
OpenPOWER on IntegriCloud