1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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).
This commit is contained in:
Andrew Gallatin 2002-02-19 03:13:39 +00:00
parent c28841c1da
commit 35a86b35c1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90890

View File

@ -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 @@ trap(a0, a1, a2, entry, framep)
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",