Index: head/sys/kern/subr_syscall.c =================================================================== --- head/sys/kern/subr_syscall.c +++ head/sys/kern/subr_syscall.c @@ -59,6 +59,7 @@ { struct proc *p; struct syscall_args *sa; + struct sysent *se; int error, traced; VM_CNT_INC(v_syscall); @@ -77,9 +78,10 @@ PROC_UNLOCK(p); } error = (p->p_sysent->sv_fetch_syscall_args)(td); + se = sa->callp; #ifdef KTRACE if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, sa->callp->sy_narg, sa->args); + ktrsyscall(sa->code, se->sy_narg, sa->args); #endif KTR_START4(KTR_SYSC, "syscall", syscallname(p, sa->code), (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0], @@ -102,9 +104,10 @@ * modified registers or memory. */ error = (p->p_sysent->sv_fetch_syscall_args)(td); + se = sa->callp; #ifdef KTRACE if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, sa->callp->sy_narg, sa->args); + ktrsyscall(sa->code, se->sy_narg, sa->args); #endif if (error != 0) { td->td_errno = error; @@ -118,13 +121,13 @@ * flagged with SYF_CAPENABLED. */ if (__predict_false(IN_CAPABILITY_MODE(td) && - !(sa->callp->sy_flags & SYF_CAPENABLED))) { + (se->sy_flags & SYF_CAPENABLED) == 0)) { td->td_errno = error = ECAPMODE; goto retval; } #endif - error = syscall_thread_enter(td, sa->callp); + error = syscall_thread_enter(td, se); if (error != 0) { td->td_errno = error; goto retval; @@ -145,10 +148,10 @@ AUDIT_SYSCALL_ENTER(sa->code, td))) { #ifdef KDTRACE_HOOKS /* Give the syscall:::entry DTrace probe a chance to fire. */ - if (__predict_false(sa->callp->sy_entry != 0)) + if (__predict_false(se->sy_entry != 0)) (*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0); #endif - error = (sa->callp->sy_call)(td, sa->args); + error = (se->sy_call)(td, sa->args); /* Save the latest error return value. */ if (__predict_false((td->td_pflags & TDP_NERRNO) != 0)) td->td_pflags &= ~TDP_NERRNO; @@ -168,19 +171,19 @@ #ifdef KDTRACE_HOOKS /* Give the syscall:::return DTrace probe a chance to fire. */ - if (__predict_false(sa->callp->sy_return != 0)) + if (__predict_false(se->sy_return != 0)) (*systrace_probe_func)(sa, SYSTRACE_RETURN, error ? -1 : td->td_retval[0]); #endif } else { - error = (sa->callp->sy_call)(td, sa->args); + error = (se->sy_call)(td, sa->args); /* Save the latest error return value. */ if (__predict_false((td->td_pflags & TDP_NERRNO) != 0)) td->td_pflags &= ~TDP_NERRNO; else td->td_errno = error; } - syscall_thread_exit(td, sa->callp); + syscall_thread_exit(td, se); retval: KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code),