Ejemplo n.º 1
0
/**
 * Kernel state reset before syscall tests.
 */
void reset() {
    initialize_memory();
    initialize_tasks();
    initialize_scheduling();
    initialize_messaging();

    t0 = task_create(0, 0, MEDIUM);
    t1 = task_create(0, 0, MEDIUM);
    t2 = task_create(0, 1, MEDIUM);
}
Ejemplo n.º 2
0
void initialize_kernel() {
    bwsetfifo(COM2, OFF);

    void (**syscall_handler)() = (void (**)())0x28;
    *syscall_handler = &kernel_enter;

    void (**irq_handler)() = (void (**)())0x38;
    *irq_handler = &irq_enter;

    initialize_cache();
    initialize_memory();
    initialize_fine_timer();
    initialize_scheduling();
    initialize_tasks();
    initialize_messaging();
    initialize_events();
    initialize_waiting();
}
Ejemplo n.º 3
0
void start(uint32_t* modulep, void* physbase, void* physfree)
{
	struct smap_t {
		uint64_t base, length;
		uint32_t type;
	}__attribute__((packed)) *smap;
	while(modulep[0] != 0x9001) modulep += modulep[1]+2;
	for(smap = (struct smap_t*)(modulep+2); smap < (struct smap_t*)((char*)modulep+modulep[1]+2*4); ++smap) {
		if (smap->type == 1 /* memory */ && smap->length != 0) {
			//print_out("Available Physical Memory [%x-%x]\n", smap->base, smap->base + smap->length);
			total = smap->base + smap->length;
		}
	}
	//print_out("tarfs in [%p:%p]\n", &_binary_tarfs_start, &_binary_tarfs_end);
	
	total = (total/1048576) +1;
        //print_out(" The Highest memory is %d ",total);
        //print_out("This is the address of physfree -- %p             ", physfree);
        initialize_free_pages();
        initialize_tasks();
	register_fs((uint64_t)&_binary_tarfs_start);
        create_page_tables(physfree);
        //print_out("     Successfully created page tables");

	__asm__("cli;");

	file = parse_elf("bin/shell");
        load_file_list = file->load_list;
        load_shell();
	/*
	file = parse_elf("bin/hello");
	load_file_list = file->load_list;	
	load_file();
	*/
	file = parse_elf("bin/try");
	load_file_list = file->load_list;	
	load_file();

	switch_to(0);
	// kernel starts here
	while(1);
}
Ejemplo n.º 4
0
int main()
{
	global_time = 0;
	initialize_battery();
	initialize_task_list();
	initialize_tasks();
	while (true) {
		schedule();
		global_time++;
		//		printf ("%d\t", global_time);
		input_task();
		//		if (input_task() < 0) {
		//			printf ("No additional tasks at time %d!\n", global_time);
		//		}
		if (global_time > 1500) 
			break;
	}
	printf ("\n-------------------------------\n");
	printf ("HDRT : %d miss %d ratio %f\n", hdrt, hdrtmt, (double)hdrtmt/hdrt);
	printf ("SFRT : %d miss %d ratio %f\n", sfrt, sfrtmt, (double)sfrtmt/sfrt);
	printf ("NOML : %d miss %d ratio %f\n", nml, nmlmt, (double)nmlmt/nml);
	return 0;
}