diff options
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/MemoryManager.cpp | 11 | ||||
-rw-r--r-- | Kernel/MemoryManager.h | 2 | ||||
-rw-r--r-- | Kernel/i386.cpp | 2 | ||||
-rw-r--r-- | Kernel/i386.h | 22 |
4 files changed, 19 insertions, 18 deletions
diff --git a/Kernel/MemoryManager.cpp b/Kernel/MemoryManager.cpp index c6fc69ab1d..8dbce26612 100644 --- a/Kernel/MemoryManager.cpp +++ b/Kernel/MemoryManager.cpp @@ -105,7 +105,8 @@ void MemoryManager::deallocate_page_table(PageDirectory& page_directory, unsigne { auto& physical_page = page_directory.physical_pages[index]; ASSERT(physical_page); - ASSERT(!m_free_physical_pages.contains_slow(physical_page)); + //FIXME: This line is buggy and effectful somehow :( + //ASSERT(!m_free_physical_pages.contains_slow(physical_page)); for (size_t i = 0; i < MM.m_free_physical_pages.size(); ++i) { ASSERT(MM.m_free_physical_pages[i].ptr() != physical_page.ptr()); } @@ -207,13 +208,13 @@ void MemoryManager::initialize() s_the = new MemoryManager; } -PageFaultResponse MemoryManager::handlePageFault(const PageFault& fault) +PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault) { ASSERT_INTERRUPTS_DISABLED(); - kprintf("MM: handlePageFault(%w) at L%x\n", fault.code(), fault.address().get()); - if (fault.isNotPresent()) { + kprintf("MM: handle_page_fault(%w) at L%x\n", fault.code(), fault.laddr().get()); + if (fault.is_not_present()) { kprintf(" >> NP fault!\n"); - } else if (fault.isProtectionViolation()) { + } else if (fault.is_protection_violation()) { kprintf(" >> PV fault!\n"); } return PageFaultResponse::ShouldCrash; diff --git a/Kernel/MemoryManager.h b/Kernel/MemoryManager.h index 39e295afa3..e02a930fbb 100644 --- a/Kernel/MemoryManager.h +++ b/Kernel/MemoryManager.h @@ -79,7 +79,7 @@ public: static void initialize(); - PageFaultResponse handlePageFault(const PageFault&); + PageFaultResponse handle_page_fault(const PageFault&); bool mapRegion(Process&, Region&); bool unmapRegion(Process&, Region&); diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp index fd1bb7564e..0eefee4676 100644 --- a/Kernel/i386.cpp +++ b/Kernel/i386.cpp @@ -238,7 +238,7 @@ void exception_14_handler() if (current->isRing0()) HANG; - auto response = MM.handlePageFault(PageFault(exception_code, LinearAddress(faultAddress))); + auto response = MM.handle_page_fault(PageFault(exception_code, LinearAddress(faultAddress))); if (response == PageFaultResponse::ShouldCrash) { kprintf("Crashing after unresolved page fault\n"); diff --git a/Kernel/i386.h b/Kernel/i386.h index e03c4a71b9..c17c61bfa2 100644 --- a/Kernel/i386.h +++ b/Kernel/i386.h @@ -126,26 +126,26 @@ enum Flags { class PageFault { public: - PageFault(word code, LinearAddress address) + PageFault(word code, LinearAddress laddr) : m_code(code) - , m_address(address) + , m_laddr(laddr) { } - LinearAddress address() const { return m_address; } + LinearAddress laddr() const { return m_laddr; } word code() const { return m_code; } - bool isNotPresent() const { return (m_code & 1) == PageFaultFlags::NotPresent; } - bool isProtectionViolation() const { return (m_code & 1) == PageFaultFlags::ProtectionViolation; } - bool isRead() const { return (m_code & 2) == PageFaultFlags::Read; } - bool isWrite() const { return (m_code & 2) == PageFaultFlags::Write; } - bool isUser() const { return (m_code & 4) == PageFaultFlags::UserMode; } - bool isSupervisor() const { return (m_code & 4) == PageFaultFlags::SupervisorMode; } - bool isInstructionFetch() const { return (m_code & 8) == PageFaultFlags::InstructionFetch; } + bool is_not_present() const { return (m_code & 1) == PageFaultFlags::NotPresent; } + bool is_protection_violation() const { return (m_code & 1) == PageFaultFlags::ProtectionViolation; } + bool is_read() const { return (m_code & 2) == PageFaultFlags::Read; } + bool is_write() const { return (m_code & 2) == PageFaultFlags::Write; } + bool is_user() const { return (m_code & 4) == PageFaultFlags::UserMode; } + bool is_supervisor() const { return (m_code & 4) == PageFaultFlags::SupervisorMode; } + bool is_instruction_fetch() const { return (m_code & 8) == PageFaultFlags::InstructionFetch; } private: word m_code; - LinearAddress m_address; + LinearAddress m_laddr; }; struct RegisterDump { |