Add local variable to store the sysent pointer. Just a cleanup,

no functional changes.

Reviewed by:	kib (earlier version)
MFC after:	2 weeks
Sponsored by:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D26977
This commit is contained in:
Edward Tomasz Napierala 2020-10-28 14:43:38 +00:00
parent 1701c69b6e
commit bdc0cb4e2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367107

View File

@ -59,6 +59,7 @@ syscallenter(struct thread *td)
{
struct proc *p;
struct syscall_args *sa;
struct sysent *se;
int error, traced;
VM_CNT_INC(v_syscall);
@ -77,9 +78,10 @@ syscallenter(struct thread *td)
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 @@ syscallenter(struct thread *td)
* 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 @@ syscallenter(struct thread *td)
* 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 @@ syscallenter(struct thread *td)
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 @@ syscallenter(struct thread *td)
#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),