Kernel: Allow demand paging only for userspace threads

This commit is contained in:
Bananymous 2024-04-17 00:55:45 +03:00
parent f9943b60e4
commit a40ef610a2
2 changed files with 20 additions and 16 deletions

View File

@ -61,7 +61,7 @@ namespace Kernel
vaddr_t kernel_stack_top() const { return m_kernel_stack->vaddr() + m_kernel_stack->size(); }
VirtualRange& kernel_stack() { return *m_kernel_stack; }
vaddr_t userspace_stack_bottom() const { return is_userspace() ? m_userspace_stack->vaddr() : 0; }
vaddr_t userspace_stack_bottom() const { return is_userspace() ? m_userspace_stack->vaddr() : UINTPTR_MAX; }
vaddr_t userspace_stack_top() const { return is_userspace() ? m_userspace_stack->vaddr() + m_userspace_stack->size() : 0; }
VirtualRange& userspace_stack() { ASSERT(is_userspace()); return *m_userspace_stack; }

View File

@ -194,6 +194,9 @@ namespace Kernel
goto done;
}
// Demand paging is only supported in userspace
if (thread.is_userspace())
{
// Try demand paging on non present pages
PageFaultError page_fault_error;
page_fault_error.raw = error;
@ -214,6 +217,7 @@ namespace Kernel
}
}
}
}
#if __enable_sse
else if (isr == ISR::DeviceNotAvailable)
{