From 2aa855d8b113333067b5bf576e61982eef0bbc90 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 7 Jun 2002 05:47:35 +0000 Subject: - Fixup / remove obsolete comments. - ktrace no longer requires Giant so do ktrace syscall events before and after acquiring and releasing Giant, respectively. - For i386, ia32 syscalls on ia64, powerpc, and sparc64, get rid of the goto bad hack and instead use the model on ia64 and alpha were we skip the actual syscall invocation if error != 0. This fixes a bug where if we the copyin() of the arguments failed for a syscall that was not marked MP safe, we would try to release Giant when we had not acquired it. --- sys/powerpc/aim/trap.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'sys/powerpc/aim') diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c index c6c99db..e43e9cc 100644 --- a/sys/powerpc/aim/trap.c +++ b/sys/powerpc/aim/trap.c @@ -395,33 +395,28 @@ syscall(struct trapframe *frame) bcopy(params, args, n * sizeof(register_t)); error = copyin(MOREARGS(frame->fixreg[1]), args + n, narg - n * sizeof(register_t)); - if (error) { -#ifdef KTRACE - /* Can't get all the arguments! */ - if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p->p_tracep, code, narg, args); -#endif - goto bad; - } params = (caddr_t)args; - } + } else + error = 0; +#ifdef KTRACE + if (KTRPOINT(td, KTR_SYSCALL)) + ktrsyscall(code, narg, params); +#endif /* * Try to run the syscall without Giant if the syscall is MP safe. */ if ((callp->sy_narg & SYF_MPSAFE) == 0) mtx_lock(&Giant); -#ifdef KTRACE - if (KTRPOINT(p, KTR_SYSCALL)) - ktrsyscall(p->p_tracep, code, narg, params); -#endif - td->td_retval[0] = 0; - td->td_retval[1] = frame->fixreg[FIRSTARG + 1]; + if (error == 0) { + td->td_retval[0] = 0; + td->td_retval[1] = frame->fixreg[FIRSTARG + 1]; - STOPEVENT(p, S_SCE, narg); + STOPEVENT(p, S_SCE, narg); - error = (*callp->sy_call)(td, params); + error = (*callp->sy_call)(td, params); + } switch (error) { case 0: frame->fixreg[FIRSTARG] = td->td_retval[0]; @@ -439,7 +434,6 @@ syscall(struct trapframe *frame) /* nothing to do */ break; default: -bad: if (p->p_sysent->sv_errsize) { if (error >= p->p_sysent->sv_errsize) error = -1; /* XXX */ @@ -453,14 +447,14 @@ bad: } -#ifdef KTRACE - if (KTRPOINT(p, KTR_SYSRET)) - ktrsysret(p->p_tracep, code, error, td->td_retval[0]); -#endif - if ((callp->sy_narg & SYF_MPSAFE) == 0) mtx_unlock(&Giant); +#ifdef KTRACE + if (KTRPOINT(td, KTR_SYSRET)) + ktrsysret(code, error, td->td_retval[0]); +#endif + /* * Does the comment in the i386 code about errno apply here? */ -- cgit v1.1