Example #1
0
/* called from arch code */
void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3)
{
	// save the boot args
	lk_boot_args[0] = arg0;
	lk_boot_args[1] = arg1;
	lk_boot_args[2] = arg2;
	lk_boot_args[3] = arg3;

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	lk_primary_cpu_init_level(LK_INIT_LEVEL_EARLIEST, LK_INIT_LEVEL_ARCH_EARLY - 1);
	arch_early_init();

	// do any super early platform initialization
	lk_primary_cpu_init_level(LK_INIT_LEVEL_ARCH_EARLY, LK_INIT_LEVEL_PLATFORM_EARLY - 1);
	platform_early_init();

	// do any super early target initialization
	lk_primary_cpu_init_level(LK_INIT_LEVEL_PLATFORM_EARLY, LK_INIT_LEVEL_TARGET_EARLY - 1);
	target_early_init();

#if WITH_SMP
	dprintf(INFO, "\nwelcome to lk/MP\n\n");
#else
	dprintf(INFO, "\nwelcome to lk\n\n");
#endif
	dprintf(INFO, "boot args 0x%lx 0x%lx 0x%lx 0x%lx\n",
		lk_boot_args[0], lk_boot_args[1], lk_boot_args[2], lk_boot_args[3]);

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	lk_primary_cpu_init_level(LK_INIT_LEVEL_TARGET_EARLY, LK_INIT_LEVEL_HEAP - 1);
	heap_init();

	// initialize the kernel
	lk_primary_cpu_init_level(LK_INIT_LEVEL_HEAP, LK_INIT_LEVEL_KERNEL - 1);
	kernel_init();

	lk_primary_cpu_init_level(LK_INIT_LEVEL_KERNEL, LK_INIT_LEVEL_THREADING - 1);

	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	t->pinned_cpu = 0;
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
}
Example #2
0
File: main.c Project: sndnvaps/lk-1
void lk_main(void)
{
	inc_critical_section();

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	lk_init_level(LK_INIT_LEVEL_ARCH_EARLY - 1);
	arch_early_init();

	// do any super early platform initialization
	lk_init_level(LK_INIT_LEVEL_PLATFORM_EARLY - 1);
	platform_early_init();

	// do any super early target initialization
	lk_init_level(LK_INIT_LEVEL_TARGET_EARLY - 1);
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");
#if WITH_PLATFORM_MSM_SHARED
	bs_set_timestamp(BS_BL_START);
#endif

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	lk_init_level(LK_INIT_LEVEL_HEAP - 1);
	heap_init();

#if WITH_PLATFORM_MSM_SHARED
	__stack_chk_guard_setup();
#endif

	// initialize the kernel
	lk_init_level(LK_INIT_LEVEL_KERNEL - 1);
	kernel_init();

	lk_init_level(LK_INIT_LEVEL_THREADING - 1);

#if (!ENABLE_NANDWRITE)
	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
#else
	bootstrap_nandwrite();
#endif
}
Example #3
0
File: main.c Project: KortanZ/linux
void kmain(void)
{
	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	arch_early_init();

	// do any super early platform initialization
	platform_early_init();

	// do any super early target initialization
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");
	bs_set_timestamp(BS_BL_START);

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	heap_init();

	__stack_chk_guard_setup();

	// initialize the threading system
	dprintf(SPEW, "initializing threads\n");
	thread_init();

	// initialize the dpc system
	dprintf(SPEW, "initializing dpc\n");
	dpc_init();

	// initialize kernel timers
	dprintf(SPEW, "initializing timers\n");
	timer_init();

#if (!ENABLE_NANDWRITE)
	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_resume(thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE));

	// enable interrupts
	exit_critical_section();

	// become the idle thread
	thread_become_idle();
#else
        bootstrap_nandwrite();
#endif
}
Example #4
0
void kmain(void)
{
	task_t	*task_shell;
	int	 ret;

	/*************** Init Arch ****************/
	arch_early_init();

	show_logo();

	/*************** Init Platform ****************/
	platform_init();
	timer_init();
	buses_init();

	/*************** Init Task ****************/
	task_init();
	task_create_init();

	/*************** Init Workqueu ****************/
	init_workqueues();
	
	/*************** Init File System ****************/
	register_filesystem(&fat_fs);
	
	/*************** Creating Shell TASK ****************/
	task_shell = task_alloc("shell", 0x2000, 5);
	if (NULL == task_shell)
	{
		return;
	}

	ret = task_create(task_shell, init_shell, 0);
	if (ret) {
		printk("Create init shell task failed\n");
	}

	sema_init(&sem, 1);

	arch_enable_ints();

	while(1)
	{
		enter_critical_section();
		arch_idle();
		task_schedule();
		exit_critical_section();
	}

	task_free(task_shell);
}
Example #5
0
void kmain()
{
	irq_disable();
	/* 
	 * A primeira coisa a se fazer é iniciar todo o gerenciador
	 * de memória.
	 */
	mm_init();
	arch_early_init();
	ioremap_init();
	irq_init();
	sched_init();
	timer_init();
	/* 
	 * Neste momento temos o gerenciador de memória e escalonador prontos,
	 * já podemos habilitar as interrupções, que podem ser utilizadas
	 * pelos drivers.
	 */
	irq_enable();

	/* Inicia os drivers da plataforma */
	arch_setup();

	/* Requisita um modo se existir um framebuffer*/
	fb_set_mode();
	/* Inicia o console sobre o framebuffer */
	fb_console_init();
	kernel_info();

#if 1
	irq_disable();
	semaphore_init(&sem, 1);
	create_task("a", 4);
	create_task("b", 5);
	create_task("c", 6);
	create_task("d", 7);
	create_task("b", 8);
	create_task("b", 9);
	irq_enable();
	/* Fica de boas esperando as trocas de contexto */
#endif
	/* Como queremos imprimir para depuração do driver, inicializamos ele agora */
	//bcm2835_emmc_init();
	for (;;) {
		led_blink();
		//printk("-");
	}
}
Example #6
0
void main(struct multiboot *mboot) {

    int rc;

    /* init the kmsg buffer and printk */
    console_sys_init();
    kmsg_init();
    console_register(&kmsg_con);

    /* arch might want to setup stuff */
    arch_early_init();

    printk("kmsg: buffer setup!\n");

    printk("sys: kernel relocation: 0x%x -> 0x%x  size 0x%x\n",
        &kernel_base, &kernel_end, 
        (uintptr_t)&kernel_end - (uintptr_t)&kernel_base);

    parse_multiboot(mboot);

    paging_fini();

    heap_install();

    /* arch should finish init now */
    arch_late_init();

    printk("sys: init done!\n");

    drivers_init();
    do_mount();
    do_test();
    syscall_init();
    /* wait forever */
    asm volatile("mov $0x1337, %eax");
    asm volatile("mov $0x1337, %ebx");
    asm volatile("mov $0x1337, %ecx");
    asm volatile("mov $0x1337, %edx");
    start_sched();
    panic("finished with main, but no idle task was started\n");
}
Example #7
0
void lk_main(void)
{
	inc_critical_section();

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	arch_early_init();

	// do any super early platform initialization
	platform_early_init();

	// do any super early target initialization
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	heap_init();

	// initialize the kernel
	kernel_init();

	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
}