summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2004-07-12 07:39:20 +0000
committerdavidxu <davidxu@FreeBSD.org>2004-07-12 07:39:20 +0000
commit351df4e3484dd088f7e5802e8bce6fb514779540 (patch)
tree4533691922b23dce2a5e5d058b14848d4c8231d3 /sys/kern
parentba689b40433c4dbba7960454bbb126e6da5bdf59 (diff)
downloadFreeBSD-src-351df4e3484dd088f7e5802e8bce6fb514779540.zip
FreeBSD-src-351df4e3484dd088f7e5802e8bce6fb514779540.tar.gz
Change kse_switchin to accept kse_thr_mailbox pointer, the syscall
will be used heavily in debugging KSE threads. This breaks libpthread on IA64, but because libpthread was not in 5.2.1 release, I would like to change it so we needn't to introduce another syscall.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_kse.c29
-rw-r--r--sys/kern/syscalls.master4
2 files changed, 22 insertions, 11 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index 3498127..0b4e7c5 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -126,25 +126,36 @@ upcall_remove(struct thread *td)
#ifndef _SYS_SYSPROTO_H_
struct kse_switchin_args {
- const struct __mcontext *mcp;
- long val;
- long *loc;
+ struct kse_thr_mailbox *tmbx;
+ int flags;
};
#endif
int
kse_switchin(struct thread *td, struct kse_switchin_args *uap)
{
- mcontext_t mc;
+ struct kse_thr_mailbox tmbx;
+ struct kse_upcall *ku;
int error;
- error = (uap->mcp == NULL) ? EINVAL : 0;
+ if ((ku = td->td_upcall) == NULL || TD_CAN_UNBIND(td))
+ return (EINVAL);
+ error = (uap->tmbx == NULL) ? EINVAL : 0;
if (!error)
- error = copyin(uap->mcp, &mc, sizeof(mc));
- if (!error && uap->loc != NULL)
- error = (suword(uap->loc, uap->val) != 0) ? EINVAL : 0;
+ error = copyin(uap->tmbx, &tmbx, sizeof(tmbx));
+ if (!error && (uap->flags & KSE_SWITCHIN_SETTMBX))
+ error = (suword(&ku->ku_mailbox->km_curthread,
+ (long)uap->tmbx) != 0 ? EINVAL : 0);
if (!error)
- error = set_mcontext(td, &mc);
+ error = set_mcontext(td, &tmbx.tm_context.uc_mcontext);
+ if (!error) {
+ if (uap->flags & KSE_SWITCHIN_SETTMBX) {
+ td->td_mailbox = uap->tmbx;
+ mtx_lock_spin(&sched_lock);
+ td->td_flags |= TDF_CAN_UNBIND;
+ mtx_unlock_spin(&sched_lock);
+ }
+ }
return ((error == 0) ? EJUSTRETURN : error);
}
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index acab8e0..05d8ffa 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -626,8 +626,8 @@
int attrnamespace, void *data, size_t nbytes); }
439 STD { ssize_t extattr_list_link(const char *path, \
int attrnamespace, void *data, size_t nbytes); }
-440 MSTD { int kse_switchin(const struct __mcontext *mcp, \
- long val, long *loc); }
+440 MSTD { int kse_switchin(struct kse_thr_mailbox *tmbx, \
+ int flags); }
441 MNOSTD { int ksem_timedwait(semid_t id, struct timespec *abstime); }
442 MSTD { int thr_suspend(const struct timespec *timeout); }
443 MSTD { int thr_wake(long id); }
OpenPOWER on IntegriCloud