Commit Graph

396 Commits

Author SHA1 Message Date
wiz
85746c6759 Spell interrupt with two rs. From Peter Postma. 2004-02-24 15:16:04 +00:00
wiz
f05e6f1a3a occured -> occurred. From Peter Postma. 2004-02-24 15:12:51 +00:00
wiz
d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
nathanw
94fc83a6be Add ucontext conversion macros for an "extra" register set. 2004-02-11 21:04:10 +00:00
nathanw
0a6afcc70d Rename pt_stacksize, pt_stacksize_lg, and pt_stackmask to pthread_*. External
symbols can't start with pt_, as that is in the application namespace.
2004-02-02 20:36:18 +00:00
kleink
9f0429b6cc ; may be a comment character in assembly, use \n as a separator instead.
This instance spotted by Martin Husemann.
2004-01-19 16:18:33 +00:00
cl
359b937c80 - delay making a thread unblocked until it's put on the runqueue.
- simplify handling of blocked idle threads.

This should fix the ``assertion "target->pt_state != PT_STATE_RUNNING
|| target->pt_blockgen != target->pt_unblockgen" failed'' problem
reported by Marc Recht and Steve Bellovin on current-users.

Also g/c unused pthread__sched_bulk call left over from pthread_sa.c
rev. 1.22 change.
2004-01-16 15:23:31 +00:00
cl
c8017c0dc6 - add deadlock check to pthread_rwlock_wrlock and pthread_rwlock_timedwrlock
- return EPERM when unlocking a lock which isn't held
=> prevent the failure in PR 24023, where the citrus code had a deadlocking
   code path

- remove deadlock check in pthread_rwlock_tryrdlock, return EBUSY instead
=> makes pthread_rwlock_tryrdlock standards compliant
2004-01-09 18:08:28 +00:00
cl
f35871411a make siglongjmp out of a signal handler work:
- strong alias __sigprocmask14 to pthread_sigmask
- call _sys___sigprocmask14 where appropriate
- make pthread_sigmask not set the signal mask lazily when pthreads
  aren't started yet
2004-01-02 19:24:44 +00:00
cl
33622a5943 userland part of no-syscall upcall stack return
- add pt_stackinfo to struct __pthread_st
- add pthread__stackinfo_offset returning the offset from ss_sp to
  pt_stackinfo
- pass stackinfo_offset to sa_register and set SA_FLAG_STACKINFO to
  make the kernel use it
- call pthread__sa_recycle in pthread__resolve_locks; g/c recycleq and
  pthread__recycle_bulk
- return stack in pthread__sa_recycle by incrementing sasi_stackgen
- make pthread__sa_recycle debugging output formatting conditional on
  pthread__debug_newline
2004-01-02 19:14:00 +00:00
cl
90e89977d4 - libc.so.12.109 and libpthread.so.0.4
- add ssize_t stackinfo_offset argument to sa_register syscall
- remove sa_unblockyield syscall
- make __sigprocmask14 syscall weak
- in pthread__sa_start: catch up with 4-argument sa_register syscall
2004-01-02 18:56:39 +00:00
cl
91d9c8c22f pthread__upcall: output LWPid in SA_UPCALL_BLOCKED case 2004-01-02 14:29:22 +00:00
cl
677748c645 logging/debugging changes:
- add PTHREAD_PID_DEBUG which prints the pid before each debuglog line
- output thread returned in pthread__next
- add asserts in pthread__sched akin to asserts in pthread__sched_bulk:
  check if scheduled thread is at front/end of queue
- pthread__upcall: output event/interrupted LWP count instead of LWPid
  of the first event/interrupted LWP (since unblock upcalls can have
  multiple event LWPs).
- pthread__find_interrupted: output LWPid here
2004-01-02 14:13:16 +00:00
lukem
d597f546a1 Add dependencies to assym.h on:
pthread.h pthread_int.h pthread_md.h
Should help prevent the problem I raised in [kern/23946], based on
a hint from Christian Limpach.

