#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 _kernel_end; void kernelMain() { initMemoryAllocation( 0x1000000); // initializing stacks after the kernel seems not to work :( // otherwise, _kernel_end should be passed here 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(); } }