]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/dev/ppc/systemcalls.c
xnu-792.24.17.tar.gz
[apple/xnu.git] / bsd / dev / ppc / systemcalls.c
index a20314a54707efe69c4424041063cd38b17bb0b6..46d44186d9c525a33962995c5c1fda2736fbd481 100644 (file)
@@ -71,7 +71,7 @@ unix_syscall(struct savearea  *regs)
        struct proc                     *proc;
        struct sysent           *callp;
        int                                     error;
-       unsigned short          code;
+       unsigned int            code;
        boolean_t                       flavor;
        int funnel_type;
        unsigned int cancel_enable;
@@ -99,6 +99,16 @@ unix_syscall(struct savearea *regs)
        else
                proc = current_proc();
 
+       /* Make sure there is a process associated with this task */
+       if (proc == NULL) {
+               regs->save_r3 = (long long)EPERM;
+               /* set the "pc" to execute cerror routine */
+               regs->save_srr0 -= 4;
+               task_terminate_internal(current_task());
+               thread_exception_return();
+               /* NOTREACHED */
+       }
+
        /*
         * Delayed binding of thread credential to process credential, if we
         * are not running with an explicitly set thread credential.
@@ -311,7 +321,7 @@ unix_syscall_return(int error)
        struct uthread                          *uthread;
        struct proc                                     *proc;
        struct savearea                         *regs;
-       unsigned short                          code;
+       unsigned int                            code;
        struct sysent                           *callp;
        int funnel_type;
        unsigned int cancel_enable;