|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: * ! 27: * Mach Operating System ! 28: * Copyright (c) 1987 Carnegie-Mellon University ! 29: * All rights reserved. The CMU software License Agreement specifies ! 30: * the terms and conditions for use and redistribution. ! 31: */ ! 32: /* ! 33: * HISTORY ! 34: */ ! 35: ! 36: #import <mach/features.h> ! 37: ! 38: #import <mach/machine.h> ! 39: #import <sys/version.h> ! 40: #import <kern/thread.h> ! 41: #import <kern/task.h> ! 42: #import <sys/param.h> ! 43: #import <mach/vm_param.h> ! 44: #import <vm/vm_kern.h> ! 45: #import <machine/spl.h> ! 46: #import <kern/miniMon.h> ! 47: ! 48: /* ! 49: * Initialization code. ! 50: * Called from cold start routine as ! 51: * soon as a stack and segmentation ! 52: * have been established. ! 53: * Functions: ! 54: * clear and free user core ! 55: * turn on clock ! 56: * hand craft 0th process ! 57: * call all initialization routines ! 58: * fork - process 0 to schedule ! 59: * - process 1 execute bootstrap ! 60: * - process 2 to page out ! 61: */ ! 62: thread_t first_thread; ! 63: ! 64: thread_t setup_main() ! 65: /* ! 66: * first_addr contains the first available physical address ! 67: * running in virtual memory on the interrupt stack ! 68: * ! 69: * returns initial thread to run ! 70: */ ! 71: { ! 72: extern vm_offset_t virtual_avail; ! 73: vm_offset_t end_stack, cur_stack; ! 74: int i; ! 75: extern void main(); ! 76: extern void vm_mem_init(); ! 77: #if MACH_NET ! 78: extern void mach_net_init(); ! 79: #endif MACH_NET ! 80: unsigned s; ! 81: ! 82: machine_clock_init(); ! 83: sched_init(); ! 84: ! 85: vm_mem_init(); ! 86: ! 87: init_timers(); ! 88: init_timeout(); ! 89: ! 90: startup(virtual_avail); ! 91: printf("minimum quantum is %d ms\n", (1000 / hz) * min_quantum); ! 92: ! 93: machine_info.max_cpus = NCPUS; ! 94: machine_info.memory_size = roundup(mem_size, 1024*1024); ! 95: machine_info.avail_cpus = 0; ! 96: machine_info.major_version = KERNEL_MAJOR_VERSION; ! 97: machine_info.minor_version = KERNEL_MINOR_VERSION; ! 98: ! 99: /* ! 100: * Initialize the task and thread subsystems. ! 101: */ ! 102: ! 103: uzone_init(); ! 104: ! 105: ipc_bootstrap(); ! 106: ! 107: cpu_up(master_cpu); /* signify we are up */ ! 108: #if MACH_NET ! 109: mach_net_init(); ! 110: #endif MACH_NET ! 111: task_init(); ! 112: thread_init(); ! 113: swapper_init(); ! 114: ipc_init(); ! 115: vnode_pager_init(); ! 116: #if MACH_HOST ! 117: pset_sys_init(); ! 118: #endif MACH_HOST ! 119: ! 120: (void) thread_create(kernel_task, &first_thread); ! 121: thread_deallocate(first_thread); ! 122: thread_start(first_thread, main); ! 123: thread_doswapin(first_thread); ! 124: first_thread->state |= TH_RUN; ! 125: (void) thread_resume(first_thread); ! 126: ! 127: /* ! 128: * Tell the pmap system that our cpu is using the kernel pmap ! 129: */ ! 130: s = splvm(); ! 131: PMAP_ACTIVATE(kernel_pmap, first_thread, cpu_number()); ! 132: splx(s); ! 133: ! 134: #if DRIVERKIT ! 135: dev_server_init(); ! 136: #endif DRIVERKIT ! 137: ! 138: miniMonInit(); ! 139: ! 140: /* ! 141: * Return to assembly code to start the first process. ! 142: */ ! 143: ! 144: return(first_thread); ! 145: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.