void kernel_main(struct mboot_info_struct *mbinfo) { // addr = (int*) kernel_main; // log("[LOAD] " DISTNAME " kernel is started. Disabling interrupts..."); log("[DISCLAIMER] " DISTNAME " is totally free. If you have bought it, please report us seller's contact information to prevent further project law violation."); asm("cli"); log("done."); log("[INFO] Setting up GDT..."); gdt_install(); log("done."); log("[INFO] Setting up IDT..."); idt_install(); log("done."); log("[INFO] Setting up ISRs..."); isrs_install(); log("done."); log("[INFO] Setting up IRQ handlers..."); irq_install(); log("done."); asm("sti"); log("[INFO] Setting up fonts..."); setupFonts(); log("done."); log("[INFO] Initializing PIC..."); //kprint("OS365 Kernel 1.0 is loaded.\nInitializing PIC...",0,0); init_pics(0x20,0x28); log("done."); //setupPaging(); //asm("int $8"); //kprint("\nAll pre-start processes are finished. Preparing to load shell...\n",0,8); log("[INFO] Setting VBE graphics mode..."); //sleep(18); //setGraphicsMode(); vbe_info_t* vbeInfo=(vbe_info_t*)(uint32_t)mbinfo->vbe_mode; framebuffer =(uint8_t*)(mbinfo->framebuffer_addr); fbpitch =mbinfo->framebuffer_pitch; fbbpp =mbinfo->framebuffer_bpp; //memset((void*)framebuffer,0x004DFF,1024*768*3); initKbd(); log("done."); //mouse_install(); log("[INFO] Setting up the timer..."); setupPIT(); log("done."); log("[INFO] Loading Z Window System..."); //abort(); while(true) { shellStart(); fRun=true; log("[WARNING] Error in program: Not returned to Z"); log("[INFO] Getting back to Z..."); } }
kmain() { int i, num; /* Borra la pantalla. */ /* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0 */ setup_IDT_entry(&idt[0x08], 0x08, (dword) & _int_08_hand, ACS_INT, 0); /* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ1 */ setup_IDT_entry(&idt[0x09], 0x08, (dword) & _int_09_hand, ACS_INT, 0); /* CARGA DE IDT CON LA RUTINA DE ATENCION DE int80h */ setup_IDT_entry(&idt[0x80], 0x08, (dword) & _int_80_hand, ACS_INT, 0); //TODO: CARGAR LA PAG DE TABLAS /* Carga de IDTR */ idtr.base = 0; idtr.base += (dword) & idt; idtr.limit = sizeof(idt) - 1; _lidt(&idtr); _Cli(); /* Habilito interrupcion de timer tick*/ _mascaraPIC1(0xFC); _mascaraPIC2(0xFF); _Sti(); startKeyboard(); initVideo(); shellStart(); /* KeepAlive loop */ while (1) { // Main del shell shellMain(); } }