Added usermode process creation (currently broken)

This commit is contained in:
Alex
2022-11-04 05:32:27 +02:00
parent 8cc9ff4ff3
commit 5de0a3972c
4 changed files with 130 additions and 6 deletions

View File

@ -79,13 +79,15 @@ void KernelMainThread()
argc = argv.size() - 1;
// TODO: Untested!
Execute::ExStatus ret = Execute::Spawn(Config.InitPath, argc, (uint64_t)argv.data());
if (ret != Execute::ExStatus::OK)
Execute::SpawnData ret = Execute::Spawn(Config.InitPath, argc, (uint64_t)argv.data());
if (ret.Status != Execute::ExStatus::OK)
{
KPrint("\eE85230Failed to start %s! Code: %d", Config.InitPath, ret);
CPU::Halt(true);
}
TaskManager->GetCurrentThread()->SetPriority(1);
TaskManager->WaitForThread(ret.Thread);
KPrint("\eE85230Userspace process exited with code %d", ret.Thread->GetExitCode());
CPU::Halt(true);
}