and use it preferentially to a value in pt_uc, clearing it once on the new
stack. Move stores into pt_uc back to before the stack switch; storing
after the stack switch opened a one-instruction race condition where an upcall
that had just started a chain could be preempted again, and would bomb when
restarted due to its pt_uc not yet having been updated. Now that pt_trapuc
is what the upcall code writes to, it is safe to store to pt_uc before
switching stacks.
Remove obsolete pt_sleepuc code.
in switchto targets and vitims, and print it in debug messages (including
indication of whether a context is trap or user context).
Remove obsolete pt_sleepuc handling.
by the kernel. Separating this from pt_uc makes it possible to avoid a race
condition in pt_uc management near the STACK_SWITCH part of pthread__switch()
and pthread__locked_switch().
Remove pt_sleepuc pointer, which was made obsolete by the previous round of
UC juggling but still present in the assembler files.
still possible for multiple threads to write into the same space, but
they shouldn't be able to corrupt the write pointer in the process.
Also, check for pointer-lapping a bit more carefully in the wrap
vs. non-wrap case.
thread from the continuation chain: Not only must it have released all
spinlocks, but it must have signaled completion by finishing pthread__switch
or by having stored into pt_switchto.
Together with the previous pthread_switch.S changes, this fixes a couple of
crasehes caused by race conditions in the examination and use of pt_next,
and by switching to empty pt_switchtouc's.
* In switch-away cases, write PT_SWITCHTO last (after PT_SWITCHTOUC), so
that pthread__resolve_locks() doesn't see an empty SWITCHTOUC value. This
also permits pthread__resolve_locks() to use the presence of PT_SWITCHTO
as a sign that the thread has done all of its necessary chain work.
* Make the return-point of pthread__switch global and visible, so that its
address can be compared to the PC of a thread, again as a sign that its
chain-work is done.
(other architectures in progress, after they get the *previous* asm fix...)
1. add new pthread__abort() and change pthread_assert(0) to it.
2. put constcond in the right place (in the macro).
3. no space after pthread__assert macro.