diff options
author | gallatin <gallatin@FreeBSD.org> | 2002-02-19 03:13:39 +0000 |
---|---|---|
committer | gallatin <gallatin@FreeBSD.org> | 2002-02-19 03:13:39 +0000 |
commit | 53507926a42033a398cb6f8e44dd99d68aafab0f (patch) | |
tree | b07b80bbe0e127f3eadc6495de10132aa88ca32a | |
parent | ffdde8ed998b2a6fc54e18d6771e0757bd735c84 (diff) | |
download | FreeBSD-src-53507926a42033a398cb6f8e44dd99d68aafab0f.zip FreeBSD-src-53507926a42033a398cb6f8e44dd99d68aafab0f.tar.gz |
MFi386: merge changes from i386/trap.c rev 1.212
If the credential on an incoming thread is correct, don't bother
reaquiring it. In the same vein, don't bother dropping the thread cred
when going to userland. We are guaranteed to need it when we come back,
(which we are guaranteed to do).
-rw-r--r-- | sys/alpha/alpha/trap.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index c4c402a..2cdf540d 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -298,9 +298,8 @@ trap(a0, a1, a2, entry, framep) sticks = td->td_kse->ke_sticks; td->td_frame = framep; KASSERT(td->td_ucred == NULL, ("already have a ucred")); - PROC_LOCK(p); - td->td_ucred = crhold(p->p_ucred); - PROC_UNLOCK(p); + if (td->td_ucred != p->p_ucred) + cred_update_thread(td); } else { sticks = 0; /* XXX bogus -Wuninitialized warning */ KASSERT(cold || td->td_ucred != NULL, @@ -626,10 +625,12 @@ out: framep->tf_regs[FRAME_SP] = alpha_pal_rdusp(); userret(td, framep, sticks); mtx_assert(&Giant, MA_NOTOWNED); +#ifdef INVARIANTS mtx_lock(&Giant); crfree(td->td_ucred); mtx_unlock(&Giant); td->td_ucred = NULL; +#endif } return; @@ -699,9 +700,8 @@ syscall(code, framep) opc = framep->tf_regs[FRAME_PC] - 4; sticks = td->td_kse->ke_sticks; KASSERT(td->td_ucred == NULL, ("already have a ucred")); - PROC_LOCK(p); - td->td_ucred = crhold(p->p_ucred); - PROC_UNLOCK(p); + if (td->td_ucred != p->p_ucred) + cred_update_thread(td); #ifdef DIAGNOSTIC alpha_fpstate_check(td); @@ -822,10 +822,12 @@ syscall(code, framep) */ STOPEVENT(p, S_SCX, code); +#ifdef INVARIANTS mtx_lock(&Giant); crfree(td->td_ucred); mtx_unlock(&Giant); td->td_ucred = NULL; +#endif #ifdef WITNESS if (witness_list(td)) { panic("system call %s returning with mutex(s) held\n", |