- ** the PPC runtime calls cerror after every unix system call, so
- ** assume no error and adjust the "pc" to skip this call.
- ** It will be set back to the cerror call if an error is detected.
- */
- regs->srr0 += 4;
- vt = get_bsduthreadarg(thread);
- p = ((struct proc *)get_bsdtask_info(current_task()));
- error = (*(callp->sy_call))(p, (caddr_t)vt, rval);
-
- if (error == ERESTART) {
- regs->srr0 -= 8;
- }
- else if (error != EJUSTRETURN) {
- if (error)
- {
- regs->r3 = error;
- /* set the "pc" to execute cerror routine */
- regs->srr0 -= 4;
- } else { /* (not error) */
- regs->r3 = rval[0];
- regs->r4 = rval[1];
- }
- }
- /* else (error == EJUSTRETURN) { nothing } */
-
- thread_exception_return();
- /* NOTREACHED */
+ * Get index into sysent table
+ */
+ if (error == ERESTART) {
+ regs->save_srr0 -= 8;
+ } else if (error != EJUSTRETURN) {
+ if (error) {
+ regs->save_r3 = error;
+ /* set the "pc" to execute cerror routine */
+ regs->save_srr0 -= 4;
+ } else { /* (not error) */
+ regs->save_r3 = uthread->uu_rval[0];
+ regs->save_r4 = uthread->uu_rval[1];
+ }
+ }
+ /* else (error == EJUSTRETURN) { nothing } */
+
+ if (regs->save_r0 != NULL)
+ code = regs->save_r0;
+ else
+ code = regs->save_r3;
+
+ callp = (code >= nsysent) ? &sysent[63] : &sysent[code];
+
+ funnel_type = (int)callp->sy_funnel;
+
+ if (KTRPOINT(proc, KTR_SYSRET))
+ ktrsysret(proc, code, error, uthread->uu_rval[0], funnel_type);
+
+ if(funnel_type == KERNEL_FUNNEL)
+ exit_funnel_section(kernel_flock);
+ else if (funnel_type == NETWORK_FUNNEL)
+ exit_funnel_section(network_flock);
+
+ if (kdebug_enable && (code != 180)) {
+ KERNEL_DEBUG_CONSTANT(BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_END,
+ error, uthread->uu_rval[0], uthread->uu_rval[1], 0, 0);
+ }
+
+ thread_exception_return();
+ /* NOTREACHED */
+}
+
+/*
+ * Time of day and interval timer support.
+ *
+ * These routines provide the kernel entry points to get and set
+ * the time-of-day and per-process interval timers. Subroutines
+ * here provide support for adding and subtracting timeval structures
+ * and decrementing interval timers, optionally reloading the interval
+ * timers when they expire.
+ */
+struct gettimeofday_args{
+ struct timeval *tp;
+ struct timezone *tzp;
+};
+/* NOTE THIS implementation is for ppc architectures only */
+int
+ppc_gettimeofday(p, uap, retval)
+ struct proc *p;
+ register struct gettimeofday_args *uap;
+ register_t *retval;
+{
+ struct timeval atv;
+ int error = 0;
+ struct timezone ltz;
+ //struct savearea *child_state;
+ extern simple_lock_data_t tz_slock;
+
+ if (uap->tp) {
+ microtime(&atv);
+ retval[0] = atv.tv_sec;
+ retval[1] = atv.tv_usec;
+ }