Example #1
0
/**********************************************
Starting point of the whole OS
*************************************************/
int
kmain()
{
	int i, h;
	char * buffer = calloc(512 , 1);
	_Cli();
	k_clear_screen();
	printf("screen clear\n");
	//cache_initarray();
	printf("array init\n");
	//cache_sortarray();
	printf("array sort\n");

	initializeSemaphoreTable();
	printf("semaphore init\n");
	initializeIDT();
	unmaskPICS();
	initializePaging();
	_StartCR3();
	SetupScheduler();
	//printf("after SetupScheduler\n");

	for(h = 0; h < 200; h++){
		write_disk(0,h,buffer,BLOCK_SIZE,0);
	}

	fd_table = (filedescriptor *)calloc(100,1);
	masterBootRecord * mbr = (masterBootRecord *)malloc(512);
	superblock = (masterBlock*)malloc(512);		
	bitmap = (BM*)calloc(BITMAP_SIZE,1);	
	inodemap = (IM*)calloc(INODEMAP_SIZE,1);
	
	read_disk(0,0,mbr,BLOCK_SIZE,0);

	if ( mbr->existFS == 0 ){
		init_filesystem("Chinux", mbr);
	}else{
		load_filesystem();
	}
	
	ready = NULL;
	for(i = 0; i < 4; i++)
		startTerminal(i);

	//free(mbr);
	logPID = CreateProcessAt("Login", (int(*)(int, char**))logUser, 0, 0, (char**)0, PAGE_SIZE, 4, 1);
	_Sti();

	while(TRUE)
	;
	return 1;
}
Example #2
0
int main()
{	
	print_msg("Initializing IDT... ", GREEN, BLUE);
	initializeIDT();
	print_msg("Done\n", GREEN, BLUE);

	print_msg("Setting up system calls... ", GREEN, BLUE);
	setupSystemcalls();
	print_msg("Done\n", GREEN, BLUE);
	
	print_msg("Calling console...\n", GREEN, BLUE);
	clear_screen();
	((EntryPoint)consoleAddress)();
	print_msg("Done\n", GREEN, BLUE);

	while(1);
	return 0;
}