Sat Feb 15 10:14:35 2014 UTC ()
Add sy_invoke inline from HEAD


(matt)
diff -r1.2 -r1.2.8.1 src/sys/sys/syscallvar.h

cvs diff -r1.2 -r1.2.8.1 src/sys/sys/syscallvar.h (expand / switch to unified diff)

--- src/sys/sys/syscallvar.h 2008/10/21 12:22:00 1.2
+++ src/sys/sys/syscallvar.h 2014/02/15 10:14:35 1.2.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: syscallvar.h,v 1.2 2008/10/21 12:22:00 ad Exp $ */ 1/* $NetBSD: syscallvar.h,v 1.2.8.1 2014/02/15 10:14:35 matt Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software developed for The NetBSD Foundation 7 * This code is derived from software developed for The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -42,14 +42,41 @@ @@ -42,14 +42,41 @@
42static inline int 42static inline int
43sy_call(const struct sysent *sy, struct lwp *l, const void *uap, 43sy_call(const struct sysent *sy, struct lwp *l, const void *uap,
44 register_t *rval) 44 register_t *rval)
45{ 45{
46 int error; 46 int error;
47 47
48 l->l_sysent = sy; 48 l->l_sysent = sy;
49 error = (*sy->sy_call)(l, uap, rval); 49 error = (*sy->sy_call)(l, uap, rval);
50 l->l_sysent = NULL; 50 l->l_sysent = NULL;
51 51
52 return error; 52 return error;
53} 53}
54 54
 55static inline int
 56sy_invoke(const struct sysent *sy, struct lwp *l, const void *uap,
 57 register_t *rval, int code)
 58{
 59 const bool do_trace = l->l_proc->p_trace_enabled &&
 60 (sy->sy_flags & SYCALL_INDIRECT) == 0;
 61 int error;
 62
 63 if (__predict_true(!do_trace) || (error = trace_enter(code, uap,
 64 sy->sy_narg)) == 0) {
 65 rval[0] = 0;
 66#if !defined(__mips__)
 67 /*
 68 * Due to the mips userland code for SYS_break needing v1 to be
 69 * preserved, we can't clear this on mips.
 70 */
 71 rval[1] = 0;
 72#endif
 73 error = sy_call(sy, l, uap, rval);
 74 }
 75
 76 if (__predict_false(do_trace)) {
 77 trace_exit(code, rval, error);
 78 }
 79 return error;
 80}
 81
55#endif /* _SYS_SYSCALLVAR_H_ */ 82#endif /* _SYS_SYSCALLVAR_H_ */