Added x86_64 paging and ELF loader

This commit is contained in:
Jozef Nagy 2025-01-31 21:12:29 +01:00
parent 36ae3ec0b7
commit a39e30d17e
Signed by untrusted user who does not match committer: crz
GPG key ID: 459A4811CEAC7068
6 changed files with 309 additions and 4 deletions

View file

@ -19,23 +19,34 @@
#include <vfs/vfs.h>
#include <mm/mman.h>
#include <mm/vmm.h>
#include <loader/elf.h>
#include <print.h>
void axboot_init()
{
if (!vfs_init("\\")) {
debug("axboot_init(): Failed to mount boot drive! Halting...");
debug("axboot_init(): Failed to mount boot drive! Halting...\n");
// TODO: Halt
while (1);
}
// read kernel -> test read
char *buffer = NULL;
vfs_read("\\System\\axkrnl", &buffer);
char *kbuf = NULL;
vfs_read("\\System\\axkrnl", &kbuf);
// TODO: Do something with the kernel :p
uintptr_t *pm = create_pagemap();
if (!pm) {
debug("axboot_init(): Failed to create kernel pagemap! Halting...\n");
// TODO: Halt
while (1);
}
mem_free(buffer);
void *kernel_entry = (void *)elf_load(kbuf, pm);
(void)kernel_entry;
mem_free(kbuf);
while (1);
}