mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:07:34 +00: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
12 changed files with 5 additions and 66 deletions
|
@ -115,8 +115,6 @@ public:
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t get_lazy_committed_page_count() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit AnonymousVMObject(size_t, AllocationStrategy);
|
explicit AnonymousVMObject(size_t, AllocationStrategy);
|
||||||
explicit AnonymousVMObject(PhysicalAddress, size_t);
|
explicit AnonymousVMObject(PhysicalAddress, size_t);
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Debug.h>
|
|
||||||
#include <Kernel/VM/ContiguousVMObject.h>
|
#include <Kernel/VM/ContiguousVMObject.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <Kernel/VM/PhysicalPage.h>
|
#include <Kernel/VM/PhysicalPage.h>
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <Kernel/FileSystem/Inode.h>
|
#include <Kernel/FileSystem/Inode.h>
|
||||||
#include <Kernel/VM/InodeVMObject.h>
|
#include <Kernel/VM/InodeVMObject.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <Kernel/VM/Region.h>
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
|
|
@ -420,14 +420,6 @@ Region* MemoryManager::find_region_from_vaddr(Space& space, VirtualAddress vaddr
|
||||||
return kernel_region_from_vaddr(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)
|
Region* MemoryManager::find_region_from_vaddr(VirtualAddress vaddr)
|
||||||
{
|
{
|
||||||
ScopedSpinLock lock(s_mm_lock);
|
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_UP(x) ((((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
|
||||||
#define PAGE_ROUND_DOWN(x) (((FlatPtr)(x)) & ~(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)
|
inline u32 low_physical_to_virtual(u32 physical)
|
||||||
{
|
{
|
||||||
return physical + 0xc0000000;
|
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)
|
inline u32 virtual_to_low_physical(u32 physical)
|
||||||
{
|
{
|
||||||
return physical - 0xc0000000;
|
return physical - 0xc0000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
class KBuffer;
|
|
||||||
class SynthFSInode;
|
|
||||||
|
|
||||||
enum class UsedMemoryRangeType {
|
enum class UsedMemoryRangeType {
|
||||||
LowMemory = 0,
|
LowMemory = 0,
|
||||||
Kernel,
|
Kernel,
|
||||||
|
@ -80,14 +65,14 @@ constexpr static const char* UserMemoryRangeTypeNames[] {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UsedMemoryRange {
|
struct UsedMemoryRange {
|
||||||
UsedMemoryRangeType type;
|
UsedMemoryRangeType type {};
|
||||||
PhysicalAddress start;
|
PhysicalAddress start;
|
||||||
PhysicalAddress end;
|
PhysicalAddress end;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ContiguousReservedMemoryRange {
|
struct ContiguousReservedMemoryRange {
|
||||||
PhysicalAddress start;
|
PhysicalAddress start;
|
||||||
size_t length;
|
size_t length {};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PhysicalMemoryRangeType {
|
enum class PhysicalMemoryRangeType {
|
||||||
|
@ -96,13 +81,13 @@ enum class PhysicalMemoryRangeType {
|
||||||
ACPI_Reclaimable,
|
ACPI_Reclaimable,
|
||||||
ACPI_NVS,
|
ACPI_NVS,
|
||||||
BadMemory,
|
BadMemory,
|
||||||
Unknown
|
Unknown,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PhysicalMemoryRange {
|
struct PhysicalMemoryRange {
|
||||||
PhysicalMemoryRangeType type;
|
PhysicalMemoryRangeType type { PhysicalMemoryRangeType::Unknown };
|
||||||
PhysicalAddress start;
|
PhysicalAddress start;
|
||||||
size_t length;
|
size_t length {};
|
||||||
};
|
};
|
||||||
|
|
||||||
const LogStream& operator<<(const LogStream& stream, const UsedMemoryRange& value);
|
const LogStream& operator<<(const LogStream& stream, const UsedMemoryRange& value);
|
||||||
|
@ -127,13 +112,11 @@ class MemoryManager {
|
||||||
friend class AnonymousVMObject;
|
friend class AnonymousVMObject;
|
||||||
friend class Region;
|
friend class Region;
|
||||||
friend class VMObject;
|
friend class VMObject;
|
||||||
friend OwnPtr<KBuffer> procfs$memstat(InodeIdentifier);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static MemoryManager& the();
|
static MemoryManager& the();
|
||||||
static bool is_initialized();
|
static bool is_initialized();
|
||||||
|
|
||||||
static void early_initialize();
|
|
||||||
static void initialize(u32 cpu);
|
static void initialize(u32 cpu);
|
||||||
|
|
||||||
static inline MemoryManagerData& get_data()
|
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 Region* find_region_from_vaddr(Space&, VirtualAddress);
|
||||||
static const Region* find_region_from_vaddr(const Space&, VirtualAddress);
|
|
||||||
|
|
||||||
void dump_kernel_regions();
|
void dump_kernel_regions();
|
||||||
|
|
||||||
|
@ -243,7 +214,6 @@ private:
|
||||||
void release_pte(PageDirectory&, VirtualAddress, bool);
|
void release_pte(PageDirectory&, VirtualAddress, bool);
|
||||||
|
|
||||||
RefPtr<PageDirectory> m_kernel_page_directory;
|
RefPtr<PageDirectory> m_kernel_page_directory;
|
||||||
RefPtr<PhysicalPage> m_low_page_table;
|
|
||||||
|
|
||||||
RefPtr<PhysicalPage> m_shared_zero_page;
|
RefPtr<PhysicalPage> m_shared_zero_page;
|
||||||
RefPtr<PhysicalPage> m_lazy_committed_page;
|
RefPtr<PhysicalPage> m_lazy_committed_page;
|
||||||
|
@ -265,8 +235,6 @@ private:
|
||||||
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
|
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
|
||||||
|
|
||||||
InlineLinkedList<VMObject> m_vmobjects;
|
InlineLinkedList<VMObject> m_vmobjects;
|
||||||
|
|
||||||
RefPtr<PhysicalPage> m_low_pseudo_identity_mapping_pages[4];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <AK/Singleton.h>
|
#include <AK/Singleton.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/Random.h>
|
#include <Kernel/Random.h>
|
||||||
#include <Kernel/Thread.h>
|
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <Kernel/VM/PageDirectory.h>
|
#include <Kernel/VM/PageDirectory.h>
|
||||||
|
|
||||||
|
@ -36,7 +35,6 @@ namespace Kernel {
|
||||||
|
|
||||||
static const FlatPtr userspace_range_base = 0x00800000;
|
static const FlatPtr userspace_range_base = 0x00800000;
|
||||||
static const FlatPtr userspace_range_ceiling = 0xbe000000;
|
static const FlatPtr userspace_range_ceiling = 0xbe000000;
|
||||||
static const FlatPtr kernelspace_range_base = 0xc0800000;
|
|
||||||
|
|
||||||
static AK::Singleton<HashMap<u32, PageDirectory*>> s_cr3_map;
|
static AK::Singleton<HashMap<u32, PageDirectory*>> s_cr3_map;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/BinarySearch.h>
|
#include <AK/BinarySearch.h>
|
||||||
#include <AK/ScopeGuard.h>
|
|
||||||
#include <Kernel/Debug.h>
|
#include <Kernel/Debug.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/VM/AnonymousVMObject.h>
|
#include <Kernel/VM/AnonymousVMObject.h>
|
||||||
|
|
|
@ -220,7 +220,6 @@ public:
|
||||||
ScopedSpinLock lock(m_volatile_ranges_lock);
|
ScopedSpinLock lock(m_volatile_ranges_lock);
|
||||||
ScopedSpinLock other_lock(other.m_volatile_ranges_lock);
|
ScopedSpinLock other_lock(other.m_volatile_ranges_lock);
|
||||||
m_volatile_ranges = other.m_volatile_ranges;
|
m_volatile_ranges = other.m_volatile_ranges;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool add_volatile_range(const VolatilePageRange& range);
|
bool add_volatile_range(const VolatilePageRange& range);
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <AK/BinarySearch.h>
|
#include <AK/BinarySearch.h>
|
||||||
#include <AK/Checked.h>
|
#include <AK/Checked.h>
|
||||||
#include <AK/QuickSort.h>
|
#include <AK/QuickSort.h>
|
||||||
#include <Kernel/Debug.h>
|
|
||||||
#include <Kernel/Random.h>
|
#include <Kernel/Random.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/VM/RangeAllocator.h>
|
#include <Kernel/VM/RangeAllocator.h>
|
||||||
|
|
|
@ -96,10 +96,7 @@ public:
|
||||||
void set_mmap(bool mmap) { m_mmap = mmap; }
|
void set_mmap(bool mmap) { m_mmap = mmap; }
|
||||||
|
|
||||||
bool is_user_accessible() const { return m_user_accessible; }
|
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; }
|
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>&);
|
PageFaultResponse handle_fault(const PageFault&, ScopedSpinLock<RecursiveSpinLock>&);
|
||||||
|
|
||||||
|
@ -173,11 +170,6 @@ public:
|
||||||
return m_offset_in_vmobject / PAGE_SIZE;
|
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
|
size_t page_count() const
|
||||||
{
|
{
|
||||||
return size() / PAGE_SIZE;
|
return size() / PAGE_SIZE;
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Kernel/FileSystem/Inode.h>
|
#include <Kernel/FileSystem/Inode.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
|
||||||
#include <Kernel/VM/Region.h>
|
|
||||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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/MemoryManager.h>
|
||||||
#include <Kernel/VM/VMObject.h>
|
#include <Kernel/VM/VMObject.h>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue