Newer
Older
tree-os / src / kernel / kernel.c
@lukas lukas on 24 Sep 2021 666 bytes add capital typing
#include <_stdio.h>
#include <alloc.h>
#include <cpuid.h>
#include <devices.h>
#include <interrupts.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 (getCurrentTask()->nextTask == 0) {
            asm volatile("hlt");
        }
        yields();
    }
}