Kernel: reorder process exit steps

This commit is contained in:
Bananymous 2023-06-04 01:19:04 +03:00
parent 8352392b38
commit 35e739dcdd
1 changed files with 8 additions and 4 deletions

View File

@ -271,16 +271,20 @@ namespace Kernel
DISABLE_INTERRUPTS(); DISABLE_INTERRUPTS();
load_temp_stack(); load_temp_stack();
PageTable::kernel().load();
Process* process = &m_current_thread->thread->process(); ASSERT(m_current_thread);
Thread* thread = m_current_thread->thread;
Process* process = &thread->process();
remove_threads(m_blocking_threads, it->thread->process().pid() == process->pid()); remove_threads(m_blocking_threads, it->thread->process().pid() == process->pid());
remove_threads(m_sleeping_threads, it->thread->process().pid() == process->pid()); remove_threads(m_sleeping_threads, it->thread->process().pid() == process->pid());
remove_threads(m_active_threads, it != m_current_thread && it->thread->process().pid() == process->pid()); remove_threads(m_active_threads, it != m_current_thread && it->thread->process().pid() == process->pid());
delete m_current_thread->thread;
delete process;
remove_and_advance_current_thread(); remove_and_advance_current_thread();
delete thread;
delete process;
execute_current_thread(); execute_current_thread();
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();