Newer
Older
tree-os / src / kernel / kernel.c
#include <stdint.h>
#include <lib/textMode/stdio.h>
#include <tree-os.h>
#include <lib/textMode/cursor.h>
#include <lib/task/task.h>
#include <lib/memory/alloc.h>
#include <lib/task/osTasks.h>

extern uint32_t _kernel_end;

void kernelMain() {
    drawLogo();
    initMemoryAllocation(0x100000); // initializing stacks after the kernel seems not to work :( otherwise, _kernel_end should be passed here
    initOSTasks();
    printf("Switching to otherTask... \n");
    yields();
    printf("Returned to mainTask!\n\n");
    // for (int i = 0; i < 20; i++) {
    //     printf("%x\n", i);
    // }
    char* data = "Hello World from the new system!\n";
    Message message;
    message.data = data;
    message.size = strlen(data);
    message.next = 0x00;
    sendMessage(getPrinterTask(), &message);
    schedule(getPrinterTask());
    yield();
}