X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/c0fea4742e91338fffdcf79f86a7c1d5e2b97eb1..8ad349bb6ed4a0be06e34c92be0d98b92e078db4:/bsd/kern/bsd_init.c diff --git a/bsd/kern/bsd_init.c b/bsd/kern/bsd_init.c index 05b66d530..b3cf077e2 100644 --- a/bsd/kern/bsd_init.c +++ b/bsd/kern/bsd_init.c @@ -1,23 +1,31 @@ /* - * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ * - * @APPLE_LICENSE_HEADER_END@ + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the + * License may not be used to create, or enable the creation or + * redistribution of, unlawful or unlicensed copies of an Apple operating + * system, or to circumvent, violate, or enable the circumvention or + * violation of, any terms of an Apple operating system software license + * agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993 @@ -117,8 +125,6 @@ #include -#include - extern int app_profile; /* on/off switch for pre-heat cache */ char copyright[] = @@ -158,13 +164,9 @@ char hostname[MAXHOSTNAMELEN]; int hostnamelen; char domainname[MAXDOMNAMELEN]; int domainnamelen; -#if __i386__ -struct exec_archhandler exec_archhandler_ppc = { - .path = "/usr/libexec/oah/translate", -}; -#else /* __i386__ */ -struct exec_archhandler exec_archhandler_ppc; -#endif /* __i386__ */ +char classichandler[32] = {0}; +uint32_t classichandler_fsid = -1L; +long classichandler_fileid = -1L; char rootdevice[16]; /* hfs device names have at least 9 chars */ @@ -182,7 +184,6 @@ vm_map_t mb_map; semaphore_t execve_semaphore; int cmask = CMASK; -extern int customnbuf; int parse_bsd_args(void); extern int bsd_hardclockinit; @@ -200,12 +201,6 @@ extern void sysv_sem_lock_init(void); extern void sysv_msg_lock_init(void); extern void pshm_lock_init(); extern void psem_lock_init(); -extern int maxprocperuid; - -/* kmem access not enabled by default; can be changed with boot-args */ -int setup_kmem = 0; - -extern void stackshot_lock_init(); /* * Initialization code. @@ -274,7 +269,6 @@ bsd_init() extern kauth_cred_t rootcred; register int i; int s; - int error; thread_t th; struct vfs_context context; void lightning_bolt(void ); @@ -316,13 +310,17 @@ bsd_init() /* give kernproc a name */ process_name("kernel_task", p); + /* allocate proc lock group attribute and group */ proc_lck_grp_attr= lck_grp_attr_alloc_init(); - + lck_grp_attr_setstat(proc_lck_grp_attr); + proc_lck_grp = lck_grp_alloc_init("proc", proc_lck_grp_attr); + /* Allocate proc lock attribute */ proc_lck_attr = lck_attr_alloc_init(); + //lck_attr_setdebug(proc_lck_attr); lck_mtx_init(&p->p_mlock, proc_lck_grp, proc_lck_attr); lck_mtx_init(&p->p_fdmlock, proc_lck_grp, proc_lck_attr); @@ -394,7 +392,7 @@ bsd_init() limit0.pl_rlimit[i].rlim_cur = limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY; limit0.pl_rlimit[RLIMIT_NOFILE].rlim_cur = NOFILE; - limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur = maxprocperuid; + limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur = MAXUPRC; limit0.pl_rlimit[RLIMIT_NPROC].rlim_max = maxproc; limit0.pl_rlimit[RLIMIT_STACK] = vm_initial_limit_stack; limit0.pl_rlimit[RLIMIT_DATA] = vm_initial_limit_data; @@ -483,8 +481,6 @@ bsd_init() psem_cache_init(); time_zone_slock_init(); - /* Stack snapshot facility lock */ - stackshot_lock_init(); /* * Initialize protocols. Block reception of incoming packets * until everything is ready. @@ -596,13 +592,6 @@ bsd_init() bsd_utaskbootstrap(); -#if __i386__ - // this should be done after the root filesystem is mounted - error = set_archhandler(p, CPU_TYPE_POWERPC); - if (error) - exec_archhandler_ppc.path[0] = 0; -#endif - /* invoke post-root-mount hook */ if (mountroot_post_hook != NULL) mountroot_post_hook(); @@ -643,6 +632,7 @@ bsdinit_task(void) ut = (uthread_t)get_bsdthread_info(th_act); + ut->uu_ar0 = (void *)get_user_regs(th_act); bsd_hardclockinit = 1; /* Start bsd hardclock */ bsd_init_task = get_threadtask(th_act); @@ -812,9 +802,7 @@ parse_bsd_args() PE_parse_boot_arg("srv", &srv); PE_parse_boot_arg("ncl", &ncl); - if (PE_parse_boot_arg("nbuf", &max_nbuf_headers)) - customnbuf = 1; - PE_parse_boot_arg("kmem", &setup_kmem); + PE_parse_boot_arg("nbuf", &nbuf); return 0; }