/** * Kernel entry point */ void kmain(struct multiboot_info* info, unsigned int magic) { initMemoryMap(info); mm_pagination_init(); setupGDT(); setupIDT(); stdin = STACK_TOP_MAPPING; stdout = (STACK_TOP_MAPPING + sizeof(FILE)); stderr = (STACK_TOP_MAPPING + 2 * sizeof(FILE)); cache_init(); ata_init(info); fs_load(); fifo_init(); scheduler_init(); struct Process* idleProcess = process_table_new(idle, "idle", NULL, 1, NO_TERMINAL, 0); struct Process* shellProcess = process_table_new(tty_run, "tty", idleProcess, 1, NO_TERMINAL, 0); struct Process* cacheProcess = process_table_new(cache_flush, "cache_flush",idleProcess, 1, NO_TERMINAL, 0); yield(); while (1) {} }
static void init() { setupIDT(); for (uint32_t i = 0; i < 16; i++) { _handlers.push_back(nullptr); //_sharedHandlers.push_back(std::list<InterruptHandler*>()); } }
//main entry point for the kernel int kmain() { setup_Com1(); char doneText[] = "Done.\n"; clearScreen(); //clear the screen of whatever was there //print welcome message char osVersion[] = "CirnOS v0.0.1\n"; fb_write(osVersion, 14); //set up the GDT table char gdtSetup[] = "Setting up GDT...\n"; fb_write(gdtSetup, 18); setupGDT(); fb_write(doneText, 6); //set up IDT table char idtSetup[] = "Setting up IDT...\n"; fb_write(idtSetup, 18); setupIDT(); fb_write(doneText, 6); //Program Pic char picSetup[] = "Programming PIC...\n"; fb_write(picSetup, 19); program_pic(); fb_write(doneText, 6); char pagingSetup[] = "Setup PDT (identity, 4MB pages) and enabling paging...\n"; fb_write(pagingSetup, 100); setup_pdt_enable_paging(); fb_write(doneText, 6); char testStart[] = "Begining print tests.\n"; fb_write(testStart, 22); //setup and write to Com1 serial port serial_write(osVersion, 14); serial_write(testStart, 21); char printfTest[] = "Printf test string: %c, %c, %d, %x.\n"; printf(SERIAL, printfTest, 'c', 'd', -30, 0xCAFEBABE); printf(FRAMEBUFFER, printfTest, 'c', 'd', -30, 0xCAFEBABE); //repeatText(); //repeat some dummy text return 0; //return value will be in EAX register, return 0 for now }