42_KFS/src/kernel.c
2025-04-17 15:09:22 +02:00

80 lines
1.7 KiB
C

#include "alloc.h"
#include "debug.h"
#include "drivers.h"
#include "gdt.h"
#include "icon.h"
#include "idt.h"
#include "kprintf.h"
#include "memory.h"
#include "multiboot.h"
#include "power.h"
#include "shell.h"
#include "string.h"
#include "task.h"
#include "terminal.h"
#include "time.h"
#include "vbe.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/* Check if the compiler thinks you are targeting the wrong operating system. */
#if defined(__linux__)
#error \
"You are not using a cross-compiler, you will most certainly run into trouble"
#endif
/* This tutorial will only work for the 32-bit ix86 targets. */
#if !defined(__i386__)
#error "This tutorial needs to be compiled with a ix86-elf compiler"
#endif
static void uwu(void)
{
kprintf("uwu\n");
}
static void owo(void)
{
while (true)
kprintf("owoooooooooooooooooooooooooooooooooooo\n");
}
static void awa(void)
{
uint32_t pid = fork();
PRINT_INT(pid);
if (pid < 0)
kprintf("camille il a une grosse bite (18cm)\n");
kprintf("awaille\n");
if (pid)
wait();
}
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
{
terminal_initialize();
init_gdt();
init_idt();
init_memory(mbd, magic);
load_drivers();
// kprintf(KERN_ALERT
// "I see no way to confuse an array of 256 seg:off pairs with a
// " "complex 8*unknown quantity -byte descriptor table. -- Troy
// " "Martin 03:50, 22 March 2009 (UTC)\n");
create_kernel_task();
vmalloc(1231231);
// uint32_t nb_alloc = 0;
// while (vmalloc(10))
// nb_alloc++;
// kprintf("%d\n", nb_alloc);
for (uint8_t i = 0; i < 10; i++)
vmalloc(32);
// exec_fn(owo);
// exec_fn(owo);
// exec_fn(owo);
// exec_fn(owo);
shell_init();
}