Add MAKEVERBOSE support.
2004-01-02 01:37:53 +00:00
cl
82b6b2dbda Handle block/unblock for threads in critical section without
sa_unblockyield.

XXX g/c sa_unblockyield in kernel later
2003-12-31 16:45:48 +00:00
christos
b7559f8576 PR/23791: Patrick Latify: Fix memory leak on thread creation failure. 2003-12-18 15:39:56 +00:00
jmc
d9948df6dd Clean up tmp files on exit. Fixes PR#23723 2003-12-15 20:07:39 +00:00
christos
1edf98ec41 Add pthread_{g,s}etschedparam, that do nothing. 2003-12-07 20:29:07 +00:00
cl
2c9b7b1eb7 Set default stack size to the current limit on the stack size as set
with the shell's command to change limits.  Make the PTHREAD_STACKSIZE
environment variable override the default stack size.  The old fixed
stack size behaviour can be enable with PT_FIXEDSTACKSIZE_LG when building
libpthread.
2003-11-27 16:30:54 +00:00
he
ea56bcee84 Hide the register number constants behind an _R_ prefix, and also
rename FPBASE to _FPBASE, so that we avoid polluting the user's
name space when e.g. <sys/ptrace.h> is included.  Previously, the
PC symbol in mips/regnum.h would conflict with the declaration of
the external variable by the same name in termcap.h, as discovered
by the ``okheaders'' regression test.
2003-11-26 08:36:49 +00:00
cl
11127744bf Save the old mask in the old context, not in the new one. 2003-11-25 23:55:27 +00:00
cl
d109665f1d Honor SA_NODEFER in pthread__deliver_signal(). This should help code which
makes a longjmp out of a signal handler.

Also add missing si_code argument to debugging printf in pthread__kill().
2003-11-25 22:45:33 +00:00
christos
0446e60323 Update list of items. 2003-11-25 22:44:16 +00:00
christos
adfca9e3e4 This is not needed anymore. 2003-11-25 22:41:12 +00:00
christos
5077d05f7b GC sigcontext<->mcontext code and __HAVE_SIGINFO. All supported archs have
siginfo implemented.
2003-11-25 22:36:32 +00:00
christos
69658517e0 - don't store sigmask on the stack, we could store it in the right place
[in the context]
- this has the side effect of fixing the problem of the signal mask not
  being preserved properly upon signal return, found and fixed by cl.
- add si_code to the tramp debugging output (requested by cl).
2003-11-25 22:26:44 +00:00
christos
6477735848 m68k does not sigcontext<->mcontext anymore. 2003-11-25 21:27:30 +00:00
cl
774b4b225b Update mutex/rwlock/sem code to match recent change in cond code. 2003-11-24 23:54:13 +00:00
cl
4f8ea51319 add CONSTCOND in constant condition. 2003-11-24 23:23:17 +00:00
nathanw
250e7bbf8e Fix a race between timed wait callbacks and manual signal/broadcasting
accidentally introduced in rev. 1.5.

Noted by Christian Limpach.
2003-11-24 22:54:31 +00:00
nathanw
cdf7f99ee6 Manually inline pthread__testcancel in these routines; two function
calls' worth of overhead per cancellable syscall is overkill.
2003-11-21 23:03:13 +00:00
nathanw
4e755ddba8 Prevent ptc_mutex from remaining set if a CV sleep is woken by
cancellation:

 * Arrange to not set ptc_mutex until after the pre-sleep cancellation
   test.

 * In the post-sleep cancellation test, check if there are no more
   sleepers and clear ptc_mutex if so.

