mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 04:15:23 +03:00
Kernel: Remove a handful of unused things in VM/ directory
Also add some missing initializers.
This commit is contained in:
parent
ba42d741cb
commit
0dbb22e9e0
Notes:
sideshowbarker
2024-07-18 22:25:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0dbb22e9e03
@ -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);
|
||||
|
@ -24,7 +24,6 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/VM/ContiguousVMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/VM/InodeVMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/Region.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -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&>(space), vaddr))
|
||||
return region;
|
||||
return kernel_region_from_vaddr(vaddr);
|
||||
}
|
||||
|
||||
Region* MemoryManager::find_region_from_vaddr(VirtualAddress vaddr)
|
||||
{
|
||||
ScopedSpinLock lock(s_mm_lock);
|
||||
|
@ -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<typename T>
|
||||
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<typename T>
|
||||
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<KBuffer> 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<typename T, typename Callback>
|
||||
static void for_each_vmobject_of_type(Callback callback)
|
||||
{
|
||||
for (auto& vmobject : MM.m_vmobjects) {
|
||||
if (!is<T>(vmobject))
|
||||
continue;
|
||||
if (callback(static_cast<T&>(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<PageDirectory> m_kernel_page_directory;
|
||||
RefPtr<PhysicalPage> m_low_page_table;
|
||||
|
||||
RefPtr<PhysicalPage> m_shared_zero_page;
|
||||
RefPtr<PhysicalPage> m_lazy_committed_page;
|
||||
@ -265,8 +235,6 @@ private:
|
||||
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
|
||||
|
||||
InlineLinkedList<VMObject> m_vmobjects;
|
||||
|
||||
RefPtr<PhysicalPage> m_low_pseudo_identity_mapping_pages[4];
|
||||
};
|
||||
|
||||
template<typename Callback>
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <AK/Singleton.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/PageDirectory.h>
|
||||
|
||||
@ -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<HashMap<u32, PageDirectory*>> s_cr3_map;
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <AK/BinarySearch.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/VM/AnonymousVMObject.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);
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <AK/BinarySearch.h>
|
||||
#include <AK/Checked.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/RangeAllocator.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<RecursiveSpinLock>&);
|
||||
|
||||
@ -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;
|
||||
|
@ -25,8 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -24,8 +24,6 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user