mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Kernel: Widen PhysicalPage refcount to 32 bits
A 16-bit refcount is just begging for trouble right nowl. A 32-bit refcount will be begging for trouble later down the line, so we'll have to revisit this eventually. :^)
This commit is contained in:
parent
51628f64fa
commit
5507945306
Notes:
sideshowbarker
2024-07-19 09:17:44 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5507945306e
@ -46,7 +46,7 @@ void PhysicalPage::return_to_freelist() &&
|
|||||||
|
|
||||||
InterruptDisabler disabler;
|
InterruptDisabler disabler;
|
||||||
|
|
||||||
m_retain_count = 1;
|
m_ref_count = 1;
|
||||||
|
|
||||||
if (m_supervisor)
|
if (m_supervisor)
|
||||||
MM.deallocate_supervisor_physical_page(move(*this));
|
MM.deallocate_supervisor_physical_page(move(*this));
|
||||||
|
@ -42,14 +42,14 @@ public:
|
|||||||
|
|
||||||
void ref()
|
void ref()
|
||||||
{
|
{
|
||||||
ASSERT(m_retain_count);
|
ASSERT(m_ref_count);
|
||||||
++m_retain_count;
|
++m_ref_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unref()
|
void unref()
|
||||||
{
|
{
|
||||||
ASSERT(m_retain_count);
|
ASSERT(m_ref_count);
|
||||||
if (!--m_retain_count) {
|
if (!--m_ref_count) {
|
||||||
if (m_may_return_to_freelist)
|
if (m_may_return_to_freelist)
|
||||||
move(*this).return_to_freelist();
|
move(*this).return_to_freelist();
|
||||||
delete this;
|
delete this;
|
||||||
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
static NonnullRefPtr<PhysicalPage> create(PhysicalAddress, bool supervisor, bool may_return_to_freelist = true);
|
static NonnullRefPtr<PhysicalPage> create(PhysicalAddress, bool supervisor, bool may_return_to_freelist = true);
|
||||||
|
|
||||||
u16 ref_count() const { return m_retain_count; }
|
u32 ref_count() const { return m_ref_count; }
|
||||||
|
|
||||||
bool is_shared_zero_page() const;
|
bool is_shared_zero_page() const;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ private:
|
|||||||
|
|
||||||
void return_to_freelist() &&;
|
void return_to_freelist() &&;
|
||||||
|
|
||||||
u16 m_retain_count { 1 };
|
u32 m_ref_count { 1 };
|
||||||
bool m_may_return_to_freelist { true };
|
bool m_may_return_to_freelist { true };
|
||||||
bool m_supervisor { false };
|
bool m_supervisor { false };
|
||||||
PhysicalAddress m_paddr;
|
PhysicalAddress m_paddr;
|
||||||
|
Loading…
Reference in New Issue
Block a user