summaryrefslogtreecommitdiff
path: root/Kernel/Memory
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2022-08-23 21:42:30 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-26 12:51:57 +0200
commite8aff0c1c88510190285578f6539ca411faedd67 (patch)
tree155fbde0df2989d4f7d5a4a4296eb2fa4189ed4d /Kernel/Memory
parent6432f3eee8b21979c0a455008f0a8d2124ed15a7 (diff)
downloadserenity-e8aff0c1c88510190285578f6539ca411faedd67.zip
Kernel: Use InterruptsState in Spinlock code
This commit updates the lock function from Spinlock and RecursiveSpinlock to return the InterruptsState of the processor, instead of the processor flags. The unlock functions would only look at the interrupt flag of the processor flags, so we now use the InterruptsState enum to clarify the intent, and such that we can use the same Spinlock code for the aarch64 build. To not break the build, all the call sites are updated aswell.
Diffstat (limited to 'Kernel/Memory')
-rw-r--r--Kernel/Memory/MemoryManager.cpp4
-rw-r--r--Kernel/Memory/MemoryManager.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp
index 1f1a125290..5d108e26bf 100644
--- a/Kernel/Memory/MemoryManager.cpp
+++ b/Kernel/Memory/MemoryManager.cpp
@@ -1082,7 +1082,7 @@ u8* MemoryManager::quickmap_page(PhysicalAddress const& physical_address)
{
VERIFY_INTERRUPTS_DISABLED();
auto& mm_data = get_data();
- mm_data.m_quickmap_prev_flags = mm_data.m_quickmap_in_use.lock();
+ mm_data.m_quickmap_previous_interrupts_state = mm_data.m_quickmap_in_use.lock();
VirtualAddress vaddr(KERNEL_QUICKMAP_PER_CPU_BASE + Processor::current_id() * PAGE_SIZE);
u32 pte_idx = (vaddr.get() - KERNEL_PT1024_BASE) / PAGE_SIZE;
@@ -1108,7 +1108,7 @@ void MemoryManager::unquickmap_page()
auto& pte = ((PageTableEntry*)boot_pd_kernel_pt1023)[pte_idx];
pte.clear();
flush_tlb_local(vaddr);
- mm_data.m_quickmap_in_use.unlock(mm_data.m_quickmap_prev_flags);
+ mm_data.m_quickmap_in_use.unlock(mm_data.m_quickmap_previous_interrupts_state);
}
bool MemoryManager::validate_user_stack(AddressSpace& space, VirtualAddress vaddr) const
diff --git a/Kernel/Memory/MemoryManager.h b/Kernel/Memory/MemoryManager.h
index a69717805f..484a645acc 100644
--- a/Kernel/Memory/MemoryManager.h
+++ b/Kernel/Memory/MemoryManager.h
@@ -90,7 +90,7 @@ struct MemoryManagerData {
static ProcessorSpecificDataID processor_specific_data_id() { return ProcessorSpecificDataID::MemoryManager; }
Spinlock m_quickmap_in_use { LockRank::None };
- u32 m_quickmap_prev_flags;
+ InterruptsState m_quickmap_previous_interrupts_state;
};
// This class represents a set of committed physical pages.