summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-06-07 05:47:35 +0000
committerjhb <jhb@FreeBSD.org>2002-06-07 05:47:35 +0000
commit2aa855d8b113333067b5bf576e61982eef0bbc90 (patch)
tree0f6c56b8a8871ae00bac6a1bff1b3b066a5f2990 /sys/powerpc/aim
parent1a2a2fa24afbd97c46308753048ed7d38d299aaa (diff)
downloadFreeBSD-src-2aa855d8b113333067b5bf576e61982eef0bbc90.zip
FreeBSD-src-2aa855d8b113333067b5bf576e61982eef0bbc90.tar.gz
- 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.
Diffstat (limited to 'sys/powerpc/aim')
-rw-r--r--sys/powerpc/aim/trap.c40
1 files changed, 17 insertions, 23 deletions
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?
*/
OpenPOWER on IntegriCloud