예제 #1
0
파일: kernel.c 프로젝트: Dennisbonke/DB-OS
// TODO: Kernel init functions, kernel_early_init stub is here, kernel_init is just a declaration to shut the linker up.
void kernel_early_init(struct multiboot *mboot_header, addr_t initial_stack)
{
	// This is fun, but as long as grub is a bitch, i have a problem.
	// Make sure interrupts are disabled.
	//asm volatile("cli");
	// Store passed values, and set up the early system.
	kernel_state_flags = 0;
	set_ksf(KSF_BOOTING);
	mtboot = mboot_header;
	initial_boot_stack = initial_stack;
	loader_parse_kernel_elf(mboot_header, &kernel_sections);
#if _DBOS_KERNEL_LOADER_MODULES
	loader_init_kernel_symbols();
#endif
	serial_init();
	cpu_early_init();
#if _DBOS_KERNEL_LOADER_MODULES
	loader_init_modules();
#endif
	syscall_init();
	cpu_timer_install(1000);
	cpu_processor_init_1();
	printk(8, "[KERNEL]: Parsed kernel elf, end of stub function. If you see this, then it is working.\n");
	printk(1, "[KERNEL]: Starting system management.\n");
	mm_init(mtboot);
	tm_init_multitasking();
	dm_init();
	fs_init();
}
예제 #2
0
void main (uint32_t mboot_magic, uint32_t mboot_info)
    {
    multiboot_memmap_t *first_free;
    uint64_t *new_stack;

    asm volatile ("cli");

    cpu_early_init();

    x64_gdt_init();

    x64_idt_init();

    vga_console_init();

    printk("\n================================\n");
    printk("||==Welcome to CELLOS 64 bit==||");
    printk("\n================================\n");

    /* Read mboot header */

    first_free = mboot_init(mboot_info, mboot_magic);

    if (first_free == NULL)
        {
        panic("No free memory for use! STOP~!\n");
        }

    mb_parse_kernel_image();
    
    paging_init(first_free->base_addr,
                    first_free->base_addr + first_free->length);

    /* Init page allocator */

    page_alloc_init(mem_get_low_addr(),mem_get_high_addr());

    /* Initialize the memory pool */
    init_memory_pool(CONFIG_KHEAP_SIZE,
                    (void *)page_alloc_contig(CONFIG_KHEAP_SIZE/PAGE_SIZE));

    detect_cpu();

    acpi_init();

    smp_init();

    paging_late_init();

    sched_core_init();

    sched_init();

    reschedule();
    
    /* No reached */ 
    }
예제 #3
0
파일: main.c 프로젝트: dbittman/seakernel
/* This is the C kernel entry point */
void kmain(struct multiboot *mboot_header, addr_t initial_stack)
{
	/* Store passed values, and initiate some early things
	 * We want serial log output as early as possible */
	kernel_state_flags=0;
	mtboot = mboot_header;
	initial_boot_stack = initial_stack;
	loader_parse_kernel_elf(mboot_header, &kernel_sections);
#if CONFIG_MODULES
	loader_init_kernel_symbols();
#endif
	serial_init();
	cpu_early_init();
#if CONFIG_MODULES
	loader_init_modules();
#endif
	syscall_init();
	fs_initrd_load(mtboot);
	cpu_timer_install(1000);
	cpu_processor_init_1();

	/* Now get the management stuff going */
	printk(1, "[kernel]: Starting system management\n");
	mm_init(mtboot);
	syslog_init();
	parse_kernel_command_line((char *)(addr_t)mtboot->cmdline);
	tm_init_multitasking();
	dm_init();
	fs_init();
	net_init();
	trace_init();
	/* Load the rest... */
	printk(KERN_MILE, "[kernel]: Kernel is setup (kv=%d, bpl=%d: ok)\n", 
	       CONFIG_VERSION_NUMBER, BITS_PER_LONG);
	printk(KERN_DEBUG, "[kernel]: structure sizes: process=%d bytes, thread=%d bytes, inode=%d bytes\n",
			sizeof(struct process), sizeof(struct thread), sizeof(struct inode));
	cpu_interrupt_set(1);
	sys_setup();
	cpu_processor_init_2();
	timer_calibrate();
#if CONFIG_SMP
	if(boot_cpus)
		cpu_boot_all_aps();
#endif
	tm_clone(0, __init_entry, 0);
	sys_setsid();
	kt_kernel_idle_task();
}
예제 #4
0
파일: init.c 프로젝트: dtbinh/M2
void _start() {
    BoardEarlyInit();
    cpu_early_init();

    BoardConsoleInit();
    BoardConsolePuts("\n\n================\nuC-sdk - booting\n================\n");

    libc_init();

    BoardInit();
    cpu_init();

    BoardLateInit();
    cpu_late_init();

    exit(main(0, NULL, NULL));
}