1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

Kernel: Introduce ProcessorSpecific<T> for per-CPU data structures

To add a new per-CPU data structure, add an ID for it to the
ProcessorSpecificDataID enum.

Then call ProcessorSpecific<T>::initialize() when you are ready to
construct the per-CPU data structure on the current CPU. It can then
be accessed via ProcessorSpecific<T>::get().

This patch replaces the existing hard-coded mechanisms for Scheduler
and MemoryManager per-CPU data structure.
This commit is contained in:
Andreas Kling 2021-07-27 14:30:26 +02:00
parent 559ab00249
commit 1e43292c3b
6 changed files with 46 additions and 38 deletions

View file

@ -91,6 +91,8 @@ struct PhysicalMemoryRange {
#define MM Kernel::MemoryManager::the()
struct MemoryManagerData {
static ProcessorSpecificDataID processor_specific_data_id() { return ProcessorSpecificDataID::MemoryManager; }
SpinLock<u8> m_quickmap_in_use;
u32 m_quickmap_prev_flags;
@ -115,7 +117,7 @@ public:
static inline MemoryManagerData& get_data()
{
return Processor::current().get_mm_data();
return ProcessorSpecific<MemoryManagerData>::get();
}
PageFaultResponse handle_page_fault(PageFault const&);