kern_return_t kern_invalid(void) { if (kern_invalid_debug) SoftDebugger("kern_invalid mach trap"); return(KERN_INVALID_ARGUMENT); }
/* * Running in virtual memory, on the interrupt stack. * Does not return. Dispatches initial thread. * * Assumes that master_cpu is set. */ void setup_main() { thread_t startup_thread; #if MACH_KDB /* * Cause a breakpoint trap to the debugger before proceeding * any further if the proper option flag was specified * on the kernel's command line. * XXX check for surrounding spaces. */ if (strstr(kernel_cmdline, "-d ")) { cninit(); /* need console for debugger */ SoftDebugger("init"); } #else /* MACH_KDB */ if (strstr (kernel_cmdline, "-H ")) { reboot_on_panic = 0; } #endif /* MACH_KDB */ panic_init(); printf_init(); sched_init(); vm_mem_bootstrap(); ipc_bootstrap(); vm_mem_init(); ipc_init(); /* * As soon as the virtual memory system is up, we record * that this CPU is using the kernel pmap. */ PMAP_ACTIVATE_KERNEL(master_cpu); init_timers(); init_timeout(); #if XPR_DEBUG xprbootstrap(); #endif /* XPR_DEBUG */ timestamp_init(); mapable_time_init(); machine_init(); machine_info.max_cpus = NCPUS; machine_info.memory_size = phys_last_addr - phys_first_addr; /* XXX mem_size */ machine_info.avail_cpus = 0; machine_info.major_version = KERNEL_MAJOR_VERSION; machine_info.minor_version = KERNEL_MINOR_VERSION; /* * Initialize the IPC, task, and thread subsystems. */ task_init(); thread_init(); swapper_init(); #if MACH_HOST pset_sys_init(); #endif /* MACH_HOST */ /* * Kick off the time-out driven routines by calling * them the first time. */ recompute_priorities(); compute_mach_factor(); /* * Create a kernel thread to start the other kernel * threads. Thread_resume (from kernel_thread) calls * thread_setrun, which may look at current thread; * we must avoid this, since there is no current thread. */ /* * Create the thread, and point it at the routine. */ (void) thread_create(kernel_task, &startup_thread); thread_start(startup_thread, start_kernel_threads); /* * Give it a kernel stack. */ thread_doswapin(startup_thread); /* * Pretend it is already running, and resume it. * Since it looks as if it is running, thread_resume * will not try to put it on the run queues. * * We can do all of this without locking, because nothing * else is running yet. */ startup_thread->state |= TH_RUN; (void) thread_resume(startup_thread); /* * Start the thread. */ cpu_launch_first_thread(startup_thread); /*NOTREACHED*/ }
mach_port_t null_port(void) { if (kern_invalid_debug) SoftDebugger("null_port mach trap"); return(MACH_PORT_NULL); }