While here, sprinkle some __predict_false() around the cancellation
tests.
2003-11-21 22:08:00 +00:00
uwe
6d08061385 Do not move incoming paramters to callee-save registers when not
necessary.  Saves about a dozen of instructions.
2003-11-20 17:55:11 +00:00
uwe
4b13bb93a0 Follow-up to previous. In pthread__signal_tramp() maskp is below
siginfo on the stack, so get it from there.  ss_sp no longer points to
the the mask.  Pointed out by cl@.
2003-11-20 17:45:00 +00:00
uwe
b3c165e505 Add _INITCONTEXT_U_MD, we need to clean _REG_SR. 2003-11-20 17:38:08 +00:00
uwe
f5cd7f26ed Undo previous. In pthread__deliver_signal set uc->uc_stack.ss_sp = uc;
(as it used to be before 1.1.2.12) so that makecontext doesn't stomp
on the data we allocated on the stack.  Correct the debugging printf
to print olduc instead of target->pt_uc (we have pt_trapuc now, and
olduc can be pt_trapuc).
2003-11-20 17:16:41 +00:00
yamt
d7b65981fb pthread__deliver_signal: swap oldmask and siginfo so that signal
handler's stack doesn't stomp siginfo.
this also fixes !__HAVE_SIGINFO, in that case
pthread__signal_tramp assumes uc->uc_stack.ss_sp points the old
signal mask.

