Annotation of prex-old/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: * This is called from kernel_start() routine that
! 52: * is implemented in the architecture dependent layer.
! 53: * We assumes that the following machine state are
! 54: * already set before this routine.
! 55: * - Kernel BSS section is filled with 0.
! 56: * - Kernel stack is configured.
! 57: * - All interrupts are disabled.
! 58: * - Minimum page table is set. (MMU only)
! 59: */
! 60: void
! 61: kernel_main(void)
! 62: {
! 63:
! 64: /*
! 65: * Do machine-dependent
! 66: * initialization.
! 67: */
! 68: diag_init();
! 69: printk(BANNAR);
! 70: sched_lock();
! 71: machine_init();
! 72:
! 73: /*
! 74: * Initialize memory managers.
! 75: */
! 76: page_init();
! 77: mmu_init();
! 78: kmem_init();
! 79: vm_init();
! 80:
! 81: /*
! 82: * Initialize kernel core.
! 83: */
! 84: task_init();
! 85: thread_init();
! 86: sched_init();
! 87: exception_init();
! 88: timer_init();
! 89:
! 90: /*
! 91: * Initialize IPC related stuff.
! 92: */
! 93: object_init();
! 94: msg_init();
! 95:
! 96: /*
! 97: * Enable interrupt and
! 98: * initialize devices.
! 99: */
! 100: irq_init();
! 101: clock_init();
! 102: device_init();
! 103:
! 104: /*
! 105: * Set up boot tasks and
! 106: * start scheduler.
! 107: */
! 108: task_bootstrap();
! 109: sched_unlock();
! 110:
! 111: /*
! 112: * Enter idle loop.
! 113: */
! 114: thread_idle();
! 115: /* NOTREACHED */
! 116: }
CVSweb