summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2012-08-07 05:16:55 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2012-08-07 05:16:55 +0000
commit12210e5877035f0692aab9774dbc74ddc3b6fa9c (patch)
treebadcd4eba202fa3c274761b45d718bd4c00b1f00 /sys/arch/alpha
parent226d3b621ef34ce3bc45fefccf44913d47bd0d1d (diff)
Move the common bits of syscall invocation and return handling into
an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails. Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree. header name from millert@; ok miod@
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/alpha/trap.c55
1 files changed, 13 insertions, 42 deletions
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index b6c4bf00b24..2963ebf0a25 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.60 2012/04/11 14:38:55 mikeb Exp $ */
+/* $OpenBSD: trap.c,v 1.61 2012/08/07 05:16:53 guenther Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -94,18 +94,13 @@
#include <sys/signalvar.h>
#include <sys/user.h>
#include <sys/syscall.h>
+#include <sys/syscall_mi.h>
#include <sys/buf.h>
#ifndef NO_IEEE
#include <sys/device.h>
#endif
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
#include <sys/ptrace.h>
-#include "systrace.h"
-#include <dev/systrace.h>
-
#include <uvm/uvm_extern.h>
#include <machine/cpu.h>
@@ -578,8 +573,9 @@ syscall(code, framep)
default:
if (nargs > 10) /* XXX */
panic("syscall: too many args (%d)", nargs);
- error = copyin((caddr_t)(alpha_pal_rdusp()), &args[6],
- (nargs - 6) * sizeof(u_long));
+ if ((error = copyin((caddr_t)(alpha_pal_rdusp()), &args[6],
+ (nargs - 6) * sizeof(u_long))))
+ goto bad;
case 6:
args[5] = framep->tf_regs[FRAME_A5];
case 5:
@@ -595,23 +591,11 @@ syscall(code, framep)
case 0:
break;
}
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, callp->sy_argsize, args + hidden);
-#endif
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args + hidden);
-#endif
- if (error == 0) {
- rval[0] = 0;
- rval[1] = 0;
-#if NSYSTRACE > 0
- if (ISSET(p->p_flag, P_SYSTRACE))
- error = systrace_redirect(code, p, args + hidden, rval);
- else
-#endif
- error = (*callp->sy_call)(p, args + hidden, rval);
- }
+
+ rval[0] = 0;
+ rval[1] = 0;
+
+ error = mi_syscall(p, code, callp, args + hidden, rval);
switch (error) {
case 0:
@@ -625,6 +609,7 @@ syscall(code, framep)
case EJUSTRETURN:
break;
default:
+ bad:
if (p->p_emul->e_errno)
error = p->p_emul->e_errno[error];
framep->tf_regs[FRAME_V0] = error;
@@ -632,17 +617,10 @@ syscall(code, framep)
break;
}
-#ifdef SYSCALL_DEBUG
- scdebug_ret(p, code, error, rval);
-#endif
/* Do any deferred user pmap operations. */
PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
- userret(p);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, code, error, rval[0]);
-#endif
+ mi_syscall_return(p, code, error, rval);
}
/*
@@ -665,14 +643,7 @@ child_return(arg)
/* Do any deferred user pmap operations. */
PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
- userret(p);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p,
- (p->p_flag & P_THREAD) ? SYS___tfork :
- (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork,
- 0, 0);
-#endif
+ mi_child_return(p);
}
/*