42_KFS/src/kernel.c

50 lines
1.3 KiB
C
Raw Normal View History

#include "gdt.h"
#include "kprintf.h"
#include "memory.h"
#include "shell.h"
#include "string.h"
#include "terminal.h"
2024-09-06 19:44:40 -04:00
2024-09-06 17:36:07 -04:00
#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
void kernel_main(void)
{
terminal_initialize();
init_gdt();
init_memory();
char *str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
str = kalloc_frame(104831);
kfree_frame(str, 104831);
str = kalloc_frame(104831);
kfree_frame(str, 104831);
str = kalloc_frame(104831);
kfree_frame(str, 104831);
str = kalloc_frame(104831);
kfree_frame(str, 104831);
str = kalloc_frame(104831);
memcpy(str, "Hello world!\n", 15);
kprintf(KERN_INFO, "%d: %s", str, str);
shell_init();
2024-09-06 17:36:07 -04:00
}