Annotation of prex/sys/kern/main.c, Revision 1.1
1.1 ! nbrk 1: /*-
! 2: * Copyright (c) 2005-2007, Kohsuke Ohtani
! 3: * All rights reserved.
! 4: *
! 5: * Redistribution and use in source and binary forms, with or without
! 6: * modification, are permitted provided that the following conditions
! 7: * are met:
! 8: * 1. Redistributions of source code must retain the above copyright
! 9: * notice, this list of conditions and the following disclaimer.
! 10: * 2. Redistributions in binary form must reproduce the above copyright
! 11: * notice, this list of conditions and the following disclaimer in the
! 12: * documentation and/or other materials provided with the distribution.
! 13: * 3. Neither the name of the author nor the names of any co-contributors
! 14: * may be used to endorse or promote products derived from this software
! 15: * without specific prior written permission.
! 16: *
! 17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
! 18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 20: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
! 21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 27: * SUCH DAMAGE.
! 28: */
! 29:
! 30: /*
! 31: * main.c - kernel main routine
! 32: */
! 33:
! 34: #include <kernel.h>
! 35: #include <task.h>
! 36: #include <thread.h>
! 37: #include <timer.h>
! 38: #include <page.h>
! 39: #include <kmem.h>
! 40: #include <vm.h>
! 41: #include <sched.h>
! 42: #include <exception.h>
! 43: #include <irq.h>
! 44: #include <ipc.h>
! 45: #include <device.h>
! 46: #include <sync.h>
! 47: #include <version.h>
! 48:
! 49: /*
! 50: * Initialization code.
! 51: *
! 52: * Called from kernel_start() routine that is
! 53: * implemented in the architecture dependent layer.
! 54: * We assume that the following machine state has
! 55: * been already set before this routine.
! 56: * - Kernel BSS section is filled with 0.
! 57: * - Kernel stack is configured.
! 58: * - All interrupts are disabled.
! 59: * - Minimum page table is set. (MMU systems only)
! 60: */
! 61: int
! 62: main(void)
! 63: {
! 64:
! 65: /*
! 66: * Do machine-dependent
! 67: * initialization.
! 68: */
! 69: diag_init();
! 70: DPRINTF((BANNER));
! 71: sched_lock();
! 72: machine_init();
! 73:
! 74: /*
! 75: * Initialize memory managers.
! 76: */
! 77: page_init();
! 78: mmu_init();
! 79: kmem_init();
! 80: vm_init();
! 81:
! 82: /*
! 83: * Initialize kernel core.
! 84: */
! 85: task_init();
! 86: thread_init();
! 87: sched_init();
! 88: exception_init();
! 89: timer_init();
! 90:
! 91: /*
! 92: * Initialize IPC related stuff.
! 93: */
! 94: object_init();
! 95: msg_init();
! 96:
! 97: /*
! 98: * Enable interrupt and
! 99: * initialize devices.
! 100: */
! 101: irq_init();
! 102: clock_init();
! 103: device_init();
! 104:
! 105: /*
! 106: * Set up boot tasks and
! 107: * start scheduler.
! 108: */
! 109: task_bootstrap();
! 110: sched_unlock();
! 111: thread_idle();
! 112:
! 113: /* NOTREACHED */
! 114: return 0;
! 115: }
CVSweb