summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
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/hppa
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/hppa')
-rw-r--r--sys/arch/hppa/hppa/trap.c79
1 files changed, 14 insertions, 65 deletions
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index 8ebf286f463..7da4b3f4532 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.122 2012/04/11 14:38:55 mikeb Exp $ */
+/* $OpenBSD: trap.c,v 1.123 2012/08/07 05:16:53 guenther Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -31,14 +31,12 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/syscall.h>
+#include <sys/syscall_mi.h>
#include <sys/ktrace.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/user.h>
-#include "systrace.h"
-#include <dev/systrace.h>
-
#include <uvm/uvm.h>
#include <machine/autoconf.h>
@@ -659,17 +657,8 @@ child_return(void *arg)
KERNEL_UNLOCK();
ast(p);
- userret(p);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET)) {
- KERNEL_LOCK();
- ktrsysret(p,
- (p->p_flag & P_THREAD) ? SYS___tfork :
- (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork,
- 0, 0);
- KERNEL_UNLOCK();
- }
-#endif
+
+ mi_child_return(p);
}
#ifdef PTRACE
@@ -838,17 +827,14 @@ syscall(struct trapframe *frame)
else
callp += code;
- oerror = error = 0;
if ((argsize = callp->sy_argsize)) {
int i;
for (i = 0, argsize -= argoff * 4;
argsize > 0; i++, argsize -= 4) {
- error = copyin((void *)(frame->tf_sp +
- HPPA_FRAME_ARG(i + 4)), args + i + argoff, 4);
-
- if (error)
- break;
+ if ((error = copyin((void *)(frame->tf_sp +
+ HPPA_FRAME_ARG(i + 4)), args + i + argoff, 4)))
+ goto bad;
}
/*
@@ -860,7 +846,7 @@ syscall(struct trapframe *frame)
* by their normal syscall number, maybe a regress
* test should be used, to watch the behaviour.
*/
- if (!error && argoff < 4) {
+ if (argoff < 4) {
int t;
i = 0;
@@ -884,39 +870,11 @@ syscall(struct trapframe *frame)
}
}
-#ifdef SYSCALL_DEBUG
- KERNEL_LOCK();
- scdebug_call(p, code, args);
- KERNEL_UNLOCK();
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL)) {
- KERNEL_LOCK();
- ktrsyscall(p, code, callp->sy_argsize, args);
- KERNEL_UNLOCK();
- }
-#endif
- if (error)
- goto bad;
-
rval[0] = 0;
rval[1] = frame->tf_ret1;
-#if NSYSTRACE > 0
- if (ISSET(p->p_flag, P_SYSTRACE)) {
- KERNEL_LOCK();
- oerror = error = systrace_redirect(code, p, args, rval);
- KERNEL_UNLOCK();
- } else
-#endif
- {
- int nolock = (callp->sy_flags & SY_NOLOCK);
- if (!nolock)
- KERNEL_LOCK();
- oerror = error = (*callp->sy_call)(p, args, rval);
- if (!nolock)
- KERNEL_UNLOCK();
- }
+ oerror = error = mi_syscall(p, code, callp, args, rval);
+
switch (error) {
case 0:
frame->tf_ret0 = rval[0];
@@ -937,20 +895,11 @@ syscall(struct trapframe *frame)
frame->tf_ret1 = 0;
break;
}
-#ifdef SYSCALL_DEBUG
- KERNEL_LOCK();
- scdebug_ret(p, code, oerror, rval);
- KERNEL_UNLOCK();
-#endif
+
ast(p);
- userret(p);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET)) {
- KERNEL_LOCK();
- ktrsysret(p, code, oerror, rval[0]);
- KERNEL_UNLOCK();
- }
-#endif
+
+ mi_syscall_return(p, code, oerror, rval);
+
#ifdef DIAGNOSTIC
if (curcpu()->ci_cpl != oldcpl) {
printf("WARNING: SPL (0x%x) NOT LOWERED ON "