#include <_stdio.h> #include <alloc.h> #include <cpuid.h> #include <devices.h> #include <hardDrive.h> #include <interrupts.h> #include <message.h> #include <osTasks.h> #include <pci.h> #include <stdint.h> #include <task.h> #include <tree-os.h> extern uint32_t kernelEnd; void kernelMain() { initMemoryAllocation(kernelEnd); initOSTasks(); getCurrentTask()->timerTicks = 1000; getCurrentTask()->ticksLeft = 1000; drawLogo(); yields(); setupDevices(); setupInterrupts(); printCPUData(); scanPCIDevices(); scanHardDrives(); while (1) { for (Message *message = popBeginning(&(getCurrentTask()->messages)); message; message = popBeginning(&getCurrentTask()->messages)) { switch (message->type) { case KEYBOARD_CHAR: printf("%c", message->data); break; case KEYBOARD_STRING: printf("%s", message->data); break; case TIMER_UPDATE: printf("\e[s\e[Htime since power on: %i seconds\e[u", (uint32_t)message->data / 1000); } free(message); } yield(); } }