1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

Kernel: Verify system memory info consistency

This commit is contained in:
Idan Horowitz 2022-06-05 23:02:00 +03:00
parent b4e45a6636
commit ea1e5b630d

View file

@ -203,6 +203,7 @@ public:
SystemMemoryInfo get_system_memory_info()
{
SpinlockLocker lock(s_mm_lock);
verify_system_memory_info_consistency();
return m_system_memory_info;
}
@ -286,6 +287,12 @@ private:
};
void release_pte(PageDirectory&, VirtualAddress, IsLastPTERelease);
ALWAYS_INLINE void verify_system_memory_info_consistency() const
{
auto user_physical_pages_unused = m_system_memory_info.user_physical_pages_committed + m_system_memory_info.user_physical_pages_uncommitted;
VERIFY(m_system_memory_info.user_physical_pages == (m_system_memory_info.user_physical_pages_used + user_physical_pages_unused));
}
RefPtr<PageDirectory> m_kernel_page_directory;
RefPtr<PhysicalPage> m_shared_zero_page;