/*********************************************************** * Name: * main * Description: * Start Function of the Kernel * Parameter: * ReturnValue: * EXIT_SUCCESS * **********************************************************/ void main() { /* Global Descriptor Table setup */ gdt_setup(); /* Interrupt Descriptor Table setup */ idt_setup(); /* Setup Interrupts */ irq_setup(); /* Setup Empty Devices */ device_setup(); /* Initialize Video Device -> Device does not send Interrupts */ initializeDevice(0,(char *)0xB8000,DEVICE_VIDEO,NULL,IRQ_EMPTY); /* Initialize Keyboard Handler */ initializeDevice(1,NULL,DEVICE_KEYBOARD,irq_keyboard_handler,IRQ_KEYBOARD); /* set Video Device for Console */ setVideoDevice(getDevice(0,DEVICE_VIDEO)); /* Initialize the Character Buffer */ initLineBuffer(); /* Clear Screen on Video Device */ clear_screen(); /* Printing OS Headers */ printf("\t\t-------------------------\n", C437_GREEN); printf("\t\tWELLCOME TO "OS_NAME"\n", C437_GREEN); printf("\t\t-------------------------\n", C437_GREEN); printf("\t\t"OS_NAME" version "OS_VERSION", Copyright (C) 2012 Simon Sommer\n", C437_CYAN); printf("\t\t"OS_NAME" comes with ABSOLUTELY NO WARRANTY.\n", C437_CYAN); printf("\t\tThis is free software, and you are\n", C437_CYAN); printf("\t\twelcome to redistribute it under certain conditions.\n", C437_CYAN); /* Enable Full 4GB Memory */ enableA20(); printf("\t\tA20 GATE ACTIVATED\n", C437_GREEN); /* Gives Feedback of previus done Tasks */ printf("\t\tGDT SETUP DONE\n", C437_GREEN); printf("\t\tIDT SETUP DONE\n", C437_GREEN); printf("\t\tIRQ SETUP DONE\n", C437_GREEN); /* Enable Iterrupts */ __asm__ __volatile__ ("sti"); printf("\t\tINTERRUPTS ENABLED\n", C437_GREEN); while(1); /* TODO: Malloc and Free Debug and Final Test */ }
void setup_interrupts(void) { if(!idt_setup()) puts("Error while setting up IDT"); else if(!isrs_setup()) puts("Error while setting up ISRs"); else if(!irq_setup()) puts("Error while setting up IRQs"); else if(!timer_setup()) puts("Error while setting up timer"); else puts("interruptions setup correctly"); }
int main() { gdt_setup(); idt_setup(); isr_setup(); init_video(); irq_setup(); __asm__ __volatile__ ("sti"); timer_setup(); keyboard_setup(); puts(" Welcome to TIK! \n"); for (;;); return 0; }
void boot() { //Initialise display and print message video_text_cls(); video_text_puttext("KAOS version 1\nDeveloped by Karl Hobley.\n\nCopyleft (C) 2011 Karl Hobley.\nKAOS is released under the GPLv3 Licence.\n\nBuild date: "__DATE__" "__TIME__"\n\n\n\n"); //Setup kernel video_text_puttext("Loading GDT "); gdt_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading IDT "); idt_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading ISR "); isr_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading IRQ "); irq_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Enabling Interrupts "); __asm__ __volatile__("sti"); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading Timer "); timer_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading Keyboard "); keyboard_setup(); video_text_puttext("[ DONE ]\n"); //Test panic volatile int a = 1; volatile int b = 0; volatile int c = a / b; }