Exemple #1
0
// 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();
}
Exemple #2
0
/* 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();
}