[Zion] Add a proc/thread cleanup thread for future use.

This commit is contained in:
Drew Galbraith 2023-11-24 15:04:03 -08:00
parent 8e4cd1562f
commit cb590c96b8
9 changed files with 95 additions and 0 deletions

View file

@ -19,3 +19,21 @@ Process& ProcessManager::FromId(uint64_t pid) {
}
return *proc_map_.at(pid);
}
void ProcessManager::InitCleanup() {
auto cleanup_thread = FromId(0).CreateThread();
cleanup_thread->SetKernel();
cleanup_thread->Start(reinterpret_cast<uint64_t>(CleanupThreadEntry),
reinterpret_cast<uint64_t>(&gProcMan->cleanup), 0);
}
void ProcessManager::CleanupProcess(uint64_t pid) {
if (!proc_map_.Contains(pid)) {
panic("Bad proc access {}, have {} processes", pid, proc_map_.size());
}
cleanup.CleanupProcess(proc_map_.at(pid));
}
void ProcessManager::CleanupThread(glcr::RefPtr<Thread> thread) {
cleanup.CleanupThread(thread);
}