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.
This commit is contained in:
Timon Kruiper 2022-08-23 21:42:30 +02:00 committed by Andreas Kling
commit e8aff0c1c8
Notes: sideshowbarker 2024-07-17 07:43:22 +09:00
12 changed files with 41 additions and 51 deletions

View file

@ -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