pointed by uwe@.
2003-11-20 15:46:42 +00:00
uwe
1e78682585 In pthread__locked_switch set self->pt_uc only when the context is inited.
In STACK_SWITCH subtract STACKSPACE, not add it (it's zero for now anyway).
2003-11-20 03:31:02 +00:00
uwe
024d461f8f First cut at pthreads MD code for sh3. Based on m68k version.
Regression tests still failing: sem, sigalarm.
2003-11-18 03:11:41 +00:00
uwe
f9cb911365 Add necessary symbols. 2003-11-18 03:07:29 +00:00
thorpej
88ed237274 Bump libc to 12.107 and libpthread to 0.3 for fsync_range(2). 2003-11-18 01:00:19 +00:00
thorpej
137c808bb8 Userland portion of fsync_range(2), written by Bill Studenmund, and
contributed by Wasabi Systems, Inc.
2003-11-18 00:56:56 +00:00
cl
196dbdcd2b - delay processing unblocked threads until after locks are resolved:
without the blocked/unblocked upcall ordering, an interrupted blocked
  upcall might put the blocked thread on the intqueue because it needs
  to be continued.  With the delayed processing, we avoid putting such a
  thread twice on the runqueue.
- fix putting a thread on the intqueue when it needs to be continued
  after it blocked.

Also check return value when returning a single stack.
2003-11-17 22:59:00 +00:00
uwe
764c596c3f Cause SIGTRAP if NOTREACHED code is reached. 2003-11-17 22:38:11 +00:00
cl
803f13c062 check deferred signals for all unblocked threads 2003-11-12 22:21:21 +00:00
wiz
c3c78af0ec Various fixes. 2003-11-12 11:58:34 +00:00
christos
c8608b903b Document pthread_attr_setcreatesuspend_np, pthread_suspend_np, pthread_resume_np 2003-11-12 02:44:22 +00:00
martin
3e8ef3d56a Fix ucontext conversion macros. From Christian Limpach. 2003-11-11 16:21:05 +00:00
martin
d708163f7f All the ucontext <-> {fp}reg macros were slightly simplistic and untested
before (old gdb support on sparc did not use this).
Pointed out by Christian Limpach.
2003-11-10 07:52:52 +00:00
christos
38b1c6f405 Add:
int    pthread_attr_setcreatesuspend_np(pthread_attr_t *);
int    pthread_suspend_np(pthread_t);
int    pthread_resume_np(pthread_t);

needed for java. Approved and fixed by cl.
2003-11-09 18:56:48 +00:00
fvdl
c4e432f3bd Make register usage more consistent, also in comparison with the i386
version, for easier maintenance.
2003-11-08 21:46:42 +00:00
fvdl
127827f46e Restore %rax correctly during a full context restore (oops). 2003-11-08 21:45:59 +00:00
wiz
85cc64da0f Typo; from Jared Yanovich via jmc@openbsd. 2003-11-02 11:18:10 +00:00
yamt
71b290e975 use explicit "l" suffixes. (eg. lea -> leal) 2003-10-30 13:56:37 +00:00
wiz
bc81ecac30 sigwait(2), not (3). 2003-10-30 12:57:11 +00:00
jdolecek
e2e1314ccd bump date too 2003-10-30 11:53:33 +00:00
jdolecek
f65cf67b62 xref sigwait(3) 2003-10-30 11:51:42 +00:00
cl
812a254c5d remove incorrect assert:
regular threads can block in the kernel while holding (libpthread) locks
and have to be continued

XXX if the blocked upcall is preempted, the blocked threads syscall
XXX return value can get lost
2003-10-29 18:53:34 +00:00
lukem
f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
yamt
2016949b00 update a comment. 2003-10-24 17:35:22 +00:00
fvdl
c2405107f1 Correct and simplify computing the return point; just use PC-relative
addressing.
2003-10-20 14:50:18 +00:00
fvdl
b30e737545 Make sure the stack stays aligned. 2003-10-19 21:45:03 +00:00
yamt
5cd18e71cc in pthread__deliver_signal(),
copy siginfo_t into the stack of the target thread
rather than relying on the luck that on-stack siginfo_t stay valid.
2003-10-16 13:38:28 +00:00
chs
f58c80fc8f fix typo in previous. 2003-10-12 00:25:25 +00:00
wiz
37ac1db454 available, not avaliable. From miod@openbsd. 2003-09-29 09:50:21 +00:00
nathanw
9839173881 Don't include <machine/lock.h> anymore; instead, we now get
__cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED from <sys/types.h>.
Should prevent the massive namespace pollution by way of dragging in
many MD headers that has been observed to break stuff.
2003-09-26 22:48:23 +00:00
cl
bfa716044e SA_SIGINFO support for m68k (libpthread) 2003-09-22 14:45:48 +00:00
cl
c6de69ee49 fix pt_trapuc handling errors:
- movl to address register doesn't set flags (add explicit test)
- clr only clears a word (use clrl)
2003-09-17 20:08:07 +00:00
cl
5c40d56471 fix SA/pthread pagefault failure:
- prevent BLOCKED upcalls on double page faults and during upcalls
- make libpthread handle blocked threads which hold locks
- prevent UNBLOCKED upcalls from overtaking their BLOCKED upcall
this adds a new syscall sa_unblockyield
see also http://mail-index.netbsd.org/tech-kern/2003/09/15/0020.html
2003-09-16 13:51:31 +00:00
christos
86d645082f fix syntax; thanks aymeric 2003-09-13 17:19:55 +00:00
christos
d1bb4290e8 explicitly use a sigset_t * variable to recover the signal mask pointer. 2003-09-13 15:26:38 +00:00
drochner
45a9abb6af make it compile with PTHREAD_SIG_DEBUG again 2003-09-12 15:31:00 +00:00
kleink
8742dcef75 Fix pasto in previous. 2003-09-12 10:10:39 +00:00
christos
138df80b74 convert to use siginfo/ucontext style of signal delivery instead of
sigcontext. Approved by nathanw.
2003-09-12 00:37:17 +00:00
christos
338cc5f663 sprinkle ARGSUSED for good cheer. 2003-09-11 21:51:57 +00:00
cl
89d0cfd21f Remove possible race condition in upcall recycling. 2003-09-07 14:47:44 +00:00
uwe
b5623b232f Use delay slot in STACK_SWITCH (catching up with sparc64 changes). 2003-09-07 02:08:31 +00:00
uwe
7d522ba08b Use correct context to switch to.
From sparc64 fix by Andrey Petrov <petrov@netbsd>.
2003-09-07 01:54:47 +00:00
petrov
0d472e116b typo in previous commit, annul isn't good there,
noticed by Eduardo Horvath.
2003-08-26 17:50:06 +00:00
petrov
2cae323122 Use branch-slot in STACK_SWITCH, suggested by Martin Husemann. 2003-08-25 23:00:23 +00:00
petrov
c139cd4893 Use correct context to switch to. 2003-08-25 22:48:24 +00:00
ragge
644236bf71 Add PT_TRAPUC and pthread__switch_return_point.
Not tested (as most of the pthread stuff on vax) but at least
allow the system to compile.
2003-08-25 20:32:13 +00:00
nathanw
e1fb9dd8e8 In pthread__deliver_signal(), correctly use pt_trapuc or pt_uc as the
context-to-restore instead of always using pt_uc.

Fixes a problem with signal handlers for synchronous signals noted by
Matthias Drochner on current-users.
2003-08-22 17:35:52 +00:00
martin
88055fbde5 Include <stdlib.h> for exit() prototype. 2003-08-20 09:50:16 +00:00
nathanw
bd9a18b79f Split out pthread_{set,get}specific() into a separate file and arrange
for that file to not be built with profiling. This makes it reasonable to
use pthread_{set,get}specific() to implement thread-safe profiline call counts.
2003-08-13 18:52:01 +00:00
scw
46fc66f7d8 Adapt to Nathan's recent pt_trapuc/pt_sleepuc change. 2003-08-12 14:01:08 +00:00
agc
eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
lukem
a93ea220fc Rework how dependency generation is performed:
* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
  This is a change of behaviour.  If a Makefile wants the clean semantics
  it must specifically append to CLEANFILES.
  Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
  that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d  depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
2003-08-01 17:03:41 +00:00
kleink
7d3a44f705 Remove PT_SLEEPUC, which somehow wasn't. 2003-07-29 15:18:49 +00:00
salo
99410184e7 netbsd.org->NetBSD.org 2003-07-26 19:24:24 +00:00
mrg
9759912dd6 need <string.h> 2003-07-26 18:33:06 +00:00
skrll
795970599f Typo in comment. 2003-07-24 08:03:44 +00:00
wiz
576530e520 Add pthread(3), based on one by Hubert Feyrer, improved by yours truly,
reviewed by Nathan J. Williams.
2003-07-24 07:50:24 +00:00
nathanw
0878df5d25 Lock accesses to pt_flags and pt_cancel.
When disabling cancellation, clear the pt_cancel flag if it was set
and note the cancellation request with PT_FLAG_CS_PENDING. This avoids
a problem where a cancellation request entered but not acted upon before
pthread_setcanclstate(PTHREAD_CANCEL_DISABLE) is called would still be
aceted upon before cancellation was re-enabled.
2003-07-21 22:24:09 +00:00
nathanw
329747fb90 Add a lock on the pt_flags field. 2003-07-21 22:21:07 +00:00
nathanw
0c96790183 Use _sys_write() instead of write() in the assertion and error
functions, to avoid invoking the cancellation machinery in the middle
of trying to print an assertion or error message.
2003-07-21 22:17:14 +00:00
nathanw
68a63a4079 Move initialization of variable 'nthreads' so that pthread_exit() from
the main thread, with no other threads created, exits cleanly instead
of triggering an assertion in pthread_next().
2003-07-21 22:14:57 +00:00
nathanw
ec2c169839 pthread.c was getting a bit unwieldly. Move pthread_attr stuff out
into a new file, and put the shared private structure definition in
pthread_int.h.
2003-07-18 22:33:45 +00:00
nathanw
0172694e7d Implement a bunch of pthread_attr_() functions, which genuinely set and examine
pthread_attr_t objects, although most of the properties being set don't really
affect threads yet:

pthread_attr_{get,set}guardsize()
pthread_attr_{get,set}inheritsched()
pthread_attr_{get,set}scope()
pthread_attr_{get,set}stack()
pthread_attr_setstack{size,addr}()

Remove some useless assertions and error checks in the existing pthread_attr()
routines.

Implement pthread_attr_get_np(), to examine the attributes of an existing
thread. Idea and interface from FreeBSD.

Change PTHREAD_ERRORMODE environment variable to PTHREAD_DIAGASSERT, and
make it behave like libc's LIBC_DIAGASSERT. The way to disable error-checking
and aborting is now "PTHREAD_DIAGASSERT=AEL", rather than
"PTHREAD_ERRORMODE=ignore".
2003-07-18 22:12:30 +00:00
nathanw
067fa34e42 Add prototypes and necessary symbols for a bunch of pthread_attr_*() functions,
including (interface borrowed from FreeBSD) pthread_attr_get_np().

Remove a few limit-indicating symbols that don't actually need to be defined
(and if they did need to be defined, it would be in limits.h, not here).
2003-07-18 22:01:47 +00:00
nathanw
9e5c87057d Add strong alias for setcancelstate. 2003-07-18 21:57:26 +00:00
lukem
98e8a6d142 #include <pthread_types.h> instead of "pthread_types.h" 2003-07-18 15:58:43 +00:00
nathanw
1a9edd35f7 Simplify pthread__stackalloc() by using the newish aligned-mmap()
feature.
2003-07-17 21:07:39 +00:00
nathanw
d686fc0deb Define PTHREAD_* structure initializers from _PTHREAD_* macros from
pthread_types.h.
2003-07-17 20:59:35 +00:00
nathanw
d37a996a49 Adapt to structure name changes. 2003-07-17 20:55:25 +00:00
nathanw
deb18e9d04 Adapt to internal structure name changes.
Add a couple of useful flags and symbols.
2003-07-17 20:52:38 +00:00
nathanw
c541f9e56a Prepare for inclusion in sys/types.h by ensuring that all the symbols
defined end with _t or start with _[A-Z_].
2003-07-17 20:51:36 +00:00
nathanw
608b92c095 Don't use PTHREAD_DESTRUCTOR_ITERATIONS; the constant is going away. 2003-07-17 20:40:43 +00:00
fvdl
2949ab0051 Take the normal return path in sigtimedwait when the current thread was
canceled as well. From Stephan Uphoff.
2003-07-17 18:15:21 +00:00
nathanw
e171479839 pthread_kill() prototype moved to <signal.h>. 2003-07-16 21:26:33 +00:00
matt
0f8d87a96d Update to new world order. **not tested** But will allow builds to
finish.
2003-07-09 00:55:45 +00:00
uwe
ea81adf86a Not that the branch in SETC doens't have a delay slot, remove the
.empty comment as it's no longer pertinent.
2003-07-05 23:01:25 +00:00
marcus
4e24351384 PIC patch from Valeriy E. Ushakov applied.
Also, removed bogus delay slot flag from branch instruction.
2003-07-05 22:50:09 +00:00
marcus
cccf9dfce5 The field "pt_sleepuc" doesn't exist in struct pthread_st. 2003-07-05 21:27:23 +00:00
skrll
ec57ccf92d Typos in comments. 2003-07-04 15:16:14 +00:00
wiz
cf10d78423 Remove superfluous word. 2003-07-04 11:59:34 +00:00
wiz
3261c36039 Add comma. 2003-07-04 11:57:58 +00:00
wiz
c9b0edd1ba Remove superfluous word. 2003-07-04 11:57:17 +00:00
wiz
df617ae85c Fix typo. 2003-07-04 11:55:58 +00:00
wiz
9edf05479a Mark up a defined value. 2003-07-04 11:47:03 +00:00
wiz
63e8a90e85 New sentence, new line. 2003-07-04 10:19:42 +00:00
wiz
7398828105 Fix typo. 2003-07-04 10:18:46 +00:00
wiz
1e15cda14b > -> \*[Gt] 2003-07-04 08:43:33 +00:00
wiz
5b1fed0bc5 Sort sections. 2003-07-04 08:42:57 +00:00
wiz
f84167245a .Pp fixes. 2003-07-04 08:42:20 +00:00
wiz
2f56847e01 Fix SEE ALSO. 2003-07-04 08:41:25 +00:00
wiz
ba587118af Drop trailing whitespace. 2003-07-04 08:36:06 +00:00
wiz
7dd0ed6e01 We do not want empty lines in mdoc. 2003-07-01 10:23:52 +00:00
wiz
5231f1f288 Remove trailing whitespace. 2003-06-26 10:01:18 +00:00
nathanw
9639eeaf54 Adapt to pt_trapuc: change STACK_SWITCH to check for a value in pt_trapuc
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.
2003-06-26 01:45:31 +00:00
nathanw
487eb7e193 Initialize pt_trapuc in pthread__initthread(). 2003-06-26 01:30:39 +00:00
nathanw
1414a095ac Remove PT_SLEEPUC and add PT_TRAPUC. 2003-06-26 01:29:28 +00:00
nathanw
81a27fd0b2 Adapt to pt_trapuc: Store context obtained from upcalls there, clear it
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.
2003-06-26 01:28:14 +00:00
nathanw
1af6125572 Clear pt_trapuc when idling threads. 2003-06-26 01:26:39 +00:00
nathanw
2534cd2bea Introduce a new pointer, pt_trapuc, that stores thread context captured
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.
2003-06-26 01:26:11 +00:00
nathanw
3ca7487c30 More printf format size tweaks. 2003-06-25 23:26:00 +00:00
nathanw
4a9ac109f0 Complain clearly if SA syscalls aren't avaliable. 2003-06-25 23:23:27 +00:00
nathanw
39f9ecfa06 Oops, reordering the PT_STATE/PT_SWITCHTOUC/PT_SWITCHTO assembly
killed a live value too soon. Fix by using a different register for
the PT_STATE immediate.
2003-06-24 18:54:56 +00:00
nathanw
96458e8892 Update the switch_return point name in the static case. 2003-06-23 22:50:23 +00:00
uwe
b92f152573 First bits of SH3 support. Only _context_u.S is implemented (passess
cu[1-6] tests), the pthread_switch.S is stubbed out for now.

Code posted by Christian Groessler (cpg at aladdin dot de) to port-sh3.
2003-06-23 19:34:43 +00:00
martin
f546abe798 Catch up with Nathan's changes to other archs. 2003-06-17 23:18:48 +00:00
nathanw
876d7e7eec Dodge a potential race condition in pthread__debuglog_printf(). It's
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.
2003-06-16 21:24:48 +00:00
martin
aba86b525b Catch up with changes Nathan did to other archs. 2003-06-15 17:11:36 +00:00
scw
7d221cb560 Apply Nathan's switch-away fix and previous save-PT_UC from new stack fix. 2003-06-13 08:07:03 +00:00
scw
04f197eae9 Apply Nathan's switch-away fix and previous save-PT_UC from new stack fix.
Compile-tested only.
2003-06-13 07:45:17 +00:00
nathanw
4bd45b7b3b Oops, that's switch_return_point, not locked_return_point. The perils
of cut-and-paste.
2003-06-12 23:19:27 +00:00
nathanw
aa6f5de228 STACKSPACE of 16 is too small, given the use of CALLFRAME_SIZ;
increase to match.
2003-06-12 23:01:17 +00:00
nathanw
eb6ba6fbef Apply switch-away fix and previous save-PT_UC from new stack fix. 2003-06-12 23:00:28 +00:00
fvdl
1a31b8db4d Apply Nathan's switch-away fix. 2003-06-12 22:03:18 +00:00
nathanw
b43f1c7405 In pthread__resolve_locks(), change the conditions for removing a normal
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.
2003-06-12 21:49:42 +00:00