From b6631c500b60af6940dbcee6a8ac4439d2491f07 Mon Sep 17 00:00:00 2001 From: marcel Date: Wed, 10 Dec 2003 01:59:23 +0000 Subject: Write the thread pointer (val) in the kse mailbox (loc) before we set the new context in kse_switchin(2). This allows us to return an error to the calling context when the suword() fails. --- sys/kern/kern_thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/kern/kern_thread.c') diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index f47beec..a08805e 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -399,10 +399,10 @@ kse_switchin(struct thread *td, struct kse_switchin_args *uap) error = (uap->mcp == 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; if (!error) error = set_mcontext(td, &mc); - if (!error && uap->loc != NULL) - suword(uap->loc, uap->val); return ((error == 0) ? EJUSTRETURN : error); } -- cgit v1.1