From 26cff62a0a1ef8a3173f0242bbc0f86b47cb5f67 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 11 May 2024 18:15:51 +0300 Subject: [PATCH] Kernel: Rename Memory::PhysicalPage to Memory::PhysicalRAMPage Since these are now only used to represent RAM pages, (and not MMIO pages) rename them to make their purpose more obvious. --- Kernel/Arch/aarch64/PageDirectory.cpp | 8 ++--- Kernel/Arch/aarch64/PageDirectory.h | 8 ++--- Kernel/Arch/riscv64/PageDirectory.cpp | 4 +-- Kernel/Arch/riscv64/PageDirectory.h | 6 ++-- Kernel/Arch/x86_64/PageDirectory.cpp | 8 ++--- Kernel/Arch/x86_64/PageDirectory.h | 8 ++--- Kernel/Bus/USB/USBTransfer.h | 2 +- Kernel/CMakeLists.txt | 2 +- .../Devices/Storage/AHCI/InterruptHandler.h | 2 +- Kernel/Devices/Storage/AHCI/Port.cpp | 4 +-- Kernel/Devices/Storage/AHCI/Port.h | 14 ++++---- .../Devices/Storage/NVMe/NVMeController.cpp | 12 +++---- Kernel/Devices/Storage/NVMe/NVMeController.h | 4 +-- .../Storage/NVMe/NVMeInterruptQueue.cpp | 4 +-- .../Devices/Storage/NVMe/NVMeInterruptQueue.h | 4 +-- Kernel/Devices/Storage/NVMe/NVMePollQueue.cpp | 4 +-- Kernel/Devices/Storage/NVMe/NVMePollQueue.h | 4 +-- Kernel/Devices/Storage/NVMe/NVMeQueue.cpp | 4 +-- Kernel/Devices/Storage/NVMe/NVMeQueue.h | 4 +-- Kernel/Devices/Storage/StorageController.h | 2 +- Kernel/Forward.h | 2 +- Kernel/Memory/AnonymousVMObject.cpp | 26 +++++++------- Kernel/Memory/AnonymousVMObject.h | 16 ++++----- Kernel/Memory/InodeVMObject.cpp | 4 +-- Kernel/Memory/InodeVMObject.h | 4 +-- Kernel/Memory/MMIOVMObject.cpp | 2 +- Kernel/Memory/MMIOVMObject.h | 2 +- Kernel/Memory/MemoryManager.cpp | 32 ++++++++--------- Kernel/Memory/MemoryManager.h | 36 +++++++++---------- .../{PhysicalPage.cpp => PhysicalRAMPage.cpp} | 16 ++++----- .../{PhysicalPage.h => PhysicalRAMPage.h} | 14 ++++---- Kernel/Memory/PhysicalRegion.cpp | 10 +++--- Kernel/Memory/PhysicalRegion.h | 6 ++-- Kernel/Memory/PhysicalZone.cpp | 2 +- Kernel/Memory/PrivateInodeVMObject.cpp | 4 +-- Kernel/Memory/PrivateInodeVMObject.h | 4 +-- Kernel/Memory/Region.cpp | 14 ++++---- Kernel/Memory/Region.h | 10 +++--- Kernel/Memory/ScatterGatherList.cpp | 2 +- Kernel/Memory/ScatterGatherList.h | 2 +- Kernel/Memory/SharedFramebufferVMObject.cpp | 14 ++++---- Kernel/Memory/SharedFramebufferVMObject.h | 26 +++++++------- Kernel/Memory/SharedInodeVMObject.cpp | 4 +-- Kernel/Memory/SharedInodeVMObject.h | 4 +-- Kernel/Memory/VMObject.cpp | 8 ++--- Kernel/Memory/VMObject.h | 12 +++---- 46 files changed, 192 insertions(+), 192 deletions(-) rename Kernel/Memory/{PhysicalPage.cpp => PhysicalRAMPage.cpp} (62%) rename Kernel/Memory/{PhysicalPage.h => PhysicalRAMPage.h} (75%) diff --git a/Kernel/Arch/aarch64/PageDirectory.cpp b/Kernel/Arch/aarch64/PageDirectory.cpp index a9424f9dcfa..bb99f3abcf6 100644 --- a/Kernel/Arch/aarch64/PageDirectory.cpp +++ b/Kernel/Arch/aarch64/PageDirectory.cpp @@ -109,13 +109,13 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory() { // Adopt the page tables already set up by boot.S dmesgln("MM: boot_pml4t @ {}", boot_pml4t); - m_root_table = PhysicalPage::create(boot_pml4t, MayReturnToFreeList::No); + m_root_table = PhysicalRAMPage::create(boot_pml4t, MayReturnToFreeList::No); dmesgln("MM: boot_pdpt @ {}", boot_pdpt); dmesgln("MM: boot_pd0 @ {}", boot_pd0); dmesgln("MM: boot_pd_kernel @ {}", boot_pd_kernel); - m_directory_table = PhysicalPage::create(boot_pdpt, MayReturnToFreeList::No); - m_directory_pages[0] = PhysicalPage::create(boot_pd0, MayReturnToFreeList::No); - m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalPage::create(boot_pd_kernel, MayReturnToFreeList::No); + m_directory_table = PhysicalRAMPage::create(boot_pdpt, MayReturnToFreeList::No); + m_directory_pages[0] = PhysicalRAMPage::create(boot_pd0, MayReturnToFreeList::No); + m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalRAMPage::create(boot_pd_kernel, MayReturnToFreeList::No); } PageDirectory::~PageDirectory() diff --git a/Kernel/Arch/aarch64/PageDirectory.h b/Kernel/Arch/aarch64/PageDirectory.h index 6683808e407..249db8fe3b1 100644 --- a/Kernel/Arch/aarch64/PageDirectory.h +++ b/Kernel/Arch/aarch64/PageDirectory.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace Kernel::Memory { @@ -211,9 +211,9 @@ private: static void deregister_page_directory(PageDirectory* directory); Process* m_process { nullptr }; - RefPtr m_root_table; - RefPtr m_directory_table; - RefPtr m_directory_pages[512]; + RefPtr m_root_table; + RefPtr m_directory_table; + RefPtr m_directory_pages[512]; RecursiveSpinlock m_lock {}; }; diff --git a/Kernel/Arch/riscv64/PageDirectory.cpp b/Kernel/Arch/riscv64/PageDirectory.cpp index faa14a31ae7..4cdba33f602 100644 --- a/Kernel/Arch/riscv64/PageDirectory.cpp +++ b/Kernel/Arch/riscv64/PageDirectory.cpp @@ -99,8 +99,8 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory() { dmesgln("MM: boot_pdpt @ {}", boot_pdpt); dmesgln("MM: boot_pd_kernel @ {}", boot_pd_kernel); - m_directory_table = PhysicalPage::create(boot_pdpt, MayReturnToFreeList::No); - m_directory_pages[(kernel_mapping_base >> VPN_2_OFFSET) & PAGE_TABLE_INDEX_MASK] = PhysicalPage::create(boot_pd_kernel, MayReturnToFreeList::No); + m_directory_table = PhysicalRAMPage::create(boot_pdpt, MayReturnToFreeList::No); + m_directory_pages[(kernel_mapping_base >> VPN_2_OFFSET) & PAGE_TABLE_INDEX_MASK] = PhysicalRAMPage::create(boot_pd_kernel, MayReturnToFreeList::No); } PageDirectory::~PageDirectory() diff --git a/Kernel/Arch/riscv64/PageDirectory.h b/Kernel/Arch/riscv64/PageDirectory.h index 52c9a5c8b45..9970ce51bc8 100644 --- a/Kernel/Arch/riscv64/PageDirectory.h +++ b/Kernel/Arch/riscv64/PageDirectory.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include VALIDATE_IS_RISCV64() @@ -197,8 +197,8 @@ private: static void deregister_page_directory(PageDirectory* directory); Process* m_process { nullptr }; - RefPtr m_directory_table; - RefPtr m_directory_pages[512]; + RefPtr m_directory_table; + RefPtr m_directory_pages[512]; RecursiveSpinlock m_lock {}; }; diff --git a/Kernel/Arch/x86_64/PageDirectory.cpp b/Kernel/Arch/x86_64/PageDirectory.cpp index ae3e7a7e269..398c968873d 100644 --- a/Kernel/Arch/x86_64/PageDirectory.cpp +++ b/Kernel/Arch/x86_64/PageDirectory.cpp @@ -130,13 +130,13 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory() { // Adopt the page tables already set up by boot.S dmesgln("MM: boot_pml4t @ {}", boot_pml4t); - m_pml4t = PhysicalPage::create(boot_pml4t, MayReturnToFreeList::No); + m_pml4t = PhysicalRAMPage::create(boot_pml4t, MayReturnToFreeList::No); dmesgln("MM: boot_pdpt @ {}", boot_pdpt); dmesgln("MM: boot_pd0 @ {}", boot_pd0); dmesgln("MM: boot_pd_kernel @ {}", boot_pd_kernel); - m_directory_table = PhysicalPage::create(boot_pdpt, MayReturnToFreeList::No); - m_directory_pages[0] = PhysicalPage::create(boot_pd0, MayReturnToFreeList::No); - m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalPage::create(boot_pd_kernel, MayReturnToFreeList::No); + m_directory_table = PhysicalRAMPage::create(boot_pdpt, MayReturnToFreeList::No); + m_directory_pages[0] = PhysicalRAMPage::create(boot_pd0, MayReturnToFreeList::No); + m_directory_pages[(kernel_mapping_base >> 30) & 0x1ff] = PhysicalRAMPage::create(boot_pd_kernel, MayReturnToFreeList::No); } PageDirectory::~PageDirectory() diff --git a/Kernel/Arch/x86_64/PageDirectory.h b/Kernel/Arch/x86_64/PageDirectory.h index f912e88c258..992108d7330 100644 --- a/Kernel/Arch/x86_64/PageDirectory.h +++ b/Kernel/Arch/x86_64/PageDirectory.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace Kernel::Memory { @@ -193,9 +193,9 @@ private: static void deregister_page_directory(PageDirectory* directory); Process* m_process { nullptr }; - RefPtr m_pml4t; - RefPtr m_directory_table; - RefPtr m_directory_pages[512]; + RefPtr m_pml4t; + RefPtr m_directory_table; + RefPtr m_directory_pages[512]; RecursiveSpinlock m_lock {}; }; diff --git a/Kernel/Bus/USB/USBTransfer.h b/Kernel/Bus/USB/USBTransfer.h index b5fa8a472ad..15234e5b1ad 100644 --- a/Kernel/Bus/USB/USBTransfer.h +++ b/Kernel/Bus/USB/USBTransfer.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include // TODO: Callback stuff in this class please! diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 6261f719dfd..2800eb9dd01 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -238,7 +238,7 @@ set(KERNEL_SOURCES Memory/InodeVMObject.cpp Memory/MemoryManager.cpp Memory/MMIOVMObject.cpp - Memory/PhysicalPage.cpp + Memory/PhysicalRAMPage.cpp Memory/PhysicalRegion.cpp Memory/PhysicalZone.cpp Memory/PrivateInodeVMObject.cpp diff --git a/Kernel/Devices/Storage/AHCI/InterruptHandler.h b/Kernel/Devices/Storage/AHCI/InterruptHandler.h index 200e7aa4fb4..835a2f6ffaf 100644 --- a/Kernel/Devices/Storage/AHCI/InterruptHandler.h +++ b/Kernel/Devices/Storage/AHCI/InterruptHandler.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Devices/Storage/AHCI/Port.cpp b/Kernel/Devices/Storage/AHCI/Port.cpp index b3e287f7faa..35fbad6e273 100644 --- a/Kernel/Devices/Storage/AHCI/Port.cpp +++ b/Kernel/Devices/Storage/AHCI/Port.cpp @@ -54,7 +54,7 @@ ErrorOr AHCIPort::allocate_resources_and_initialize_ports() return {}; } -UNMAP_AFTER_INIT AHCIPort::AHCIPort(AHCIController const& controller, NonnullRefPtr identify_buffer_page, AHCI::HBADefinedCapabilities hba_capabilities, volatile AHCI::PortRegisters& registers, u32 port_index) +UNMAP_AFTER_INIT AHCIPort::AHCIPort(AHCIController const& controller, NonnullRefPtr identify_buffer_page, AHCI::HBADefinedCapabilities hba_capabilities, volatile AHCI::PortRegisters& registers, u32 port_index) : m_port_index(port_index) , m_hba_capabilities(hba_capabilities) , m_identify_buffer_page(move(identify_buffer_page)) @@ -413,7 +413,7 @@ Optional AHCIPort::prepare_and_set_scatter_li VERIFY(m_lock.is_locked()); VERIFY(request.block_count() > 0); - Vector> allocated_dma_regions; + Vector> allocated_dma_regions; for (size_t index = 0; index < calculate_descriptors_count(request.block_count()); index++) { allocated_dma_regions.append(m_dma_buffers.at(index)); } diff --git a/Kernel/Devices/Storage/AHCI/Port.h b/Kernel/Devices/Storage/AHCI/Port.h index 7bdfe624d70..c2cab5afa28 100644 --- a/Kernel/Devices/Storage/AHCI/Port.h +++ b/Kernel/Devices/Storage/AHCI/Port.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -55,7 +55,7 @@ private: bool is_phy_enabled() const { return (m_port_registers.ssts & 0xf) == 3; } bool initialize(); - AHCIPort(AHCIController const&, NonnullRefPtr identify_buffer_page, AHCI::HBADefinedCapabilities, volatile AHCI::PortRegisters&, u32 port_index); + AHCIPort(AHCIController const&, NonnullRefPtr identify_buffer_page, AHCI::HBADefinedCapabilities, volatile AHCI::PortRegisters&, u32 port_index); ALWAYS_INLINE void clear_sata_error_register() const; @@ -108,11 +108,11 @@ private: mutable bool m_wait_for_completion { false }; - Vector> m_dma_buffers; - Vector> m_command_table_pages; - RefPtr m_command_list_page; + Vector> m_dma_buffers; + Vector> m_command_table_pages; + RefPtr m_command_list_page; OwnPtr m_command_list_region; - RefPtr m_fis_receive_page; + RefPtr m_fis_receive_page; LockRefPtr m_connected_device; u32 m_port_index; @@ -122,7 +122,7 @@ private: // it's probably better to just "cache" this here instead. AHCI::HBADefinedCapabilities const m_hba_capabilities; - NonnullRefPtr const m_identify_buffer_page; + NonnullRefPtr const m_identify_buffer_page; volatile AHCI::PortRegisters& m_port_registers; NonnullRefPtr const m_parent_controller; diff --git a/Kernel/Devices/Storage/NVMe/NVMeController.cpp b/Kernel/Devices/Storage/NVMe/NVMeController.cpp index 0a75ddfcb37..3b9e35c6ce8 100644 --- a/Kernel/Devices/Storage/NVMe/NVMeController.cpp +++ b/Kernel/Devices/Storage/NVMe/NVMeController.cpp @@ -155,7 +155,7 @@ UNMAP_AFTER_INIT void NVMeController::set_admin_q_depth() UNMAP_AFTER_INIT ErrorOr NVMeController::identify_and_init_namespaces() { - RefPtr prp_dma_buffer; + RefPtr prp_dma_buffer; OwnPtr prp_dma_region; auto namespace_data_struct = TRY(ByteBuffer::create_zeroed(NVMe_IDENTIFY_SIZE)); u32 active_namespace_list[NVMe_IDENTIFY_SIZE / sizeof(u32)]; @@ -219,7 +219,7 @@ UNMAP_AFTER_INIT ErrorOr NVMeController::identify_and_init_namespaces() ErrorOr NVMeController::identify_and_init_controller() { - RefPtr prp_dma_buffer; + RefPtr prp_dma_buffer; OwnPtr prp_dma_region; IdentifyController ctrl {}; @@ -311,9 +311,9 @@ void NVMeController::complete_current_request([[maybe_unused]] AsyncDeviceReques UNMAP_AFTER_INIT ErrorOr NVMeController::create_admin_queue(QueueType queue_type) { OwnPtr cq_dma_region; - Vector> cq_dma_pages; + Vector> cq_dma_pages; OwnPtr sq_dma_region; - Vector> sq_dma_pages; + Vector> sq_dma_pages; set_admin_q_depth(); auto cq_size = round_up_to_power_of_two(CQ_SIZE(ADMIN_QUEUE_SIZE), 4096); auto sq_size = round_up_to_power_of_two(SQ_SIZE(ADMIN_QUEUE_SIZE), 4096); @@ -364,9 +364,9 @@ UNMAP_AFTER_INIT ErrorOr NVMeController::create_admin_queue(QueueType queu UNMAP_AFTER_INIT ErrorOr NVMeController::create_io_queue(u8 qid, QueueType queue_type) { OwnPtr cq_dma_region; - Vector> cq_dma_pages; + Vector> cq_dma_pages; OwnPtr sq_dma_region; - Vector> sq_dma_pages; + Vector> sq_dma_pages; auto cq_size = round_up_to_power_of_two(CQ_SIZE(IO_QUEUE_SIZE), 4096); auto sq_size = round_up_to_power_of_two(SQ_SIZE(IO_QUEUE_SIZE), 4096); diff --git a/Kernel/Devices/Storage/NVMe/NVMeController.h b/Kernel/Devices/Storage/NVMe/NVMeController.h index 0981c39e820..e35c758dab5 100644 --- a/Kernel/Devices/Storage/NVMe/NVMeController.h +++ b/Kernel/Devices/Storage/NVMe/NVMeController.h @@ -76,8 +76,8 @@ private: Vector> m_queues; Vector> m_namespaces; Memory::TypedMapping m_controller_regs; - RefPtr m_dbbuf_shadow_page; - RefPtr m_dbbuf_eventidx_page; + RefPtr m_dbbuf_shadow_page; + RefPtr m_dbbuf_eventidx_page; bool m_admin_queue_ready { false }; size_t m_device_count { 0 }; AK::Duration m_ready_timeout; diff --git a/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.cpp b/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.cpp index 0981ede6716..aad90f719ce 100644 --- a/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.cpp +++ b/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.cpp @@ -11,14 +11,14 @@ namespace Kernel { -ErrorOr> NVMeInterruptQueue::try_create(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) +ErrorOr> NVMeInterruptQueue::try_create(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) { auto queue = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) NVMeInterruptQueue(device, move(rw_dma_region), rw_dma_page, qid, irq, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs)))); queue->initialize_interrupt_queue(); return queue; } -UNMAP_AFTER_INIT NVMeInterruptQueue::NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) +UNMAP_AFTER_INIT NVMeInterruptQueue::NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) : NVMeQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs)) , PCI::IRQHandler(device, irq) { diff --git a/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.h b/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.h index f8279271311..a17dad3b28a 100644 --- a/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.h +++ b/Kernel/Devices/Storage/NVMe/NVMeInterruptQueue.h @@ -14,14 +14,14 @@ namespace Kernel { class NVMeInterruptQueue : public NVMeQueue , public PCI::IRQHandler { public: - static ErrorOr> try_create(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); + static ErrorOr> try_create(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); void submit_sqe(NVMeSubmission& submission) override; virtual ~NVMeInterruptQueue() override {}; virtual StringView purpose() const override { return "NVMe"sv; } void initialize_interrupt_queue(); protected: - NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); + NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); private: virtual void complete_current_request(u16 cmdid, u16 status) override; diff --git a/Kernel/Devices/Storage/NVMe/NVMePollQueue.cpp b/Kernel/Devices/Storage/NVMe/NVMePollQueue.cpp index 109964719d6..4c401293cd4 100644 --- a/Kernel/Devices/Storage/NVMe/NVMePollQueue.cpp +++ b/Kernel/Devices/Storage/NVMe/NVMePollQueue.cpp @@ -11,12 +11,12 @@ namespace Kernel { -ErrorOr> NVMePollQueue::try_create(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) +ErrorOr> NVMePollQueue::try_create(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) { return TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) NVMePollQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs)))); } -UNMAP_AFTER_INIT NVMePollQueue::NVMePollQueue(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) +UNMAP_AFTER_INIT NVMePollQueue::NVMePollQueue(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) : NVMeQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs)) { } diff --git a/Kernel/Devices/Storage/NVMe/NVMePollQueue.h b/Kernel/Devices/Storage/NVMe/NVMePollQueue.h index c98dd54d008..5c6ccad8304 100644 --- a/Kernel/Devices/Storage/NVMe/NVMePollQueue.h +++ b/Kernel/Devices/Storage/NVMe/NVMePollQueue.h @@ -12,12 +12,12 @@ namespace Kernel { class NVMePollQueue : public NVMeQueue { public: - static ErrorOr> try_create(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); + static ErrorOr> try_create(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); void submit_sqe(NVMeSubmission& submission) override; virtual ~NVMePollQueue() override {}; protected: - NVMePollQueue(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); + NVMePollQueue(NonnullOwnPtr rw_dma_region, NonnullRefPtr rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); private: Spinlock m_cq_lock {}; diff --git a/Kernel/Devices/Storage/NVMe/NVMeQueue.cpp b/Kernel/Devices/Storage/NVMe/NVMeQueue.cpp index 48847f0e6be..db4096fff46 100644 --- a/Kernel/Devices/Storage/NVMe/NVMeQueue.cpp +++ b/Kernel/Devices/Storage/NVMe/NVMeQueue.cpp @@ -15,7 +15,7 @@ namespace Kernel { ErrorOr> NVMeQueue::try_create(NVMeController& device, u16 qid, Optional irq, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs, QueueType queue_type) { // Note: Allocate DMA region for RW operation. For now the requests don't exceed more than 4096 bytes (Storage device takes care of it) - RefPtr rw_dma_page; + RefPtr rw_dma_page; auto rw_dma_region = TRY(MM.allocate_dma_buffer_page("NVMe Queue Read/Write DMA"sv, Memory::Region::Access::ReadWrite, rw_dma_page)); if (rw_dma_page.is_null()) @@ -30,7 +30,7 @@ ErrorOr> NVMeQueue::try_create(NVMeController& devi return queue; } -UNMAP_AFTER_INIT NVMeQueue::NVMeQueue(NonnullOwnPtr rw_dma_region, Memory::PhysicalPage const& rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) +UNMAP_AFTER_INIT NVMeQueue::NVMeQueue(NonnullOwnPtr rw_dma_region, Memory::PhysicalRAMPage const& rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs) : m_rw_dma_region(move(rw_dma_region)) , m_qid(qid) , m_admin_queue(qid == 0) diff --git a/Kernel/Devices/Storage/NVMe/NVMeQueue.h b/Kernel/Devices/Storage/NVMe/NVMeQueue.h index d93543c865a..2f674417925 100644 --- a/Kernel/Devices/Storage/NVMe/NVMeQueue.h +++ b/Kernel/Devices/Storage/NVMe/NVMeQueue.h @@ -83,7 +83,7 @@ protected: m_db_regs.mmio_reg->sq_tail = m_sq_tail; } - NVMeQueue(NonnullOwnPtr rw_dma_region, Memory::PhysicalPage const& rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); + NVMeQueue(NonnullOwnPtr rw_dma_region, Memory::PhysicalRAMPage const& rw_dma_page, u16 qid, u32 q_depth, OwnPtr cq_dma_region, OwnPtr sq_dma_region, Doorbell db_regs); [[nodiscard]] u32 get_request_cid() { @@ -130,6 +130,6 @@ private: Span m_cqe_array; WaitQueue m_sync_wait_queue; Doorbell m_db_regs; - NonnullRefPtr const m_rw_dma_page; + NonnullRefPtr const m_rw_dma_page; }; } diff --git a/Kernel/Devices/Storage/StorageController.h b/Kernel/Devices/Storage/StorageController.h index a085de03357..2aec91af77e 100644 --- a/Kernel/Devices/Storage/StorageController.h +++ b/Kernel/Devices/Storage/StorageController.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/Kernel/Forward.h b/Kernel/Forward.h index 9b372327c01..6fbc35db183 100644 --- a/Kernel/Forward.h +++ b/Kernel/Forward.h @@ -76,7 +76,7 @@ class InodeVMObject; class MappedROM; class MemoryManager; class PageDirectory; -class PhysicalPage; +class PhysicalRAMPage; class PhysicalRegion; class PrivateInodeVMObject; class Region; diff --git a/Kernel/Memory/AnonymousVMObject.cpp b/Kernel/Memory/AnonymousVMObject.cpp index 7070d8ccafa..961295f3364 100644 --- a/Kernel/Memory/AnonymousVMObject.cpp +++ b/Kernel/Memory/AnonymousVMObject.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include namespace Kernel::Memory { @@ -92,7 +92,7 @@ ErrorOr> AnonymousVMObject::try_create_phys { auto contiguous_physical_pages = TRY(MM.allocate_contiguous_physical_pages(size)); - auto new_physical_pages = TRY(FixedArray>::create(contiguous_physical_pages.span())); + auto new_physical_pages = TRY(FixedArray>::create(contiguous_physical_pages.span())); return adopt_nonnull_lock_ref_or_enomem(new (nothrow) AnonymousVMObject(move(new_physical_pages))); } @@ -111,9 +111,9 @@ ErrorOr> AnonymousVMObject::try_create_purg return vmobject; } -ErrorOr> AnonymousVMObject::try_create_with_physical_pages(Span> physical_pages) +ErrorOr> AnonymousVMObject::try_create_with_physical_pages(Span> physical_pages) { - auto new_physical_pages = TRY(FixedArray>::create(physical_pages)); + auto new_physical_pages = TRY(FixedArray>::create(physical_pages)); return adopt_nonnull_lock_ref_or_enomem(new (nothrow) AnonymousVMObject(move(new_physical_pages))); } @@ -130,7 +130,7 @@ ErrorOr> AnonymousVMObject::try_create_for_ return adopt_nonnull_lock_ref_or_enomem(new (nothrow) AnonymousVMObject(paddr, move(new_physical_pages))); } -ErrorOr> AnonymousVMObject::try_create_with_shared_cow(AnonymousVMObject const& other, NonnullLockRefPtr shared_committed_cow_pages, FixedArray>&& new_physical_pages) +ErrorOr> AnonymousVMObject::try_create_with_shared_cow(AnonymousVMObject const& other, NonnullLockRefPtr shared_committed_cow_pages, FixedArray>&& new_physical_pages) { auto weak_parent = TRY(other.try_make_weak_ptr()); auto vmobject = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) AnonymousVMObject(move(weak_parent), move(shared_committed_cow_pages), move(new_physical_pages)))); @@ -140,7 +140,7 @@ ErrorOr> AnonymousVMObject::try_create_with return vmobject; } -AnonymousVMObject::AnonymousVMObject(FixedArray>&& new_physical_pages, AllocationStrategy strategy, Optional committed_pages) +AnonymousVMObject::AnonymousVMObject(FixedArray>&& new_physical_pages, AllocationStrategy strategy, Optional committed_pages) : VMObject(move(new_physical_pages)) , m_unused_committed_pages(move(committed_pages)) { @@ -155,20 +155,20 @@ AnonymousVMObject::AnonymousVMObject(FixedArray>&& new_phys } } -AnonymousVMObject::AnonymousVMObject(PhysicalAddress paddr, FixedArray>&& new_physical_pages) +AnonymousVMObject::AnonymousVMObject(PhysicalAddress paddr, FixedArray>&& new_physical_pages) : VMObject(move(new_physical_pages)) { VERIFY(paddr.page_base() == paddr); for (size_t i = 0; i < page_count(); ++i) - physical_pages()[i] = PhysicalPage::create(paddr.offset(i * PAGE_SIZE), MayReturnToFreeList::No); + physical_pages()[i] = PhysicalRAMPage::create(paddr.offset(i * PAGE_SIZE), MayReturnToFreeList::No); } -AnonymousVMObject::AnonymousVMObject(FixedArray>&& new_physical_pages) +AnonymousVMObject::AnonymousVMObject(FixedArray>&& new_physical_pages) : VMObject(move(new_physical_pages)) { } -AnonymousVMObject::AnonymousVMObject(LockWeakPtr other, NonnullLockRefPtr shared_committed_cow_pages, FixedArray>&& new_physical_pages) +AnonymousVMObject::AnonymousVMObject(LockWeakPtr other, NonnullLockRefPtr shared_committed_cow_pages, FixedArray>&& new_physical_pages) : VMObject(move(new_physical_pages)) , m_cow_parent(move(other)) , m_shared_committed_cow_pages(move(shared_committed_cow_pages)) @@ -271,7 +271,7 @@ ErrorOr AnonymousVMObject::set_volatile(bool is_volatile, bool& was_purged return {}; } -NonnullRefPtr AnonymousVMObject::allocate_committed_page(Badge) +NonnullRefPtr AnonymousVMObject::allocate_committed_page(Badge) { return m_unused_committed_pages->take_one(); } @@ -345,7 +345,7 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual return PageFaultResponse::Continue; } - RefPtr page; + RefPtr page; if (m_shared_committed_cow_pages) { dbgln_if(PAGE_FAULT_DEBUG, " >> It's a committed COW page and it's time to COW!"); page = m_shared_committed_cow_pages->take_one(); @@ -388,7 +388,7 @@ AnonymousVMObject::SharedCommittedCowPages::SharedCommittedCowPages(CommittedPhy AnonymousVMObject::SharedCommittedCowPages::~SharedCommittedCowPages() = default; -NonnullRefPtr AnonymousVMObject::SharedCommittedCowPages::take_one() +NonnullRefPtr AnonymousVMObject::SharedCommittedCowPages::take_one() { SpinlockLocker locker(m_lock); return m_committed_pages.take_one(); diff --git a/Kernel/Memory/AnonymousVMObject.h b/Kernel/Memory/AnonymousVMObject.h index 3f491cdfae7..d98e031be95 100644 --- a/Kernel/Memory/AnonymousVMObject.h +++ b/Kernel/Memory/AnonymousVMObject.h @@ -20,12 +20,12 @@ public: static ErrorOr> try_create_with_size(size_t, AllocationStrategy); static ErrorOr> try_create_for_physical_range(PhysicalAddress paddr, size_t size); - static ErrorOr> try_create_with_physical_pages(Span>); + static ErrorOr> try_create_with_physical_pages(Span>); static ErrorOr> try_create_purgeable_with_size(size_t, AllocationStrategy); static ErrorOr> try_create_physically_contiguous_with_size(size_t); virtual ErrorOr> try_clone() override; - [[nodiscard]] NonnullRefPtr allocate_committed_page(Badge); + [[nodiscard]] NonnullRefPtr allocate_committed_page(Badge); PageFaultResponse handle_cow_fault(size_t, VirtualAddress); size_t cow_pages() const; bool should_cow(size_t page_index, bool) const; @@ -41,12 +41,12 @@ public: private: class SharedCommittedCowPages; - static ErrorOr> try_create_with_shared_cow(AnonymousVMObject const&, NonnullLockRefPtr, FixedArray>&&); + static ErrorOr> try_create_with_shared_cow(AnonymousVMObject const&, NonnullLockRefPtr, FixedArray>&&); - explicit AnonymousVMObject(FixedArray>&&, AllocationStrategy, Optional); - explicit AnonymousVMObject(PhysicalAddress, FixedArray>&&); - explicit AnonymousVMObject(FixedArray>&&); - explicit AnonymousVMObject(LockWeakPtr, NonnullLockRefPtr, FixedArray>&&); + explicit AnonymousVMObject(FixedArray>&&, AllocationStrategy, Optional); + explicit AnonymousVMObject(PhysicalAddress, FixedArray>&&); + explicit AnonymousVMObject(FixedArray>&&); + explicit AnonymousVMObject(LockWeakPtr, NonnullLockRefPtr, FixedArray>&&); virtual StringView class_name() const override { return "AnonymousVMObject"sv; } @@ -74,7 +74,7 @@ private: [[nodiscard]] bool is_empty() const { return m_committed_pages.is_empty(); } - [[nodiscard]] NonnullRefPtr take_one(); + [[nodiscard]] NonnullRefPtr take_one(); void uncommit_one(); private: diff --git a/Kernel/Memory/InodeVMObject.cpp b/Kernel/Memory/InodeVMObject.cpp index d0fbd558b10..5a8a97c3d6d 100644 --- a/Kernel/Memory/InodeVMObject.cpp +++ b/Kernel/Memory/InodeVMObject.cpp @@ -9,14 +9,14 @@ namespace Kernel::Memory { -InodeVMObject::InodeVMObject(Inode& inode, FixedArray>&& new_physical_pages, Bitmap dirty_pages) +InodeVMObject::InodeVMObject(Inode& inode, FixedArray>&& new_physical_pages, Bitmap dirty_pages) : VMObject(move(new_physical_pages)) , m_inode(inode) , m_dirty_pages(move(dirty_pages)) { } -InodeVMObject::InodeVMObject(InodeVMObject const& other, FixedArray>&& new_physical_pages, Bitmap dirty_pages) +InodeVMObject::InodeVMObject(InodeVMObject const& other, FixedArray>&& new_physical_pages, Bitmap dirty_pages) : VMObject(move(new_physical_pages)) , m_inode(other.m_inode) , m_dirty_pages(move(dirty_pages)) diff --git a/Kernel/Memory/InodeVMObject.h b/Kernel/Memory/InodeVMObject.h index ebd087ae597..99e02ad32bc 100644 --- a/Kernel/Memory/InodeVMObject.h +++ b/Kernel/Memory/InodeVMObject.h @@ -28,8 +28,8 @@ public: u32 writable_mappings() const; protected: - explicit InodeVMObject(Inode&, FixedArray>&&, Bitmap dirty_pages); - explicit InodeVMObject(InodeVMObject const&, FixedArray>&&, Bitmap dirty_pages); + explicit InodeVMObject(Inode&, FixedArray>&&, Bitmap dirty_pages); + explicit InodeVMObject(InodeVMObject const&, FixedArray>&&, Bitmap dirty_pages); InodeVMObject& operator=(InodeVMObject const&) = delete; InodeVMObject& operator=(InodeVMObject&&) = delete; diff --git a/Kernel/Memory/MMIOVMObject.cpp b/Kernel/Memory/MMIOVMObject.cpp index d427325eef8..58d7f72778f 100644 --- a/Kernel/Memory/MMIOVMObject.cpp +++ b/Kernel/Memory/MMIOVMObject.cpp @@ -22,7 +22,7 @@ ErrorOr> MMIOVMObject::try_create_for_physical_r return adopt_nonnull_lock_ref_or_enomem(new (nothrow) MMIOVMObject(paddr, move(new_physical_pages))); } -MMIOVMObject::MMIOVMObject(PhysicalAddress paddr, FixedArray>&& new_physical_pages) +MMIOVMObject::MMIOVMObject(PhysicalAddress paddr, FixedArray>&& new_physical_pages) : VMObject(move(new_physical_pages)) { VERIFY(paddr.page_base() == paddr); diff --git a/Kernel/Memory/MMIOVMObject.h b/Kernel/Memory/MMIOVMObject.h index f78892ed27d..638e9b25ed9 100644 --- a/Kernel/Memory/MMIOVMObject.h +++ b/Kernel/Memory/MMIOVMObject.h @@ -18,7 +18,7 @@ public: virtual ErrorOr> try_clone() override { return ENOTSUP; } private: - MMIOVMObject(PhysicalAddress, FixedArray>&&); + MMIOVMObject(PhysicalAddress, FixedArray>&&); virtual StringView class_name() const override { return "MMIOVMObject"sv; } }; diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index 8716a29b844..e1a99969d51 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -788,7 +788,7 @@ UNMAP_AFTER_INIT void MemoryManager::initialize_physical_pages() auto pt_paddr = page_tables_base.offset(pt_index * PAGE_SIZE); auto physical_page_index = PhysicalAddress::physical_page_index(pt_paddr.get()); auto& physical_page_entry = m_physical_page_entries[physical_page_index]; - auto physical_page = adopt_lock_ref(*new (&physical_page_entry.allocated.physical_page) PhysicalPage(MayReturnToFreeList::No)); + auto physical_page = adopt_lock_ref(*new (&physical_page_entry.allocated.physical_page) PhysicalRAMPage(MayReturnToFreeList::No)); // NOTE: This leaked ref is matched by the unref in MemoryManager::release_pte() (void)physical_page.leak_ref(); @@ -827,7 +827,7 @@ PhysicalPageEntry& MemoryManager::get_physical_page_entry(PhysicalAddress physic return m_physical_page_entries[physical_page_entry_index]; } -PhysicalAddress MemoryManager::get_physical_address(PhysicalPage const& physical_page) +PhysicalAddress MemoryManager::get_physical_address(PhysicalRAMPage const& physical_page) { PhysicalPageEntry const& physical_page_entry = *reinterpret_cast((u8 const*)&physical_page - __builtin_offsetof(PhysicalPageEntry, allocated.physical_page)); size_t physical_page_entry_index = &physical_page_entry - m_physical_page_entries; @@ -1065,7 +1065,7 @@ ErrorOr> MemoryManager::allocate_contiguous_kernel_region( return region; } -ErrorOr> MemoryManager::allocate_dma_buffer_page(StringView name, Memory::Region::Access access, RefPtr& dma_buffer_page) +ErrorOr> MemoryManager::allocate_dma_buffer_page(StringView name, Memory::Region::Access access, RefPtr& dma_buffer_page) { auto page = TRY(allocate_physical_page()); dma_buffer_page = page; @@ -1075,12 +1075,12 @@ ErrorOr> MemoryManager::allocate_dma_buffer_page(S ErrorOr> MemoryManager::allocate_dma_buffer_page(StringView name, Memory::Region::Access access) { - RefPtr dma_buffer_page; + RefPtr dma_buffer_page; return allocate_dma_buffer_page(name, access, dma_buffer_page); } -ErrorOr> MemoryManager::allocate_dma_buffer_pages(size_t size, StringView name, Memory::Region::Access access, Vector>& dma_buffer_pages) +ErrorOr> MemoryManager::allocate_dma_buffer_pages(size_t size, StringView name, Memory::Region::Access access, Vector>& dma_buffer_pages) { VERIFY(!(size % PAGE_SIZE)); dma_buffer_pages = TRY(allocate_contiguous_physical_pages(size)); @@ -1091,7 +1091,7 @@ ErrorOr> MemoryManager::allocate_dma_buffer_pages( ErrorOr> MemoryManager::allocate_dma_buffer_pages(size_t size, StringView name, Memory::Region::Access access) { VERIFY(!(size % PAGE_SIZE)); - Vector> dma_buffer_pages; + Vector> dma_buffer_pages; return allocate_dma_buffer_pages(size, name, access, dma_buffer_pages); } @@ -1109,7 +1109,7 @@ ErrorOr> MemoryManager::allocate_kernel_region(size_t size return region; } -ErrorOr> MemoryManager::allocate_kernel_region_with_physical_pages(Span> pages, StringView name, Region::Access access, Region::Cacheable cacheable) +ErrorOr> MemoryManager::allocate_kernel_region_with_physical_pages(Span> pages, StringView name, Region::Access access, Region::Cacheable cacheable) { auto vmobject = TRY(AnonymousVMObject::try_create_with_physical_pages(pages)); OwnPtr name_kstring; @@ -1218,9 +1218,9 @@ void MemoryManager::deallocate_physical_page(PhysicalAddress paddr) }); } -RefPtr MemoryManager::find_free_physical_page(bool committed) +RefPtr MemoryManager::find_free_physical_page(bool committed) { - RefPtr page; + RefPtr page; m_global_data.with([&](auto& global_data) { if (committed) { // Draw from the committed pages pool. We should always have these pages available @@ -1247,7 +1247,7 @@ RefPtr MemoryManager::find_free_physical_page(bool committed) return page; } -NonnullRefPtr MemoryManager::allocate_committed_physical_page(Badge, ShouldZeroFill should_zero_fill) +NonnullRefPtr MemoryManager::allocate_committed_physical_page(Badge, ShouldZeroFill should_zero_fill) { auto page = find_free_physical_page(true); VERIFY(page); @@ -1260,9 +1260,9 @@ NonnullRefPtr MemoryManager::allocate_committed_physical_page(Badg return page.release_nonnull(); } -ErrorOr> MemoryManager::allocate_physical_page(ShouldZeroFill should_zero_fill, bool* did_purge) +ErrorOr> MemoryManager::allocate_physical_page(ShouldZeroFill should_zero_fill, bool* did_purge) { - return m_global_data.with([&](auto&) -> ErrorOr> { + return m_global_data.with([&](auto&) -> ErrorOr> { auto page = find_free_physical_page(false); bool purged_pages = false; @@ -1317,12 +1317,12 @@ ErrorOr> MemoryManager::allocate_physical_page(Shoul }); } -ErrorOr>> MemoryManager::allocate_contiguous_physical_pages(size_t size) +ErrorOr>> MemoryManager::allocate_contiguous_physical_pages(size_t size) { VERIFY(!(size % PAGE_SIZE)); size_t page_count = ceil_div(size, static_cast(PAGE_SIZE)); - auto physical_pages = TRY(m_global_data.with([&](auto& global_data) -> ErrorOr>> { + auto physical_pages = TRY(m_global_data.with([&](auto& global_data) -> ErrorOr>> { // We need to make sure we don't touch pages that we have committed to if (global_data.system_memory_info.physical_pages_uncommitted < page_count) return ENOMEM; @@ -1495,7 +1495,7 @@ CommittedPhysicalPageSet::~CommittedPhysicalPageSet() MM.uncommit_physical_pages({}, m_page_count); } -NonnullRefPtr CommittedPhysicalPageSet::take_one() +NonnullRefPtr CommittedPhysicalPageSet::take_one() { VERIFY(m_page_count > 0); --m_page_count; @@ -1509,7 +1509,7 @@ void CommittedPhysicalPageSet::uncommit_one() MM.uncommit_physical_pages({}, 1); } -void MemoryManager::copy_physical_page(PhysicalPage& physical_page, u8 page_buffer[PAGE_SIZE]) +void MemoryManager::copy_physical_page(PhysicalRAMPage& physical_page, u8 page_buffer[PAGE_SIZE]) { auto* quickmapped_page = quickmap_page(physical_page); memcpy(page_buffer, quickmapped_page, PAGE_SIZE); diff --git a/Kernel/Memory/MemoryManager.h b/Kernel/Memory/MemoryManager.h index ecc8db89ce3..fd7a0e745c5 100644 --- a/Kernel/Memory/MemoryManager.h +++ b/Kernel/Memory/MemoryManager.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -113,7 +113,7 @@ public: bool is_empty() const { return m_page_count == 0; } size_t page_count() const { return m_page_count; } - [[nodiscard]] NonnullRefPtr take_one(); + [[nodiscard]] NonnullRefPtr take_one(); void uncommit_one(); void operator=(CommittedPhysicalPageSet&&) = delete; @@ -163,19 +163,19 @@ public: ErrorOr commit_physical_pages(size_t page_count); void uncommit_physical_pages(Badge, size_t page_count); - NonnullRefPtr allocate_committed_physical_page(Badge, ShouldZeroFill = ShouldZeroFill::Yes); - ErrorOr> allocate_physical_page(ShouldZeroFill = ShouldZeroFill::Yes, bool* did_purge = nullptr); - ErrorOr>> allocate_contiguous_physical_pages(size_t size); + NonnullRefPtr allocate_committed_physical_page(Badge, ShouldZeroFill = ShouldZeroFill::Yes); + ErrorOr> allocate_physical_page(ShouldZeroFill = ShouldZeroFill::Yes, bool* did_purge = nullptr); + ErrorOr>> allocate_contiguous_physical_pages(size_t size); void deallocate_physical_page(PhysicalAddress); ErrorOr> allocate_contiguous_kernel_region(size_t, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes); - ErrorOr> allocate_dma_buffer_page(StringView name, Memory::Region::Access access, RefPtr& dma_buffer_page); + ErrorOr> allocate_dma_buffer_page(StringView name, Memory::Region::Access access, RefPtr& dma_buffer_page); ErrorOr> allocate_dma_buffer_page(StringView name, Memory::Region::Access access); - ErrorOr> allocate_dma_buffer_pages(size_t size, StringView name, Memory::Region::Access access, Vector>& dma_buffer_pages); + ErrorOr> allocate_dma_buffer_pages(size_t size, StringView name, Memory::Region::Access access, Vector>& dma_buffer_pages); ErrorOr> allocate_dma_buffer_pages(size_t size, StringView name, Memory::Region::Access access); ErrorOr> allocate_kernel_region(size_t, StringView name, Region::Access access, AllocationStrategy strategy = AllocationStrategy::Reserve, Region::Cacheable = Region::Cacheable::Yes); ErrorOr> allocate_mmio_kernel_region(PhysicalAddress, size_t, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes); - ErrorOr> allocate_kernel_region_with_physical_pages(Span>, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes); + ErrorOr> allocate_kernel_region_with_physical_pages(Span>, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes); ErrorOr> allocate_kernel_region_with_vmobject(VMObject&, size_t, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes); ErrorOr> allocate_unbacked_region_anywhere(size_t size, size_t alignment); ErrorOr> create_identity_mapped_region(PhysicalAddress, size_t); @@ -215,8 +215,8 @@ public: void dump_kernel_regions(); - PhysicalPage& shared_zero_page() { return *m_shared_zero_page; } - PhysicalPage& lazy_committed_page() { return *m_lazy_committed_page; } + PhysicalRAMPage& shared_zero_page() { return *m_shared_zero_page; } + PhysicalRAMPage& lazy_committed_page() { return *m_lazy_committed_page; } PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; } @@ -231,9 +231,9 @@ public: bool is_allowed_to_read_physical_memory_for_userspace(PhysicalAddress, size_t read_length) const; PhysicalPageEntry& get_physical_page_entry(PhysicalAddress); - PhysicalAddress get_physical_address(PhysicalPage const&); + PhysicalAddress get_physical_address(PhysicalRAMPage const&); - void copy_physical_page(PhysicalPage&, u8 page_buffer[PAGE_SIZE]); + void copy_physical_page(PhysicalRAMPage&, u8 page_buffer[PAGE_SIZE]); IterationDecision for_each_physical_memory_range(Function); @@ -272,9 +272,9 @@ private: static void flush_tlb_local(VirtualAddress, size_t page_count = 1); static void flush_tlb(PageDirectory const*, VirtualAddress, size_t page_count = 1); - RefPtr find_free_physical_page(bool); + RefPtr find_free_physical_page(bool); - ALWAYS_INLINE u8* quickmap_page(PhysicalPage& page) + ALWAYS_INLINE u8* quickmap_page(PhysicalRAMPage& page) { return quickmap_page(page.paddr()); } @@ -296,8 +296,8 @@ private: // and then never change. Atomic ref-counting covers that case without // the need for additional synchronization. LockRefPtr m_kernel_page_directory; - RefPtr m_shared_zero_page; - RefPtr m_lazy_committed_page; + RefPtr m_shared_zero_page; + RefPtr m_lazy_committed_page; // NOTE: These are outside of GlobalData as they are initialized on startup, // and then never change. @@ -307,12 +307,12 @@ private: SpinlockProtected m_global_data; }; -inline bool PhysicalPage::is_shared_zero_page() const +inline bool PhysicalRAMPage::is_shared_zero_page() const { return this == &MM.shared_zero_page(); } -inline bool PhysicalPage::is_lazy_committed_page() const +inline bool PhysicalRAMPage::is_lazy_committed_page() const { return this == &MM.lazy_committed_page(); } diff --git a/Kernel/Memory/PhysicalPage.cpp b/Kernel/Memory/PhysicalRAMPage.cpp similarity index 62% rename from Kernel/Memory/PhysicalPage.cpp rename to Kernel/Memory/PhysicalRAMPage.cpp index 2f5ceb5b9a2..6c578d864cc 100644 --- a/Kernel/Memory/PhysicalPage.cpp +++ b/Kernel/Memory/PhysicalRAMPage.cpp @@ -6,37 +6,37 @@ #include #include -#include +#include namespace Kernel::Memory { -NonnullRefPtr PhysicalPage::create(PhysicalAddress paddr, MayReturnToFreeList may_return_to_freelist) +NonnullRefPtr PhysicalRAMPage::create(PhysicalAddress paddr, MayReturnToFreeList may_return_to_freelist) { auto& physical_page_entry = MM.get_physical_page_entry(paddr); - return adopt_ref(*new (&physical_page_entry.allocated.physical_page) PhysicalPage(may_return_to_freelist)); + return adopt_ref(*new (&physical_page_entry.allocated.physical_page) PhysicalRAMPage(may_return_to_freelist)); } -PhysicalPage::PhysicalPage(MayReturnToFreeList may_return_to_freelist) +PhysicalRAMPage::PhysicalRAMPage(MayReturnToFreeList may_return_to_freelist) : m_may_return_to_freelist(may_return_to_freelist) { } -PhysicalAddress PhysicalPage::paddr() const +PhysicalAddress PhysicalRAMPage::paddr() const { return MM.get_physical_address(*this); } -void PhysicalPage::free_this() const +void PhysicalRAMPage::free_this() const { auto paddr = MM.get_physical_address(*this); if (m_may_return_to_freelist == MayReturnToFreeList::Yes) { auto& this_as_freelist_entry = MM.get_physical_page_entry(paddr).freelist; - this->~PhysicalPage(); // delete in place + this->~PhysicalRAMPage(); // delete in place this_as_freelist_entry.next_index = -1; this_as_freelist_entry.prev_index = -1; MM.deallocate_physical_page(paddr); } else { - this->~PhysicalPage(); // delete in place + this->~PhysicalRAMPage(); // delete in place } } diff --git a/Kernel/Memory/PhysicalPage.h b/Kernel/Memory/PhysicalRAMPage.h similarity index 75% rename from Kernel/Memory/PhysicalPage.h rename to Kernel/Memory/PhysicalRAMPage.h index e1ddbc84b86..c4ad1cb8a21 100644 --- a/Kernel/Memory/PhysicalPage.h +++ b/Kernel/Memory/PhysicalRAMPage.h @@ -16,9 +16,9 @@ enum class MayReturnToFreeList : bool { Yes }; -class PhysicalPage { - AK_MAKE_NONCOPYABLE(PhysicalPage); - AK_MAKE_NONMOVABLE(PhysicalPage); +class PhysicalRAMPage { + AK_MAKE_NONCOPYABLE(PhysicalRAMPage); + AK_MAKE_NONMOVABLE(PhysicalRAMPage); friend class MemoryManager; @@ -36,7 +36,7 @@ public: free_this(); } - static NonnullRefPtr create(PhysicalAddress, MayReturnToFreeList may_return_to_freelist = MayReturnToFreeList::Yes); + static NonnullRefPtr create(PhysicalAddress, MayReturnToFreeList may_return_to_freelist = MayReturnToFreeList::Yes); u32 ref_count() const { return m_ref_count.load(AK::memory_order_consume); } @@ -44,8 +44,8 @@ public: bool is_lazy_committed_page() const; private: - explicit PhysicalPage(MayReturnToFreeList may_return_to_freelist); - ~PhysicalPage() = default; + explicit PhysicalRAMPage(MayReturnToFreeList may_return_to_freelist); + ~PhysicalRAMPage() = default; void free_this() const; @@ -57,7 +57,7 @@ struct PhysicalPageEntry { union { // If it's a live PhysicalPage object: struct { - PhysicalPage physical_page; + PhysicalRAMPage physical_page; } allocated; // If it's an entry in a PhysicalZone::Bucket's freelist. diff --git a/Kernel/Memory/PhysicalRegion.cpp b/Kernel/Memory/PhysicalRegion.cpp index f2746c43cc4..004bdd2178c 100644 --- a/Kernel/Memory/PhysicalRegion.cpp +++ b/Kernel/Memory/PhysicalRegion.cpp @@ -74,7 +74,7 @@ OwnPtr PhysicalRegion::try_take_pages_from_beginning(size_t page return try_create(taken_lower, taken_upper); } -Vector> PhysicalRegion::take_contiguous_free_pages(size_t count) +Vector> PhysicalRegion::take_contiguous_free_pages(size_t count) { auto rounded_page_count = next_power_of_two(count); auto order = count_trailing_zeroes(rounded_page_count); @@ -94,15 +94,15 @@ Vector> PhysicalRegion::take_contiguous_free_pages(s if (!page_base.has_value()) return {}; - Vector> physical_pages; + Vector> physical_pages; physical_pages.ensure_capacity(count); for (size_t i = 0; i < count; ++i) - physical_pages.append(PhysicalPage::create(page_base.value().offset(i * PAGE_SIZE))); + physical_pages.append(PhysicalRAMPage::create(page_base.value().offset(i * PAGE_SIZE))); return physical_pages; } -RefPtr PhysicalRegion::take_free_page() +RefPtr PhysicalRegion::take_free_page() { if (m_usable_zones.is_empty()) return nullptr; @@ -116,7 +116,7 @@ RefPtr PhysicalRegion::take_free_page() m_full_zones.append(zone); } - return PhysicalPage::create(page.value()); + return PhysicalRAMPage::create(page.value()); } void PhysicalRegion::return_page(PhysicalAddress paddr) diff --git a/Kernel/Memory/PhysicalRegion.h b/Kernel/Memory/PhysicalRegion.h index 72b5e2d87d7..52067b1599e 100644 --- a/Kernel/Memory/PhysicalRegion.h +++ b/Kernel/Memory/PhysicalRegion.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace Kernel::Memory { @@ -34,8 +34,8 @@ public: OwnPtr try_take_pages_from_beginning(size_t); - RefPtr take_free_page(); - Vector> take_contiguous_free_pages(size_t count); + RefPtr take_free_page(); + Vector> take_contiguous_free_pages(size_t count); void return_page(PhysicalAddress); private: diff --git a/Kernel/Memory/PhysicalZone.cpp b/Kernel/Memory/PhysicalZone.cpp index f80c145770f..3126a878959 100644 --- a/Kernel/Memory/PhysicalZone.cpp +++ b/Kernel/Memory/PhysicalZone.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include namespace Kernel::Memory { diff --git a/Kernel/Memory/PrivateInodeVMObject.cpp b/Kernel/Memory/PrivateInodeVMObject.cpp index 8463656e06d..16be887ff65 100644 --- a/Kernel/Memory/PrivateInodeVMObject.cpp +++ b/Kernel/Memory/PrivateInodeVMObject.cpp @@ -34,12 +34,12 @@ ErrorOr> PrivateInodeVMObject::try_clone() return adopt_nonnull_lock_ref_or_enomem(new (nothrow) PrivateInodeVMObject(*this, move(new_physical_pages), move(dirty_pages))); } -PrivateInodeVMObject::PrivateInodeVMObject(Inode& inode, FixedArray>&& new_physical_pages, Bitmap dirty_pages) +PrivateInodeVMObject::PrivateInodeVMObject(Inode& inode, FixedArray>&& new_physical_pages, Bitmap dirty_pages) : InodeVMObject(inode, move(new_physical_pages), move(dirty_pages)) { } -PrivateInodeVMObject::PrivateInodeVMObject(PrivateInodeVMObject const& other, FixedArray>&& new_physical_pages, Bitmap dirty_pages) +PrivateInodeVMObject::PrivateInodeVMObject(PrivateInodeVMObject const& other, FixedArray>&& new_physical_pages, Bitmap dirty_pages) : InodeVMObject(other, move(new_physical_pages), move(dirty_pages)) { } diff --git a/Kernel/Memory/PrivateInodeVMObject.h b/Kernel/Memory/PrivateInodeVMObject.h index 9542bf1b789..ffedc70d7d5 100644 --- a/Kernel/Memory/PrivateInodeVMObject.h +++ b/Kernel/Memory/PrivateInodeVMObject.h @@ -24,8 +24,8 @@ public: private: virtual bool is_private_inode() const override { return true; } - explicit PrivateInodeVMObject(Inode&, FixedArray>&&, Bitmap dirty_pages); - explicit PrivateInodeVMObject(PrivateInodeVMObject const&, FixedArray>&&, Bitmap dirty_pages); + explicit PrivateInodeVMObject(Inode&, FixedArray>&&, Bitmap dirty_pages); + explicit PrivateInodeVMObject(PrivateInodeVMObject const&, FixedArray>&&, Bitmap dirty_pages); virtual StringView class_name() const override { return "PrivateInodeVMObject"sv; } diff --git a/Kernel/Memory/Region.cpp b/Kernel/Memory/Region.cpp index 59df192548a..56b05a2edae 100644 --- a/Kernel/Memory/Region.cpp +++ b/Kernel/Memory/Region.cpp @@ -210,7 +210,7 @@ ErrorOr Region::set_should_cow(size_t page_index, bool cow) return {}; } -bool Region::map_individual_page_impl(size_t page_index, RefPtr page) +bool Region::map_individual_page_impl(size_t page_index, RefPtr page) { if (!page) return map_individual_page_impl(page_index, {}, false, false); @@ -257,7 +257,7 @@ bool Region::map_individual_page_impl(size_t page_index, PhysicalAddress paddr, bool Region::map_individual_page_impl(size_t page_index) { - RefPtr page; + RefPtr page; { SpinlockLocker vmobject_locker(vmobject().m_lock); page = physical_page(page_index); @@ -266,7 +266,7 @@ bool Region::map_individual_page_impl(size_t page_index) return map_individual_page_impl(page_index, page); } -bool Region::remap_vmobject_page(size_t page_index, NonnullRefPtr physical_page) +bool Region::remap_vmobject_page(size_t page_index, NonnullRefPtr physical_page) { SpinlockLocker page_lock(m_page_directory->get_lock()); @@ -487,7 +487,7 @@ PageFaultResponse Region::handle_fault(PageFault const& fault) #endif } -PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region, PhysicalPage& page_in_slot_at_time_of_fault) +PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region, PhysicalRAMPage& page_in_slot_at_time_of_fault) { VERIFY(vmobject().is_anonymous()); @@ -497,7 +497,7 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region, Physica if (current_thread != nullptr) current_thread->did_zero_fault(); - RefPtr new_physical_page; + RefPtr new_physical_page; if (page_in_slot_at_time_of_fault.is_lazy_committed_page()) { VERIFY(m_vmobject->is_anonymous()); @@ -636,14 +636,14 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region) return PageFaultResponse::Continue; } -RefPtr Region::physical_page(size_t index) const +RefPtr Region::physical_page(size_t index) const { SpinlockLocker vmobject_locker(vmobject().m_lock); VERIFY(index < page_count()); return vmobject().physical_pages()[first_page_index() + index]; } -RefPtr& Region::physical_page_slot(size_t index) +RefPtr& Region::physical_page_slot(size_t index) { VERIFY(vmobject().m_lock.is_locked_by_current_processor()); VERIFY(index < page_count()); diff --git a/Kernel/Memory/Region.h b/Kernel/Memory/Region.h index 3f6a3a0785e..4be8f59f83a 100644 --- a/Kernel/Memory/Region.h +++ b/Kernel/Memory/Region.h @@ -163,8 +163,8 @@ public: return size() / PAGE_SIZE; } - RefPtr physical_page(size_t index) const; - RefPtr& physical_page_slot(size_t index); + RefPtr physical_page(size_t index) const; + RefPtr& physical_page_slot(size_t index); [[nodiscard]] size_t offset_in_vmobject() const { @@ -232,7 +232,7 @@ private: Region(NonnullLockRefPtr, size_t offset_in_vmobject, OwnPtr, Region::Access access, Cacheable, bool shared); Region(VirtualRange const&, NonnullLockRefPtr, size_t offset_in_vmobject, OwnPtr, Region::Access access, Cacheable, bool shared); - [[nodiscard]] bool remap_vmobject_page(size_t page_index, NonnullRefPtr); + [[nodiscard]] bool remap_vmobject_page(size_t page_index, NonnullRefPtr); void set_access_bit(Access access, bool b) { @@ -244,10 +244,10 @@ private: [[nodiscard]] PageFaultResponse handle_cow_fault(size_t page_index); [[nodiscard]] PageFaultResponse handle_inode_fault(size_t page_index); - [[nodiscard]] PageFaultResponse handle_zero_fault(size_t page_index, PhysicalPage& page_in_slot_at_time_of_fault); + [[nodiscard]] PageFaultResponse handle_zero_fault(size_t page_index, PhysicalRAMPage& page_in_slot_at_time_of_fault); [[nodiscard]] bool map_individual_page_impl(size_t page_index); - [[nodiscard]] bool map_individual_page_impl(size_t page_index, RefPtr); + [[nodiscard]] bool map_individual_page_impl(size_t page_index, RefPtr); [[nodiscard]] bool map_individual_page_impl(size_t page_index, PhysicalAddress); [[nodiscard]] bool map_individual_page_impl(size_t page_index, PhysicalAddress, bool readable, bool writeable); diff --git a/Kernel/Memory/ScatterGatherList.cpp b/Kernel/Memory/ScatterGatherList.cpp index 9a97f439891..f5521d5369a 100644 --- a/Kernel/Memory/ScatterGatherList.cpp +++ b/Kernel/Memory/ScatterGatherList.cpp @@ -8,7 +8,7 @@ namespace Kernel::Memory { -ErrorOr> ScatterGatherList::try_create(AsyncBlockDeviceRequest& request, Span> allocated_pages, size_t device_block_size, StringView region_name) +ErrorOr> ScatterGatherList::try_create(AsyncBlockDeviceRequest& request, Span> allocated_pages, size_t device_block_size, StringView region_name) { auto vm_object = TRY(AnonymousVMObject::try_create_with_physical_pages(allocated_pages)); auto size = TRY(page_round_up((request.block_count() * device_block_size))); diff --git a/Kernel/Memory/ScatterGatherList.h b/Kernel/Memory/ScatterGatherList.h index 8e97759db29..11e33970f8c 100644 --- a/Kernel/Memory/ScatterGatherList.h +++ b/Kernel/Memory/ScatterGatherList.h @@ -19,7 +19,7 @@ namespace Kernel::Memory { class ScatterGatherList final : public AtomicRefCounted { public: - static ErrorOr> try_create(AsyncBlockDeviceRequest&, Span> allocated_pages, size_t device_block_size, StringView region_name); + static ErrorOr> try_create(AsyncBlockDeviceRequest&, Span> allocated_pages, size_t device_block_size, StringView region_name); VMObject const& vmobject() const { return m_vm_object; } VirtualAddress dma_region() const { return m_dma_region->vaddr(); } size_t scatters_count() const { return m_vm_object->physical_pages().size(); } diff --git a/Kernel/Memory/SharedFramebufferVMObject.cpp b/Kernel/Memory/SharedFramebufferVMObject.cpp index ba34f72952a..5e8b4b91d5a 100644 --- a/Kernel/Memory/SharedFramebufferVMObject.cpp +++ b/Kernel/Memory/SharedFramebufferVMObject.cpp @@ -56,21 +56,21 @@ ErrorOr SharedFramebufferVMObject::create_real_writes_framebuffer_vm_objec return {}; } -Span> SharedFramebufferVMObject::real_framebuffer_physical_pages() +Span> SharedFramebufferVMObject::real_framebuffer_physical_pages() { return m_real_framebuffer_vmobject->physical_pages(); } -ReadonlySpan> SharedFramebufferVMObject::real_framebuffer_physical_pages() const +ReadonlySpan> SharedFramebufferVMObject::real_framebuffer_physical_pages() const { return m_real_framebuffer_vmobject->physical_pages(); } -Span> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages() +Span> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages() { return m_physical_pages.span(); } -ReadonlySpan> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages() const +ReadonlySpan> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages() const { return m_physical_pages.span(); } @@ -92,14 +92,14 @@ void SharedFramebufferVMObject::switch_to_real_framebuffer_writes(Badge> SharedFramebufferVMObject::physical_pages() const +ReadonlySpan> SharedFramebufferVMObject::physical_pages() const { SpinlockLocker locker(m_writes_state_lock); if (m_writes_are_faked) return VMObject::physical_pages(); return m_real_framebuffer_vmobject->physical_pages(); } -Span> SharedFramebufferVMObject::physical_pages() +Span> SharedFramebufferVMObject::physical_pages() { SpinlockLocker locker(m_writes_state_lock); if (m_writes_are_faked) @@ -107,7 +107,7 @@ Span> SharedFramebufferVMObject::physical_pages() return m_real_framebuffer_vmobject->physical_pages(); } -SharedFramebufferVMObject::SharedFramebufferVMObject(FixedArray>&& new_physical_pages, CommittedPhysicalPageSet committed_pages, AnonymousVMObject& real_framebuffer_vmobject) +SharedFramebufferVMObject::SharedFramebufferVMObject(FixedArray>&& new_physical_pages, CommittedPhysicalPageSet committed_pages, AnonymousVMObject& real_framebuffer_vmobject) : VMObject(move(new_physical_pages)) , m_real_framebuffer_vmobject(real_framebuffer_vmobject) , m_committed_pages(move(committed_pages)) diff --git a/Kernel/Memory/SharedFramebufferVMObject.h b/Kernel/Memory/SharedFramebufferVMObject.h index e860a2ff690..8f8b05b6c84 100644 --- a/Kernel/Memory/SharedFramebufferVMObject.h +++ b/Kernel/Memory/SharedFramebufferVMObject.h @@ -22,15 +22,15 @@ public: static ErrorOr> try_create(Badge, SharedFramebufferVMObject const& parent_object); private: - FakeWritesFramebufferVMObject(SharedFramebufferVMObject const& parent_object, FixedArray>&& new_physical_pages) + FakeWritesFramebufferVMObject(SharedFramebufferVMObject const& parent_object, FixedArray>&& new_physical_pages) : VMObject(move(new_physical_pages)) , m_parent_object(parent_object) { } virtual StringView class_name() const override { return "FakeWritesFramebufferVMObject"sv; } virtual ErrorOr> try_clone() override { return Error::from_errno(ENOTIMPL); } - virtual ReadonlySpan> physical_pages() const override { return m_parent_object->fake_sink_framebuffer_physical_pages(); } - virtual Span> physical_pages() override { return m_parent_object->fake_sink_framebuffer_physical_pages(); } + virtual ReadonlySpan> physical_pages() const override { return m_parent_object->fake_sink_framebuffer_physical_pages(); } + virtual Span> physical_pages() override { return m_parent_object->fake_sink_framebuffer_physical_pages(); } NonnullLockRefPtr m_parent_object; }; @@ -39,15 +39,15 @@ public: static ErrorOr> try_create(Badge, SharedFramebufferVMObject const& parent_object); private: - RealWritesFramebufferVMObject(SharedFramebufferVMObject const& parent_object, FixedArray>&& new_physical_pages) + RealWritesFramebufferVMObject(SharedFramebufferVMObject const& parent_object, FixedArray>&& new_physical_pages) : VMObject(move(new_physical_pages)) , m_parent_object(parent_object) { } virtual StringView class_name() const override { return "RealWritesFramebufferVMObject"sv; } virtual ErrorOr> try_clone() override { return Error::from_errno(ENOTIMPL); } - virtual ReadonlySpan> physical_pages() const override { return m_parent_object->real_framebuffer_physical_pages(); } - virtual Span> physical_pages() override { return m_parent_object->real_framebuffer_physical_pages(); } + virtual ReadonlySpan> physical_pages() const override { return m_parent_object->real_framebuffer_physical_pages(); } + virtual Span> physical_pages() override { return m_parent_object->real_framebuffer_physical_pages(); } NonnullLockRefPtr m_parent_object; }; @@ -60,14 +60,14 @@ public: void switch_to_fake_sink_framebuffer_writes(Badge); void switch_to_real_framebuffer_writes(Badge); - virtual ReadonlySpan> physical_pages() const override; - virtual Span> physical_pages() override; + virtual ReadonlySpan> physical_pages() const override; + virtual Span> physical_pages() override; - Span> fake_sink_framebuffer_physical_pages(); - ReadonlySpan> fake_sink_framebuffer_physical_pages() const; + Span> fake_sink_framebuffer_physical_pages(); + ReadonlySpan> fake_sink_framebuffer_physical_pages() const; - Span> real_framebuffer_physical_pages(); - ReadonlySpan> real_framebuffer_physical_pages() const; + Span> real_framebuffer_physical_pages(); + ReadonlySpan> real_framebuffer_physical_pages() const; FakeWritesFramebufferVMObject const& fake_writes_framebuffer_vmobject() const { return *m_fake_writes_framebuffer_vmobject; } FakeWritesFramebufferVMObject& fake_writes_framebuffer_vmobject() { return *m_fake_writes_framebuffer_vmobject; } @@ -76,7 +76,7 @@ public: RealWritesFramebufferVMObject& real_writes_framebuffer_vmobject() { return *m_real_writes_framebuffer_vmobject; } private: - SharedFramebufferVMObject(FixedArray>&& new_physical_pages, CommittedPhysicalPageSet, AnonymousVMObject& real_framebuffer_vmobject); + SharedFramebufferVMObject(FixedArray>&& new_physical_pages, CommittedPhysicalPageSet, AnonymousVMObject& real_framebuffer_vmobject); virtual StringView class_name() const override { return "SharedFramebufferVMObject"sv; } diff --git a/Kernel/Memory/SharedInodeVMObject.cpp b/Kernel/Memory/SharedInodeVMObject.cpp index 233af5979f4..7433943dec9 100644 --- a/Kernel/Memory/SharedInodeVMObject.cpp +++ b/Kernel/Memory/SharedInodeVMObject.cpp @@ -39,12 +39,12 @@ ErrorOr> SharedInodeVMObject::try_clone() return adopt_nonnull_lock_ref_or_enomem(new (nothrow) SharedInodeVMObject(*this, move(new_physical_pages), move(dirty_pages))); } -SharedInodeVMObject::SharedInodeVMObject(Inode& inode, FixedArray>&& new_physical_pages, Bitmap dirty_pages) +SharedInodeVMObject::SharedInodeVMObject(Inode& inode, FixedArray>&& new_physical_pages, Bitmap dirty_pages) : InodeVMObject(inode, move(new_physical_pages), move(dirty_pages)) { } -SharedInodeVMObject::SharedInodeVMObject(SharedInodeVMObject const& other, FixedArray>&& new_physical_pages, Bitmap dirty_pages) +SharedInodeVMObject::SharedInodeVMObject(SharedInodeVMObject const& other, FixedArray>&& new_physical_pages, Bitmap dirty_pages) : InodeVMObject(other, move(new_physical_pages), move(dirty_pages)) { } diff --git a/Kernel/Memory/SharedInodeVMObject.h b/Kernel/Memory/SharedInodeVMObject.h index d1f859864e6..fb1837dd3ab 100644 --- a/Kernel/Memory/SharedInodeVMObject.h +++ b/Kernel/Memory/SharedInodeVMObject.h @@ -24,8 +24,8 @@ public: private: virtual bool is_shared_inode() const override { return true; } - explicit SharedInodeVMObject(Inode&, FixedArray>&&, Bitmap dirty_pages); - explicit SharedInodeVMObject(SharedInodeVMObject const&, FixedArray>&&, Bitmap dirty_pages); + explicit SharedInodeVMObject(Inode&, FixedArray>&&, Bitmap dirty_pages); + explicit SharedInodeVMObject(SharedInodeVMObject const&, FixedArray>&&, Bitmap dirty_pages); virtual StringView class_name() const override { return "SharedInodeVMObject"sv; } diff --git a/Kernel/Memory/VMObject.cpp b/Kernel/Memory/VMObject.cpp index 2f8daf8d4b5..0ec93823058 100644 --- a/Kernel/Memory/VMObject.cpp +++ b/Kernel/Memory/VMObject.cpp @@ -17,17 +17,17 @@ SpinlockProtected& VMObject::all_ins return s_all_instances; } -ErrorOr>> VMObject::try_clone_physical_pages() const +ErrorOr>> VMObject::try_clone_physical_pages() const { return m_physical_pages.clone(); } -ErrorOr>> VMObject::try_create_physical_pages(size_t size) +ErrorOr>> VMObject::try_create_physical_pages(size_t size) { - return FixedArray>::create(ceil_div(size, static_cast(PAGE_SIZE))); + return FixedArray>::create(ceil_div(size, static_cast(PAGE_SIZE))); } -VMObject::VMObject(FixedArray>&& new_physical_pages) +VMObject::VMObject(FixedArray>&& new_physical_pages) : m_physical_pages(move(new_physical_pages)) { all_instances().with([&](auto& list) { list.append(*this); }); diff --git a/Kernel/Memory/VMObject.h b/Kernel/Memory/VMObject.h index 8f5984d944f..5e7023db9b1 100644 --- a/Kernel/Memory/VMObject.h +++ b/Kernel/Memory/VMObject.h @@ -35,8 +35,8 @@ public: size_t page_count() const { return m_physical_pages.size(); } - virtual ReadonlySpan> physical_pages() const { return m_physical_pages.span(); } - virtual Span> physical_pages() { return m_physical_pages.span(); } + virtual ReadonlySpan> physical_pages() const { return m_physical_pages.span(); } + virtual Span> physical_pages() { return m_physical_pages.span(); } size_t size() const { return m_physical_pages.size() * PAGE_SIZE; } @@ -55,15 +55,15 @@ public: } protected: - static ErrorOr>> try_create_physical_pages(size_t); - ErrorOr>> try_clone_physical_pages() const; - explicit VMObject(FixedArray>&&); + static ErrorOr>> try_create_physical_pages(size_t); + ErrorOr>> try_clone_physical_pages() const; + explicit VMObject(FixedArray>&&); template void for_each_region(Callback); IntrusiveListNode m_list_node; - FixedArray> m_physical_pages; + FixedArray> m_physical_pages; mutable RecursiveSpinlock m_lock {};