kmain() { int i,num; /* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0 */ setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0); /* Carga de IDTR */ idtr.base = 0; idtr.base +=(dword) &idt; idtr.limit = sizeof(idt)-1; _lidt (&idtr); _Cli(); /* Habilito interrupcion de timer tick*/ //_mascaraPIC1(INT_08 & INT_09 & INT_80); _mascaraPIC1(0x00); _mascaraPIC2(NONE); _Sti(); initKeyBoard(); initVideo(); initShell(); doubleFlagsFix(1.1); while (1) { updateShell(); } }
void setup_IDTR() { idtr.base = 0; idtr.base += (dword) &idt; idtr.limit = sizeof(idt) - 1; _lidt(&idtr); }
kmain() { terminal_init(); setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x74], 0x08, (dword)&_int_74_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0); /* IDTR Setting */ idtr.base = 0; idtr.base +=(dword) &idt; idtr.limit = sizeof(idt)-1; _lidt(&idtr); /* Interrupt unmasking */ _cli(); _maskPIC1(0xF8); /*0XF8*/ _maskPIC2(0xEF); /*0XEF*/ _sti(); video_init(); timertick_init(); rtc_init(); mouse_init(); shell_run(); }
void initializeIDT() { setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x79], 0x08, (dword)&_int_79_hand, ACS_INT, 0);/*for block_process and kill*/ idtr.base = 0; idtr.base += (dword)&idt; idtr.limit = sizeof(idt) - 1; _lidt (&idtr); return; }
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(); } }
void load_idt() { setup_IDT_entry (0x20, 0x08, (uint64_t)&_irq00Handler, ACS_INT); setup_IDT_entry (0x21, 0x08, (uint64_t)&_irq01Handler, ACS_INT); setup_IDT_entry (0x80, 0x08, (uint64_t)&_syscallHandler, ACS_INT); idtr.base = 0; idtr.base += (uint64_t) &idt; idtr.limit = (uint16_t) sizeof(idt)-1; _lidt(&idtr); //Solo interrupcion de teclado y timer tick habilitadas picMasterMask(0xFC); picSlaveMask(0xFF); _sti(); }
kmain() { int i,num; int flag = 0; int vendor = 0xffff; /* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0 y IRQ1 */ // setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0); /* Por default el teclado esta en ingles */ setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand_US,ACS_INT, 0); /* Carga de IDTR */ idtr.base = 0; idtr.base +=(dword) &idt; idtr.limit = sizeof(idt)-1; _lidt (&idtr); _Cli(); /* Habilito interrupcion del teclado */ _mascaraPIC1(0xFD); _mascaraPIC2(0xFF); _Sti(); /* Se inicia el shell */ shell(); }
/********************************************** kmain() Punto de entrada de código C. *************************************************/ kmain() { int i, num; // Paging.start(0x200000); // init_malloc(); initialize_pics(0x20,0x70); setup_IDT_entry(&idt[0x70], 0x08, (dword) & _rtc, ACS_INT, 0); _cache_init(); hdd_init(); /* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0 */ setup_IDT_entry (&idt[0x00], 0x08, (dword)&_int_00_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x01], 0x08, (dword)&_int_01_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x02], 0x08, (dword)&_int_02_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x03], 0x08, (dword)&_int_03_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x04], 0x08, (dword)&_int_04_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x05], 0x08, (dword)&_int_05_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x06], 0x08, (dword)&_int_06_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x07], 0x08, (dword)&_int_07_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x0A], 0x08, (dword)&_int_0A_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x0B], 0x08, (dword)&_int_0B_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x0C], 0x08, (dword)&_int_0C_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x0D], 0x08, (dword)&_int_0D_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x0E], 0x08, (dword)&_int_0E_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x0F], 0x08, (dword)&_int_0F_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x10], 0x08, (dword)&_int_10_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x11], 0x08, (dword)&_int_11_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x12], 0x08, (dword)&_int_12_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x13], 0x08, (dword)&_int_13_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x14], 0x08, (dword)&_int_14_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x15], 0x08, (dword)&_int_15_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x16], 0x08, (dword)&_int_16_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x17], 0x08, (dword)&_int_17_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x18], 0x08, (dword)&_int_18_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x19], 0x08, (dword)&_int_19_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x1A], 0x08, (dword)&_int_1A_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x1B], 0x08, (dword)&_int_1B_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x1C], 0x08, (dword)&_int_1C_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x1D], 0x08, (dword)&_int_1D_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x1E], 0x08, (dword)&_int_1E_hand, ACS_INT, 0); setup_IDT_entry (&idt[0x1F], 0x08, (dword)&_int_1F_hand, ACS_INT, 0); // setup_IDT_entry (&idt[0x20], 0x08, (dword)&_int_20_hand, ACS_INT, 0); // setup_IDT_entry (&idt[0x21], 0x08, (dword)&_int_21_hand, ACS_INT, 0); setup_IDT_entry(&idt[0x20], 0x08, (dword) & _timer_tick_hand, ACS_INT, 0); /* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ1 */ setup_IDT_entry(&idt[0x21], 0x08, (dword) & _KB_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); /* CARGA DE IDT CON LA RUTINA DE ATENCION DE int79h */ setup_IDT_entry(&idt[0x79], 0x08, (dword) & _int_79_hand, ACS_INT, 0); /* Carga de IDTR */ idtr.base = 0; idtr.base += (dword) & idt; idtr.limit = sizeof(idt) - 1; _lidt(&idtr); Cli(); int rate = 0x06; _outb(0x70, 0x0A); //set index to register A char prev=_inb(0x71); //get initial value of register A _outb(0x70, 0x0A); //reset index to A _outb(0x71, (prev & 0xF0) | rate); //write only our rate to A. Note, rate is the bottom 4 bits. init_paging(); scheduler_init(); /* Habilito interrupcion de timer tick*/ _mascaraPIC1(0xFC); _mascaraPIC2(0xFE); _outb(0x70, 0x0B); //set the index to register B prev= _inb(0x71); //read the current value of register B _outb(0x70, 0x0B); //set the index again(a read will reset the index to register D) _outb(0x71, prev | 0x40); //write the previous value or'd with 0x40. This turns on bit 6 of register B Sti(); idle = create_process("idle", idle_main, 0, 0, 0, 0, 0, 0, 0, NULL, 0); // We soon exit out of here :) while (1); }
/********************************************** kmain() Punto de entrada de código C. *************************************************/ kmain() { int i, num; setup_IDT_entry(&idt[0x70], 0x08, (dword) & _rtc, ACS_INT, 0); /* 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); /* CARGA DE IDT CON LA RUTINA DE ATENCION DE int79h */ setup_IDT_entry(&idt[0x79], 0x08, (dword) & _int_79_hand, ACS_INT, 0); /* Carga de IDTR */ idtr.base = 0; idtr.base += (dword) & idt; idtr.limit = sizeof(idt) - 1; _lidt(&idtr); Cli(); int rate = 0x06; _outb(0x70, 0x0A); //set index to register A char prev=_inb(0x71); //get initial value of register A _outb(0x70, 0x0A); //reset index to A _outb(0x71, (prev & 0xF0) | rate); //write only our rate to A. Note, rate is the bottom 4 bits. scheduler_init(); /* Habilito interrupcion de timer tick*/ _mascaraPIC1(0x00); _mascaraPIC2(0x00); _outb(0x70, 0x0B); //set the index to register B prev= _inb(0x71); //read the current value of register B _outb(0x70, 0x0B); //set the index again(a read will reset the index to register D) _outb(0x71, prev | 0x40); //write the previous value or'd with 0x40. This turns on bit 6 of register B Sti(); idle = create_process("idle", idle_main, 0, 0, 0, 0, 0, 0, 0, NULL, 0); // We soon exit out of here :) while (1); }