1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +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 3320bb45d1
commit 08a569fbe0
5 changed files with 20 additions and 24 deletions

View file

@ -49,12 +49,12 @@ public:
unsigned size() const { return m_pages; }
unsigned used() const { return m_used; }
unsigned free() const { return m_pages - m_used; }
bool contains(PhysicalPage& page) const { return page.paddr() >= m_lower && page.paddr() <= m_upper; }
bool contains(const PhysicalPage& page) const { return page.paddr() >= m_lower && page.paddr() <= m_upper; }
RefPtr<PhysicalPage> take_free_page(bool supervisor);
NonnullRefPtrVector<PhysicalPage> take_contiguous_free_pages(size_t count, bool supervisor);
void return_page_at(PhysicalAddress addr);
void return_page(PhysicalPage&& page) { return_page_at(page.paddr()); }
void return_page(const PhysicalPage& page) { return_page_at(page.paddr()); }
private:
unsigned find_contiguous_free_pages(size_t count);