/* dynamically generated at build time based on syscalls.master */
extern const char *syscallnames[];
+#define code_is_kdebug_trace(code) (((code) == SYS_kdebug_trace) || \
+ ((code) == SYS_kdebug_trace64) || \
+ ((code) == SYS_kdebug_trace_string))
+
/*
* Function: unix_syscall
*
thread = current_thread();
uthread = get_bsdthread_info(thread);
+#if PROC_REF_DEBUG
+ uthread_reset_proc_refcount(uthread);
+#endif
+
/* Get the approriate proc; may be different from task's for vfork() */
is_vfork = uthread->uu_flag & UT_VFORK;
if (__improbable(is_vfork != 0))
/* NOTREACHED */
}
- if (__probable(code != 180)) {
- int *ip = (int *)vt;
+ if (__probable(!code_is_kdebug_trace(code))) {
+ int *ip = (int *)vt;
KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,
BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_START,
*/
throttle_lowpri_io(1);
}
- if (__probable(code != 180))
+ if (__probable(!code_is_kdebug_trace(code)))
KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,
BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_END,
error, uthread->uu_rval[0], uthread->uu_rval[1], p->p_pid, 0);
pal_execve_return(thread);
}
+#if PROC_REF_DEBUG
+ if (__improbable(uthread_get_proc_refcount(uthread) != 0)) {
+ panic("system call returned with uu_proc_refcount != 0");
+ }
+#endif
+
thread_exception_return();
/* NOTREACHED */
}
thread = current_thread();
uthread = get_bsdthread_info(thread);
+#if PROC_REF_DEBUG
+ uthread_reset_proc_refcount(uthread);
+#endif
+
/* Get the approriate proc; may be different from task's for vfork() */
if (__probable(!(uthread->uu_flag & UT_VFORK)))
p = (struct proc *)get_bsdtask_info(current_task());
memcpy(vt, args_start_at_rdi ? ®s->rdi : ®s->rsi, args_in_regs * sizeof(syscall_arg_t));
- if (code != 180) {
+ if (!code_is_kdebug_trace(code)) {
uint64_t *ip = (uint64_t *)vt;
KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,
*/
throttle_lowpri_io(1);
}
- if (__probable(code != 180))
+ if (__probable(!code_is_kdebug_trace(code)))
KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,
BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_END,
error, uthread->uu_rval[0], uthread->uu_rval[1], p->p_pid, 0);
+#if PROC_REF_DEBUG
+ if (__improbable(uthread_get_proc_refcount(uthread))) {
+ panic("system call returned with uu_proc_refcount != 0");
+ }
+#endif
+
thread_exception_return();
/* NOTREACHED */
}
*/
throttle_lowpri_io(1);
}
- if (code != 180)
+ if (!code_is_kdebug_trace(code))
KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,
BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_END,
error, uthread->uu_rval[0], uthread->uu_rval[1], p->p_pid, 0);