X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6d2010ae8f7a6078e10b361c6962983bab233e0f..99c3a10404e5d1ef94397ab4df5a8b74711fc4d3:/bsd/kern/bsd_init.c diff --git a/bsd/kern/bsd_init.c b/bsd/kern/bsd_init.c index dac2c94d8..2a04fff66 100644 --- a/bsd/kern/bsd_init.c +++ b/bsd/kern/bsd_init.c @@ -133,11 +133,12 @@ #include /* for mcache_init() */ #include /* for mbinit() */ #include /* for knote_init() */ -#include /* for kern_memorystatus_init() */ +#include /* for memorystatus_init() */ #include /* for aio_init() */ #include /* for psem_cache_init() */ #include /* for dlil_init() */ #include /* for proto_kpi_init() */ +#include /* for iptap_init() */ #include /* for pipeinit() */ #include /* for socketinit() */ #include /* for domaininit() */ @@ -154,6 +155,7 @@ #include /* for utun_register_control() */ #include /* for net_str_id_init() */ #include /* for netsrc_init() */ +#include /* for nstat_init() */ #include /* for assert() */ #include @@ -180,12 +182,12 @@ #include #include +#include void * get_user_regs(thread_t); /* XXX kludge for */ void IOKitInitializeTime(void); /* XXX */ void IOSleep(unsigned int); /* XXX */ void loopattach(void); /* XXX */ -void vc_progress_set(boolean_t, uint32_t); /* XXX */ const char copyright[] = "Copyright (c) 1982, 1986, 1989, 1991, 1993\n\t" @@ -223,13 +225,6 @@ char hostname[MAXHOSTNAMELEN]; int hostnamelen; char domainname[MAXDOMNAMELEN]; int domainnamelen; -#if defined(__i386__) || defined(__x86_64__) -struct exec_archhandler exec_archhandler_ppc = { - .path = "/usr/libexec/oah/RosettaNonGrata", -}; -#else /* __i386__ */ -struct exec_archhandler exec_archhandler_ppc; -#endif /* __i386__ */ char rootdevice[16]; /* hfs device names have at least 9 chars */ @@ -250,6 +245,7 @@ extern void klogwakeup(void); extern void file_lock_init(void); extern void kmeminit(void); extern void bsd_bufferinit(void); +extern void throttle_init(void); extern int serverperfmode; extern int ncl; @@ -263,13 +259,8 @@ __private_extern__ int execargs_cache_size = 0; __private_extern__ int execargs_free_count = 0; __private_extern__ vm_offset_t * execargs_cache = NULL; -void bsd_exec_setup(int); +void bsd_exec_setup(int) __attribute__((aligned(4096))); -/* - * Set to disable grading 64 bit Mach-o binaries as executable, for testing; - * Intel only. - */ -__private_extern__ int bootarg_no64exec = 0; __private_extern__ int bootarg_vnode_cache_defeat = 0; /* @@ -330,7 +321,6 @@ extern void stackshot_lock_init(void); extern void dtrace_postinit(void); #endif - /* * Initialization code. * Called from cold start routine as @@ -394,14 +384,15 @@ void (*unmountroot_pre_hook)(void); * of the uu_context.vc_ucred field so that the uthread structure can be * used like any other. */ +extern void run_bringup_tests(void); + +extern void IOServicePublishResource(const char *, boolean_t); + void bsd_init(void) { struct uthread *ut; unsigned int i; -#if __i386__ || __x86_64__ - int error; -#endif struct vfs_context context; kern_return_t ret; struct ucred temp_cred; @@ -412,6 +403,8 @@ bsd_init(void) #define bsd_init_kprintf(x...) /* kprintf("bsd_init: " x) */ + throttle_init(); + kernel_flock = funnel_alloc(KERNEL_FUNNEL); if (kernel_flock == (funnel_t *)0 ) { panic("bsd_init: Failed to allocate kernel funnel"); @@ -775,22 +768,26 @@ bsd_init(void) socketinit(); bsd_init_kprintf("calling domaininit\n"); domaininit(); + iptap_init(); #endif /* SOCKETS */ kernproc->p_fd->fd_cdir = NULL; kernproc->p_fd->fd_rdir = NULL; #if CONFIG_FREEZE - /* Initialise background hibernation */ - bsd_init_kprintf("calling kern_hibernation_init\n"); - kern_hibernation_init(); +#ifndef CONFIG_MEMORYSTATUS + #error "CONFIG_FREEZE defined without matching CONFIG_MEMORYSTATUS" +#endif + /* Initialise background freezing */ + bsd_init_kprintf("calling memorystatus_freeze_init\n"); + memorystatus_freeze_init(); #endif -#if CONFIG_EMBEDDED +#if CONFIG_MEMORYSTATUS /* Initialize kernel memory status notifications */ - bsd_init_kprintf("calling kern_memorystatus_init\n"); - kern_memorystatus_init(); -#endif + bsd_init_kprintf("calling memorystatus_init\n"); + memorystatus_init(); +#endif /* CONFIG_MEMORYSTATUS */ #ifdef GPROF /* Initialize kernel profiling. */ @@ -837,10 +834,8 @@ bsd_init(void) /* register user tunnel kernel control handler */ utun_register_control(); - netsrc_init(); - - /* wait for network domain to finish */ - domainfin(); + netsrc_init(); + nstat_init(); #endif /* NETWORKING */ bsd_init_kprintf("calling vnode_pager_bootstrap\n"); @@ -963,13 +958,6 @@ bsd_init(void) pal_kernel_announce(); -#if __i386__ || __x86_64__ - /* this should be done after the root filesystem is mounted */ - error = set_archhandler(kernproc, CPU_TYPE_POWERPC); - if (error) /* XXX make more generic */ - exec_archhandler_ppc.path[0] = 0; -#endif - bsd_init_kprintf("calling mountroot_post_hook\n"); /* invoke post-root-mount hook */ @@ -1131,10 +1119,6 @@ parse_bsd_args(void) if (PE_parse_boot_argn("-x", namep, sizeof (namep))) /* safe boot */ boothowto |= RB_SAFEBOOT; - /* disable 64 bit grading */ - if (PE_parse_boot_argn("-no64exec", namep, sizeof (namep))) - bootarg_no64exec = 1; - /* disable vnode_cache_is_authorized() by setting vnode_cache_defeat */ if (PE_parse_boot_argn("-vnode_cache_defeat", namep, sizeof (namep))) bootarg_vnode_cache_defeat = 1;