#include <_stdio.h> #include <alloc.h> #include <cpuid.h> #include <devices.h> #include <interrupts.h> #include <message.h> #include <osTasks.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(); drawLogo(); setupDevices(); setupInterrupts(); printf("cpu data:\n"); printCPUData(); while (1) { if (isTaskQueueEmpty()) { asm volatile("hlt"); } Message *message; while (message = popBeginning(&(getCurrentTask()->messages))) { switch (message->type) { case KEYBOARD_CHAR: printf("%c", message->data); break; case KEYBOARD_STRING: printf("%s", message->data); break; default: printf("unhandeled message recieved!\n"); } free(message); } yields(); } }