#include "kernel.h" // general kernel config & includes #include "console.h" // this will allow us to write to screen // TODO: cleanup . how can i compile it without the includes!?? /////// void int_kb_handler(); void int_clock_handler(); ////////// KERNEL MAIN///// ///// // // test handler void int_test_handler() { __asm__("pusha"); scr_put_string("inside software interrupt handler 88"); __asm__("popa"); __asm__("leave"); __asm__("iret"); } void kernel_main() { // clear console scr_clear(); // hello message scr_put_string_nl(KERNEL_HELLO_MESSAGE); //pit config timer_init(); scr_put_string_nl("Configured PIT Channel 0 : Mode 2 : 1/25 s."); // init and interrupt decriptor table int_init(0x08); int_install(); // setup custom interrupts // remember that we shifted all interrupts with the pic by 32 // so clock = 32 (irq 0) // keyboard = 22 (irq 1) // etc.. // install pit handler (programmable timer interrupt channel0) int_install_ir(32, 0b10001110, 0x08,&int_clock_handler); // install keyboard handler int_install_ir(33, 0b10001110, 0x08,&int_kb_handler); // install test handler int_install_ir(88, 0b10001110, 0x08,&int_test_handler); // now we can enable interrupts back again int_enable(); scr_put_string_nl("Interrupts are up and running"); // kernel main loop while(1) { } }