1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

Kernel: Stop taking MM lock while using regular quickmaps

You're still required to disable interrupts though, as the mappings are
per-CPU. This exposed the fact that our CR3 lookup map is insufficiently
protected (but we'll address that in a separate commit.)
This commit is contained in:
Andreas Kling 2022-08-22 15:23:32 +02:00
parent c8375c51ff
commit 6cd3695761
5 changed files with 15 additions and 14 deletions

View file

@ -1,11 +1,12 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Memory.h>
#include <AK/StringView.h>
#include <Kernel/Arch/InterruptDisabler.h>
#include <Kernel/Arch/PageDirectory.h>
#include <Kernel/Arch/PageFault.h>
#include <Kernel/Debug.h>
@ -516,8 +517,7 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region)
}
auto new_physical_page = new_physical_page_or_error.release_value();
{
// NOTE: The MM lock is required for quick-mapping.
SpinlockLocker mm_locker(s_mm_lock);
InterruptDisabler disabler;
u8* dest_ptr = MM.quickmap_page(*new_physical_page);
memcpy(dest_ptr, page_buffer, PAGE_SIZE);
MM.unquickmap_page();