Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc/sparc Use sy_invoke.
details: https://anonhg.NetBSD.org/src/rev/14e263a7e35a
branches: trunk
changeset: 787614:14e263a7e35a
user: matt <matt%NetBSD.org@localhost>
date: Wed Jun 26 16:53:34 2013 +0000
description:
Use sy_invoke.
Collapse syscall_fancy and syscall_plain into syscall.
Use p_trace_enabled.
diffstat:
sys/arch/sparc/sparc/syscall.c | 104 ++--------------------------------------
1 files changed, 7 insertions(+), 97 deletions(-)
diffs (154 lines):
diff -r e5c1860a7b4c -r 14e263a7e35a sys/arch/sparc/sparc/syscall.c
--- a/sys/arch/sparc/sparc/syscall.c Wed Jun 26 16:29:50 2013 +0000
+++ b/sys/arch/sparc/sparc/syscall.c Wed Jun 26 16:53:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.27 2012/02/19 21:06:29 rmind Exp $ */
+/* $NetBSD: syscall.c,v 1.28 2013/06/26 16:53:34 matt Exp $ */
/*
* Copyright (c) 1996
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.27 2012/02/19 21:06:29 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.28 2013/06/26 16:53:34 matt Exp $");
#include "opt_sparc_arch.h"
#include "opt_multiprocessor.h"
@@ -99,8 +99,7 @@
#ifdef FPU_DEBUG
static inline void save_fpu(struct trapframe *);
#endif
-void syscall_plain(register_t, struct trapframe *, register_t);
-void syscall_fancy(register_t, struct trapframe *, register_t);
+void syscall(register_t, struct trapframe *, register_t);
static inline int
handle_new(struct trapframe *tf, register_t *code)
@@ -187,10 +186,8 @@
syscall_intern(struct proc *p)
{
- if (trace_is_enabled(p))
- p->p_md.md_syscall = syscall_fancy;
- else
- p->p_md.md_syscall = syscall_plain;
+ p->p_trace_enabled = trace_is_enabled(p);
+ p->p_md.md_syscall = syscall;
}
/*
@@ -202,7 +199,7 @@
* thing that made the system call, and are named that way here.
*/
void
-syscall_plain(register_t code, struct trapframe *tf, register_t pc)
+syscall(register_t code, struct trapframe *tf, register_t pc)
{
const struct sysent *callp;
struct proc *p;
@@ -232,93 +229,8 @@
rval.o[0] = 0;
rval.o[1] = tf->tf_out[1];
- error = sy_call(callp, l, &args, rval.o);
-
- switch (error) {
- case 0:
- /* Note: fork() does not return here in the child */
- tf->tf_out[0] = rval.o[0];
- tf->tf_out[1] = rval.o[1];
- if (new) {
- /* jmp %g5, (or %g2 or %g7, deprecated) on success */
- if (__predict_true((new & SYSCALL_G5RFLAG)
- == SYSCALL_G5RFLAG))
- i = tf->tf_global[5];
- else if (new & SYSCALL_G2RFLAG)
- i = tf->tf_global[2];
- else
- i = tf->tf_global[7];
- if (i & 3) {
- error = EINVAL;
- goto bad;
- }
- } else {
- /* old system call convention: clear C on success */
- tf->tf_psr &= ~PSR_C; /* success */
- i = tf->tf_npc;
- }
- tf->tf_pc = i;
- tf->tf_npc = i + 4;
- break;
-
- case ERESTART:
- case EJUSTRETURN:
- /* nothing to do */
- break;
+ error = sy_invoke(callp, l, args.i, rval.o, code);
- default:
- bad:
- if (p->p_emul->e_errno)
- error = p->p_emul->e_errno[error];
- tf->tf_out[0] = error;
- tf->tf_psr |= PSR_C; /* fail */
- i = tf->tf_npc;
- tf->tf_pc = i;
- tf->tf_npc = i + 4;
- break;
- }
-
- userret(l, pc, sticks);
- share_fpu(l, tf);
-}
-
-void
-syscall_fancy(register_t code, struct trapframe *tf, register_t pc)
-{
- const struct sysent *callp;
- struct proc *p;
- struct lwp *l;
- int error, new;
- union args args;
- union rval rval;
- register_t i;
- u_quad_t sticks;
-
- curcpu()->ci_data.cpu_nsyscall++; /* XXXSMP */
- l = curlwp;
- p = l->l_proc;
- LWP_CACHE_CREDS(l, p);
-
- sticks = p->p_sticks;
- l->l_md.md_tf = tf;
-
-#ifdef FPU_DEBUG
- save_fpu(tf);
-#endif
- new = handle_new(tf, &code);
-
- if ((error = getargs(p, tf, &code, &callp, &args)) != 0)
- goto bad;
-
- if ((error = trace_enter(code, args.i, callp->sy_narg)) != 0)
- goto out;
-
- rval.o[0] = 0;
- rval.o[1] = tf->tf_out[1];
-
- error = sy_call(callp, l, &args, rval.o);
-
-out:
switch (error) {
case 0:
/* Note: fork() does not return here in the child */
@@ -363,8 +275,6 @@
break;
}
- trace_exit(code, rval.o, error);
-
userret(l, pc, sticks);
share_fpu(l, tf);
}
Home |
Main Index |
Thread Index |
Old Index