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

Kernel: Make PhysicalPage not movable and use atomic ref counting

We should not be moving ref-counted objects.
This commit is contained in:
Tom 2020-08-21 21:49:50 -06:00 committed by Andreas Kling
parent 41c005cb14
commit a89ccd842b
5 changed files with 20 additions and 24 deletions

View file

@ -42,18 +42,14 @@ PhysicalPage::PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_retu
{
}
void PhysicalPage::return_to_freelist() &&
void PhysicalPage::return_to_freelist() const
{
ASSERT((paddr().get() & ~PAGE_MASK) == 0);
InterruptDisabler disabler;
m_ref_count = 1;
if (m_supervisor)
MM.deallocate_supervisor_physical_page(move(*this));
MM.deallocate_supervisor_physical_page(*this);
else
MM.deallocate_user_physical_page(move(*this));
MM.deallocate_user_physical_page(*this);
#ifdef MM_DEBUG
dbg() << "MM: P" << String::format("%x", m_paddr.get()) << " released to freelist";