1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +00:00

Kernel: Move page fault handling from MemoryManager to Region

After the page fault handler has found the region in which the fault
occurred, do the rest of the work in the region itself.

This patch also makes all fault types consistently crash the process
if a new page is needed but we're all out of pages.
This commit is contained in:
Andreas Kling 2019-11-04 00:45:33 +01:00
parent 0e8f1d7cb6
commit d67c6a92db
5 changed files with 163 additions and 153 deletions

View file

@ -10,6 +10,11 @@
class Inode;
class VMObject;
enum class PageFaultResponse {
ShouldCrash,
Continue,
};
class Region final : public InlineLinkedListNode<Region> {
friend class MemoryManager;
@ -47,6 +52,8 @@ public:
bool is_user_accessible() const { return m_user_accessible; }
PageFaultResponse handle_fault(const PageFault&);
NonnullOwnPtr<Region> clone();
bool contains(VirtualAddress vaddr) const
@ -122,6 +129,10 @@ public:
private:
Bitmap& ensure_cow_map() const;
PageFaultResponse handle_cow_fault(size_t page_index);
PageFaultResponse handle_inode_fault(size_t page_index);
PageFaultResponse handle_zero_fault(size_t page_index);
RefPtr<PageDirectory> m_page_directory;
Range m_range;
size_t m_offset_in_vmo { 0 };