Kernel: Usespace programs are now ran through ELF files

only 64 bit elf files are supported for now.
This commit is contained in:
2023-04-22 15:35:32 +03:00
parent ef0263e32d
commit fadce063a7
4 changed files with 53 additions and 16 deletions

View File

@@ -186,15 +186,6 @@ static void init2(void* tty1)
((TTY*)tty1)->initialize_device();
MUST(Process::create_kernel(
[](void*)
{
if (auto res = LibELF::ELF::load_from_file("/boot/banan-os.kernel"sv); res.is_error())
dwarnln("{}", res.error());
Process::current().exit();
}, nullptr
));
jump_userspace();
return;
@@ -216,5 +207,5 @@ static void jump_userspace()
MMU::get().map_range((uintptr_t)&g_userspace_start, (uintptr_t)&g_userspace_end - (uintptr_t)&g_userspace_start, MMU::Flags::UserSupervisor | MMU::Flags::Present);
MMU::get().map_range((uintptr_t)&g_kernel_start, (uintptr_t)&g_kernel_end - (uintptr_t)&g_kernel_start, MMU::Flags::UserSupervisor | MMU::Flags::Present);
MUST(Process::create_userspace(userspace_entry));
MUST(Process::create_userspace("/bin/test"sv));
}