diff --git a/Kernel/VM/AnonymousVMObject.h b/Kernel/VM/AnonymousVMObject.h index 1c647511e9..0e0cd98311 100644 --- a/Kernel/VM/AnonymousVMObject.h +++ b/Kernel/VM/AnonymousVMObject.h @@ -115,8 +115,6 @@ public: return IterationDecision::Continue; } - size_t get_lazy_committed_page_count() const; - private: explicit AnonymousVMObject(size_t, AllocationStrategy); explicit AnonymousVMObject(PhysicalAddress, size_t); diff --git a/Kernel/VM/ContiguousVMObject.cpp b/Kernel/VM/ContiguousVMObject.cpp index 48b3a5cda9..c382942fb9 100644 --- a/Kernel/VM/ContiguousVMObject.cpp +++ b/Kernel/VM/ContiguousVMObject.cpp @@ -24,7 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp index fc48ee365e..7676fcad08 100644 --- a/Kernel/VM/InodeVMObject.cpp +++ b/Kernel/VM/InodeVMObject.cpp @@ -27,7 +27,6 @@ #include #include #include -#include namespace Kernel { diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 60c299b170..049727d55a 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -420,14 +420,6 @@ Region* MemoryManager::find_region_from_vaddr(Space& space, VirtualAddress vaddr return kernel_region_from_vaddr(vaddr); } -const Region* MemoryManager::find_region_from_vaddr(const Space& space, VirtualAddress vaddr) -{ - ScopedSpinLock lock(s_mm_lock); - if (auto* region = user_region_from_vaddr(const_cast(space), vaddr)) - return region; - return kernel_region_from_vaddr(vaddr); -} - Region* MemoryManager::find_region_from_vaddr(VirtualAddress vaddr) { ScopedSpinLock lock(s_mm_lock); diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h index ceee66796e..c33cb7487e 100644 --- a/Kernel/VM/MemoryManager.h +++ b/Kernel/VM/MemoryManager.h @@ -42,31 +42,16 @@ namespace Kernel { #define PAGE_ROUND_UP(x) ((((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1))) #define PAGE_ROUND_DOWN(x) (((FlatPtr)(x)) & ~(PAGE_SIZE - 1)) -template -inline T* low_physical_to_virtual(T* physical) -{ - return (T*)(((u8*)physical) + 0xc0000000); -} - inline u32 low_physical_to_virtual(u32 physical) { return physical + 0xc0000000; } -template -inline T* virtual_to_low_physical(T* physical) -{ - return (T*)(((u8*)physical) - 0xc0000000); -} - inline u32 virtual_to_low_physical(u32 physical) { return physical - 0xc0000000; } -class KBuffer; -class SynthFSInode; - enum class UsedMemoryRangeType { LowMemory = 0, Kernel, @@ -80,14 +65,14 @@ constexpr static const char* UserMemoryRangeTypeNames[] { }; struct UsedMemoryRange { - UsedMemoryRangeType type; + UsedMemoryRangeType type {}; PhysicalAddress start; PhysicalAddress end; }; struct ContiguousReservedMemoryRange { PhysicalAddress start; - size_t length; + size_t length {}; }; enum class PhysicalMemoryRangeType { @@ -96,13 +81,13 @@ enum class PhysicalMemoryRangeType { ACPI_Reclaimable, ACPI_NVS, BadMemory, - Unknown + Unknown, }; struct PhysicalMemoryRange { - PhysicalMemoryRangeType type; + PhysicalMemoryRangeType type { PhysicalMemoryRangeType::Unknown }; PhysicalAddress start; - size_t length; + size_t length {}; }; const LogStream& operator<<(const LogStream& stream, const UsedMemoryRange& value); @@ -127,13 +112,11 @@ class MemoryManager { friend class AnonymousVMObject; friend class Region; friend class VMObject; - friend OwnPtr procfs$memstat(InodeIdentifier); public: static MemoryManager& the(); static bool is_initialized(); - static void early_initialize(); static void initialize(u32 cpu); static inline MemoryManagerData& get_data() @@ -186,19 +169,7 @@ public: } } - template - static void for_each_vmobject_of_type(Callback callback) - { - for (auto& vmobject : MM.m_vmobjects) { - if (!is(vmobject)) - continue; - if (callback(static_cast(vmobject)) == IterationDecision::Break) - break; - } - } - static Region* find_region_from_vaddr(Space&, VirtualAddress); - static const Region* find_region_from_vaddr(const Space&, VirtualAddress); void dump_kernel_regions(); @@ -243,7 +214,6 @@ private: void release_pte(PageDirectory&, VirtualAddress, bool); RefPtr m_kernel_page_directory; - RefPtr m_low_page_table; RefPtr m_shared_zero_page; RefPtr m_lazy_committed_page; @@ -265,8 +235,6 @@ private: Vector m_reserved_memory_ranges; InlineLinkedList m_vmobjects; - - RefPtr m_low_pseudo_identity_mapping_pages[4]; }; template diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp index 3f38942353..19f4a6836d 100644 --- a/Kernel/VM/PageDirectory.cpp +++ b/Kernel/VM/PageDirectory.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -36,7 +35,6 @@ namespace Kernel { static const FlatPtr userspace_range_base = 0x00800000; static const FlatPtr userspace_range_ceiling = 0xbe000000; -static const FlatPtr kernelspace_range_base = 0xc0800000; static AK::Singleton> s_cr3_map; diff --git a/Kernel/VM/PurgeablePageRanges.cpp b/Kernel/VM/PurgeablePageRanges.cpp index 0782daef5b..09927d7ec4 100644 --- a/Kernel/VM/PurgeablePageRanges.cpp +++ b/Kernel/VM/PurgeablePageRanges.cpp @@ -25,7 +25,6 @@ */ #include -#include #include #include #include diff --git a/Kernel/VM/PurgeablePageRanges.h b/Kernel/VM/PurgeablePageRanges.h index 3a0a9725c4..f372c5bed5 100644 --- a/Kernel/VM/PurgeablePageRanges.h +++ b/Kernel/VM/PurgeablePageRanges.h @@ -220,7 +220,6 @@ public: ScopedSpinLock lock(m_volatile_ranges_lock); ScopedSpinLock other_lock(other.m_volatile_ranges_lock); m_volatile_ranges = other.m_volatile_ranges; - return; } bool add_volatile_range(const VolatilePageRange& range); diff --git a/Kernel/VM/RangeAllocator.cpp b/Kernel/VM/RangeAllocator.cpp index 3df97c6f1b..f00a9cacbc 100644 --- a/Kernel/VM/RangeAllocator.cpp +++ b/Kernel/VM/RangeAllocator.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 8627fdab0f..ab04e6b491 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -96,10 +96,7 @@ public: void set_mmap(bool mmap) { m_mmap = mmap; } bool is_user_accessible() const { return m_user_accessible; } - void set_user_accessible(bool b) { m_user_accessible = b; } - bool is_kernel() const { return m_kernel || vaddr().get() >= 0xc0000000; } - void set_kernel(bool kernel) { m_kernel = kernel; } PageFaultResponse handle_fault(const PageFault&, ScopedSpinLock&); @@ -173,11 +170,6 @@ public: return m_offset_in_vmobject / PAGE_SIZE; } - size_t last_page_index() const - { - return (first_page_index() + page_count()) - 1; - } - size_t page_count() const { return size() / PAGE_SIZE; diff --git a/Kernel/VM/SharedInodeVMObject.cpp b/Kernel/VM/SharedInodeVMObject.cpp index 33b0316f59..c928fff9a4 100644 --- a/Kernel/VM/SharedInodeVMObject.cpp +++ b/Kernel/VM/SharedInodeVMObject.cpp @@ -25,8 +25,6 @@ */ #include -#include -#include #include namespace Kernel { diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp index 16a763bab9..bcd5fbf73f 100644 --- a/Kernel/VM/VMObject.cpp +++ b/Kernel/VM/VMObject.cpp @@ -24,8 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include #include #include