Scheduler: Make sure we are in the kernel's address space when resuming a blocked process

This commit is contained in:
apio 2022-10-30 19:10:46 +01:00
parent a7e4f2bdd2
commit c68d040484

View File

@ -74,11 +74,7 @@ bool Task::has_died()
void Task::resume_read()
{
VMM::switch_back_to_kernel_address_space();
VMM::apply_address_space();
VMM::switch_to_previous_user_address_space();
regs.rax = files[blocking_read_info.fd].read(blocking_read_info.size, blocking_read_info.buf);
VMM::apply_address_space();
}
bool Task::is_read_still_blocking()
@ -88,6 +84,9 @@ bool Task::is_read_still_blocking()
void Task::resume()
{
VMM::switch_back_to_kernel_address_space();
VMM::apply_address_space();
VMM::switch_to_previous_user_address_space();
switch (block_reason)
{
case BlockReason::None: ASSERT(false);
@ -96,6 +95,7 @@ void Task::resume()
default: ASSERT(false);
}
VMM::apply_address_space();
block_reason = BlockReason::None;
state = Running;
}