2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2018-10-17 18:13:55 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2021-05-16 06:36:52 -03:00
|
|
|
#include <AK/Concepts.h>
|
2019-05-28 06:53:16 -03:00
|
|
|
#include <AK/HashTable.h>
|
2021-07-12 17:52:17 -03:00
|
|
|
#include <AK/NonnullOwnPtrVector.h>
|
2019-06-27 08:34:28 -03:00
|
|
|
#include <AK/NonnullRefPtrVector.h>
|
2019-11-29 12:15:30 -03:00
|
|
|
#include <AK/String.h>
|
2021-06-21 12:34:09 -03:00
|
|
|
#include <Kernel/Arch/x86/PageFault.h>
|
2021-07-11 06:49:16 -03:00
|
|
|
#include <Kernel/Arch/x86/TrapFrame.h>
|
2020-02-15 21:50:16 -03:00
|
|
|
#include <Kernel/Forward.h>
|
2021-08-21 20:37:17 -03:00
|
|
|
#include <Kernel/Locking/Spinlock.h>
|
2021-08-06 05:45:34 -03:00
|
|
|
#include <Kernel/Memory/AllocationStrategy.h>
|
|
|
|
|
#include <Kernel/Memory/PhysicalPage.h>
|
|
|
|
|
#include <Kernel/Memory/PhysicalRegion.h>
|
|
|
|
|
#include <Kernel/Memory/Region.h>
|
|
|
|
|
#include <Kernel/Memory/VMObject.h>
|
2018-10-18 08:05:00 -03:00
|
|
|
|
2021-08-06 08:49:36 -03:00
|
|
|
namespace Kernel::Memory {
|
2020-02-15 21:27:42 -03:00
|
|
|
|
2021-02-14 05:57:19 -03:00
|
|
|
constexpr bool page_round_up_would_wrap(FlatPtr x)
|
|
|
|
|
{
|
2021-06-28 13:58:23 -03:00
|
|
|
return x > (explode_byte(0xFF) & ~0xFFF);
|
2021-02-14 05:57:19 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constexpr FlatPtr page_round_up(FlatPtr x)
|
|
|
|
|
{
|
|
|
|
|
FlatPtr rounded = (((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1));
|
2021-06-28 13:58:23 -03:00
|
|
|
// Rounding up >0xfffff000 wraps back to 0. That's never what we want.
|
2021-02-23 16:42:32 -03:00
|
|
|
VERIFY(x == 0 || rounded != 0);
|
2021-02-14 05:57:19 -03:00
|
|
|
return rounded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constexpr FlatPtr page_round_down(FlatPtr x)
|
|
|
|
|
{
|
|
|
|
|
return ((FlatPtr)(x)) & ~(PAGE_SIZE - 1);
|
|
|
|
|
}
|
2019-01-12 21:27:25 -02:00
|
|
|
|
2021-06-17 08:05:37 -03:00
|
|
|
inline FlatPtr virtual_to_low_physical(FlatPtr virtual_)
|
2020-01-17 15:59:20 -03:00
|
|
|
{
|
2021-07-22 08:05:04 -03:00
|
|
|
return virtual_ - physical_to_virtual_offset;
|
2020-01-17 15:59:20 -03:00
|
|
|
}
|
|
|
|
|
|
2021-08-06 18:42:53 -03:00
|
|
|
enum class UsedMemoryRangeType {
|
2021-01-19 15:13:03 -03:00
|
|
|
LowMemory = 0,
|
2021-07-18 14:39:33 -03:00
|
|
|
Prekernel,
|
2021-01-19 15:13:03 -03:00
|
|
|
Kernel,
|
|
|
|
|
BootModule,
|
2021-07-07 22:50:05 -03:00
|
|
|
PhysicalPages,
|
2021-01-19 15:13:03 -03:00
|
|
|
};
|
|
|
|
|
|
2021-08-06 18:42:53 -03:00
|
|
|
static constexpr StringView UserMemoryRangeTypeNames[] {
|
2021-01-19 15:13:03 -03:00
|
|
|
"Low memory",
|
2021-07-18 14:39:33 -03:00
|
|
|
"Prekernel",
|
2021-01-19 15:13:03 -03:00
|
|
|
"Kernel",
|
|
|
|
|
"Boot module",
|
2021-07-07 22:50:05 -03:00
|
|
|
"Physical Pages"
|
2021-01-19 15:13:03 -03:00
|
|
|
};
|
|
|
|
|
|
2021-08-06 18:42:53 -03:00
|
|
|
struct UsedMemoryRange {
|
|
|
|
|
UsedMemoryRangeType type {};
|
2021-01-19 15:13:03 -03:00
|
|
|
PhysicalAddress start;
|
|
|
|
|
PhysicalAddress end;
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-06 18:42:53 -03:00
|
|
|
struct ContiguousReservedMemoryRange {
|
2021-01-29 09:03:25 -03:00
|
|
|
PhysicalAddress start;
|
2021-07-07 00:35:15 -03:00
|
|
|
PhysicalSize length {};
|
2021-01-29 09:03:25 -03:00
|
|
|
};
|
|
|
|
|
|
2021-08-06 18:42:53 -03:00
|
|
|
enum class PhysicalMemoryRangeType {
|
2021-01-29 09:03:25 -03:00
|
|
|
Usable = 0,
|
|
|
|
|
Reserved,
|
|
|
|
|
ACPI_Reclaimable,
|
|
|
|
|
ACPI_NVS,
|
|
|
|
|
BadMemory,
|
2021-02-11 18:02:39 -03:00
|
|
|
Unknown,
|
2021-01-29 09:03:25 -03:00
|
|
|
};
|
|
|
|
|
|
2021-08-06 18:42:53 -03:00
|
|
|
struct PhysicalMemoryRange {
|
|
|
|
|
PhysicalMemoryRangeType type { PhysicalMemoryRangeType::Unknown };
|
2021-01-29 09:03:25 -03:00
|
|
|
PhysicalAddress start;
|
2021-07-07 00:35:15 -03:00
|
|
|
PhysicalSize length {};
|
2021-01-29 09:03:25 -03:00
|
|
|
};
|
|
|
|
|
|
2021-08-06 08:49:36 -03:00
|
|
|
#define MM Kernel::Memory::MemoryManager::the()
|
2018-10-27 09:56:52 -03:00
|
|
|
|
2020-06-28 19:04:35 -03:00
|
|
|
struct MemoryManagerData {
|
2021-07-27 09:30:26 -03:00
|
|
|
static ProcessorSpecificDataID processor_specific_data_id() { return ProcessorSpecificDataID::MemoryManager; }
|
|
|
|
|
|
2021-09-05 14:02:03 -03:00
|
|
|
Spinlock m_quickmap_in_use;
|
2020-07-03 08:19:50 -03:00
|
|
|
u32 m_quickmap_prev_flags;
|
2020-10-31 20:19:50 -03:00
|
|
|
|
|
|
|
|
PhysicalAddress m_last_quickmap_pd;
|
|
|
|
|
PhysicalAddress m_last_quickmap_pt;
|
2020-06-28 19:04:35 -03:00
|
|
|
};
|
|
|
|
|
|
2021-08-21 20:37:17 -03:00
|
|
|
extern RecursiveSpinlock s_mm_lock;
|
2020-07-06 10:27:22 -03:00
|
|
|
|
2021-08-04 17:49:13 -03:00
|
|
|
// This class represents a set of committed physical pages.
|
|
|
|
|
// When you ask MemoryManager to commit pages for you, you get one of these in return.
|
|
|
|
|
// You can allocate pages from it via `take_one()`
|
|
|
|
|
// It will uncommit any (unallocated) remaining pages when destroyed.
|
|
|
|
|
class CommittedPhysicalPageSet {
|
|
|
|
|
AK_MAKE_NONCOPYABLE(CommittedPhysicalPageSet);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
CommittedPhysicalPageSet(Badge<MemoryManager>, size_t page_count)
|
|
|
|
|
: m_page_count(page_count)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommittedPhysicalPageSet(CommittedPhysicalPageSet&& other)
|
|
|
|
|
: m_page_count(exchange(other.m_page_count, 0))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~CommittedPhysicalPageSet();
|
|
|
|
|
|
|
|
|
|
bool is_empty() const { return m_page_count == 0; }
|
|
|
|
|
size_t page_count() const { return m_page_count; }
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] NonnullRefPtr<PhysicalPage> take_one();
|
2021-08-05 12:14:13 -03:00
|
|
|
void uncommit_one();
|
2021-08-04 17:49:13 -03:00
|
|
|
|
|
|
|
|
void operator=(CommittedPhysicalPageSet&&) = delete;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
size_t m_page_count { 0 };
|
|
|
|
|
};
|
|
|
|
|
|
2018-10-17 18:13:55 -03:00
|
|
|
class MemoryManager {
|
2018-10-31 19:19:15 -03:00
|
|
|
AK_MAKE_ETERNAL
|
2021-07-13 18:21:22 -03:00
|
|
|
friend class PageDirectory;
|
2020-09-05 18:52:14 -03:00
|
|
|
friend class AnonymousVMObject;
|
2018-11-08 11:35:30 -02:00
|
|
|
friend class Region;
|
2018-11-08 18:20:09 -02:00
|
|
|
friend class VMObject;
|
2019-05-28 06:53:16 -03:00
|
|
|
|
2018-10-17 18:13:55 -03:00
|
|
|
public:
|
2019-07-16 08:44:41 -03:00
|
|
|
static MemoryManager& the();
|
2020-08-29 19:41:30 -03:00
|
|
|
static bool is_initialized();
|
2018-10-17 18:13:55 -03:00
|
|
|
|
2020-06-28 19:04:35 -03:00
|
|
|
static void initialize(u32 cpu);
|
2020-09-18 04:49:51 -03:00
|
|
|
|
2020-06-28 19:04:35 -03:00
|
|
|
static inline MemoryManagerData& get_data()
|
|
|
|
|
{
|
2021-07-27 09:30:26 -03:00
|
|
|
return ProcessorSpecific<MemoryManagerData>::get();
|
2020-06-28 19:04:35 -03:00
|
|
|
}
|
2018-10-18 08:05:00 -03:00
|
|
|
|
2021-07-14 08:31:21 -03:00
|
|
|
PageFaultResponse handle_page_fault(PageFault const&);
|
2018-10-18 08:05:00 -03:00
|
|
|
|
2021-03-11 09:03:40 -03:00
|
|
|
void set_page_writable_direct(VirtualAddress, bool);
|
|
|
|
|
|
2021-02-14 13:35:07 -03:00
|
|
|
void protect_readonly_after_init_memory();
|
2021-07-16 04:50:34 -03:00
|
|
|
void unmap_text_after_init();
|
|
|
|
|
void unmap_ksyms_after_init();
|
2021-02-14 13:35:07 -03:00
|
|
|
|
2021-09-06 12:11:33 -03:00
|
|
|
static void enter_process_address_space(Process&);
|
|
|
|
|
static void enter_address_space(AddressSpace&);
|
2018-11-01 05:01:51 -03:00
|
|
|
|
2021-08-06 08:57:39 -03:00
|
|
|
bool validate_user_stack_no_lock(AddressSpace&, VirtualAddress) const;
|
|
|
|
|
bool validate_user_stack(AddressSpace&, VirtualAddress) const;
|
2020-02-21 09:05:39 -03:00
|
|
|
|
2019-06-07 12:13:23 -03:00
|
|
|
enum class ShouldZeroFill {
|
2019-05-28 06:53:16 -03:00
|
|
|
No,
|
|
|
|
|
Yes
|
|
|
|
|
};
|
2019-01-31 00:57:06 -02:00
|
|
|
|
2021-09-05 16:54:12 -03:00
|
|
|
KResultOr<CommittedPhysicalPageSet> commit_user_physical_pages(size_t page_count);
|
2021-08-04 17:49:13 -03:00
|
|
|
void uncommit_user_physical_pages(Badge<CommittedPhysicalPageSet>, size_t page_count);
|
|
|
|
|
|
2021-08-05 14:58:09 -03:00
|
|
|
NonnullRefPtr<PhysicalPage> allocate_committed_user_physical_page(Badge<CommittedPhysicalPageSet>, ShouldZeroFill = ShouldZeroFill::Yes);
|
2020-09-01 16:40:34 -03:00
|
|
|
RefPtr<PhysicalPage> allocate_user_physical_page(ShouldZeroFill = ShouldZeroFill::Yes, bool* did_purge = nullptr);
|
2019-06-21 13:37:47 -03:00
|
|
|
RefPtr<PhysicalPage> allocate_supervisor_physical_page();
|
2021-07-13 11:10:48 -03:00
|
|
|
NonnullRefPtrVector<PhysicalPage> allocate_contiguous_supervisor_physical_pages(size_t size);
|
2021-07-11 18:12:32 -03:00
|
|
|
void deallocate_physical_page(PhysicalAddress);
|
2018-11-05 07:23:00 -02:00
|
|
|
|
2021-09-05 20:36:14 -03:00
|
|
|
KResultOr<NonnullOwnPtr<Region>> allocate_contiguous_kernel_region(size_t, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes);
|
|
|
|
|
KResultOr<NonnullOwnPtr<Region>> allocate_kernel_region(size_t, StringView name, Region::Access access, AllocationStrategy strategy = AllocationStrategy::Reserve, Region::Cacheable = Region::Cacheable::Yes);
|
|
|
|
|
KResultOr<NonnullOwnPtr<Region>> allocate_kernel_region(PhysicalAddress, size_t, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes);
|
|
|
|
|
KResultOr<NonnullOwnPtr<Region>> allocate_kernel_region_with_vmobject(VMObject&, size_t, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes);
|
|
|
|
|
KResultOr<NonnullOwnPtr<Region>> allocate_kernel_region_with_vmobject(VirtualRange const&, VMObject&, StringView name, Region::Access access, Region::Cacheable = Region::Cacheable::Yes);
|
2019-05-14 06:51:00 -03:00
|
|
|
|
2021-07-07 00:35:15 -03:00
|
|
|
struct SystemMemoryInfo {
|
|
|
|
|
PhysicalSize user_physical_pages { 0 };
|
|
|
|
|
PhysicalSize user_physical_pages_used { 0 };
|
|
|
|
|
PhysicalSize user_physical_pages_committed { 0 };
|
|
|
|
|
PhysicalSize user_physical_pages_uncommitted { 0 };
|
|
|
|
|
PhysicalSize super_physical_pages { 0 };
|
|
|
|
|
PhysicalSize super_physical_pages_used { 0 };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SystemMemoryInfo get_system_memory_info()
|
|
|
|
|
{
|
2021-08-21 20:49:22 -03:00
|
|
|
SpinlockLocker lock(s_mm_lock);
|
2021-07-07 00:35:15 -03:00
|
|
|
return m_system_memory_info;
|
|
|
|
|
}
|
2019-06-11 08:13:02 -03:00
|
|
|
|
2021-05-16 06:36:52 -03:00
|
|
|
template<IteratorFunction<VMObject&> Callback>
|
2019-08-08 05:43:44 -03:00
|
|
|
static void for_each_vmobject(Callback callback)
|
|
|
|
|
{
|
2021-08-16 17:54:25 -03:00
|
|
|
VMObject::all_instances().with([&](auto& list) {
|
|
|
|
|
for (auto& vmobject : list) {
|
|
|
|
|
if (callback(vmobject) == IterationDecision::Break)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-08-08 05:43:44 -03:00
|
|
|
}
|
|
|
|
|
|
2021-05-16 06:36:52 -03:00
|
|
|
template<VoidFunction<VMObject&> Callback>
|
|
|
|
|
static void for_each_vmobject(Callback callback)
|
|
|
|
|
{
|
2021-08-16 17:54:25 -03:00
|
|
|
VMObject::all_instances().with([&](auto& list) {
|
|
|
|
|
for (auto& vmobject : list) {
|
|
|
|
|
callback(vmobject);
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-05-16 06:36:52 -03:00
|
|
|
}
|
|
|
|
|
|
2021-08-06 08:57:39 -03:00
|
|
|
static Region* find_user_region_from_vaddr(AddressSpace&, VirtualAddress);
|
|
|
|
|
static Region* find_user_region_from_vaddr_no_lock(AddressSpace&, VirtualAddress);
|
|
|
|
|
static void validate_syscall_preconditions(AddressSpace&, RegisterState const&);
|
2019-11-29 12:15:30 -03:00
|
|
|
|
2020-01-18 04:34:28 -03:00
|
|
|
void dump_kernel_regions();
|
|
|
|
|
|
2020-02-15 09:12:02 -03:00
|
|
|
PhysicalPage& shared_zero_page() { return *m_shared_zero_page; }
|
2020-09-05 00:12:25 -03:00
|
|
|
PhysicalPage& lazy_committed_page() { return *m_lazy_committed_page; }
|
2020-02-15 09:12:02 -03:00
|
|
|
|
2020-06-02 01:55:09 -03:00
|
|
|
PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; }
|
|
|
|
|
|
2021-08-06 18:42:53 -03:00
|
|
|
Vector<UsedMemoryRange> const& used_memory_ranges() { return m_used_memory_ranges; }
|
2021-08-06 08:54:48 -03:00
|
|
|
bool is_allowed_to_mmap_to_userspace(PhysicalAddress, VirtualRange const&) const;
|
2021-01-19 15:13:03 -03:00
|
|
|
|
2021-07-07 22:50:05 -03:00
|
|
|
PhysicalPageEntry& get_physical_page_entry(PhysicalAddress);
|
|
|
|
|
PhysicalAddress get_physical_address(PhysicalPage const&);
|
|
|
|
|
|
2018-10-17 18:13:55 -03:00
|
|
|
private:
|
2020-08-22 12:53:34 -03:00
|
|
|
MemoryManager();
|
2018-10-17 18:13:55 -03:00
|
|
|
~MemoryManager();
|
|
|
|
|
|
2021-07-07 22:50:05 -03:00
|
|
|
void initialize_physical_pages();
|
2021-01-29 09:03:25 -03:00
|
|
|
void register_reserved_ranges();
|
|
|
|
|
|
2018-11-08 19:24:02 -02:00
|
|
|
void register_region(Region&);
|
|
|
|
|
void unregister_region(Region&);
|
2018-11-08 18:20:09 -02:00
|
|
|
|
2020-01-17 18:07:20 -03:00
|
|
|
void protect_kernel_image();
|
2020-01-17 17:03:52 -03:00
|
|
|
void parse_memory_map();
|
2020-07-06 10:27:22 -03:00
|
|
|
static void flush_tlb_local(VirtualAddress, size_t page_count = 1);
|
2021-07-14 08:31:21 -03:00
|
|
|
static void flush_tlb(PageDirectory const*, VirtualAddress, size_t page_count = 1);
|
2018-10-17 18:13:55 -03:00
|
|
|
|
2019-08-06 05:31:20 -03:00
|
|
|
static Region* kernel_region_from_vaddr(VirtualAddress);
|
|
|
|
|
|
2020-07-30 18:52:28 -03:00
|
|
|
static Region* find_region_from_vaddr(VirtualAddress);
|
2019-08-06 06:19:16 -03:00
|
|
|
|
2020-09-05 00:12:25 -03:00
|
|
|
RefPtr<PhysicalPage> find_free_user_physical_page(bool);
|
2021-07-07 22:50:05 -03:00
|
|
|
|
|
|
|
|
ALWAYS_INLINE u8* quickmap_page(PhysicalPage& page)
|
|
|
|
|
{
|
|
|
|
|
return quickmap_page(page.paddr());
|
|
|
|
|
}
|
|
|
|
|
u8* quickmap_page(PhysicalAddress const&);
|
2018-11-05 10:48:07 -02:00
|
|
|
void unquickmap_page();
|
|
|
|
|
|
2020-01-17 15:59:20 -03:00
|
|
|
PageDirectoryEntry* quickmap_pd(PageDirectory&, size_t pdpt_index);
|
|
|
|
|
PageTableEntry* quickmap_pt(PhysicalAddress);
|
|
|
|
|
|
2020-10-31 20:19:18 -03:00
|
|
|
PageTableEntry* pte(PageDirectory&, VirtualAddress);
|
2020-09-01 19:10:54 -03:00
|
|
|
PageTableEntry* ensure_pte(PageDirectory&, VirtualAddress);
|
2020-08-28 00:29:17 -03:00
|
|
|
void release_pte(PageDirectory&, VirtualAddress, bool);
|
2018-10-17 18:13:55 -03:00
|
|
|
|
2019-06-21 13:37:47 -03:00
|
|
|
RefPtr<PageDirectory> m_kernel_page_directory;
|
2018-10-18 08:05:00 -03:00
|
|
|
|
2020-02-15 09:12:02 -03:00
|
|
|
RefPtr<PhysicalPage> m_shared_zero_page;
|
2020-09-05 00:12:25 -03:00
|
|
|
RefPtr<PhysicalPage> m_lazy_committed_page;
|
2020-02-15 09:12:02 -03:00
|
|
|
|
2021-07-07 00:35:15 -03:00
|
|
|
SystemMemoryInfo m_system_memory_info;
|
2019-06-11 08:13:02 -03:00
|
|
|
|
2021-07-12 17:52:17 -03:00
|
|
|
NonnullOwnPtrVector<PhysicalRegion> m_user_physical_regions;
|
2021-08-04 14:29:02 -03:00
|
|
|
OwnPtr<PhysicalRegion> m_super_physical_region;
|
2021-07-12 17:52:17 -03:00
|
|
|
OwnPtr<PhysicalRegion> m_physical_pages_region;
|
2021-07-07 22:50:05 -03:00
|
|
|
PhysicalPageEntry* m_physical_page_entries { nullptr };
|
|
|
|
|
size_t m_physical_page_entries_count { 0 };
|
2018-11-08 18:20:09 -02:00
|
|
|
|
2021-07-22 21:40:16 -03:00
|
|
|
Region::ListInMemoryManager m_kernel_regions;
|
2021-08-06 18:42:53 -03:00
|
|
|
Vector<UsedMemoryRange> m_used_memory_ranges;
|
|
|
|
|
Vector<PhysicalMemoryRange> m_physical_memory_ranges;
|
|
|
|
|
Vector<ContiguousReservedMemoryRange> m_reserved_memory_ranges;
|
2018-10-17 18:13:55 -03:00
|
|
|
};
|
2018-11-01 07:44:21 -03:00
|
|
|
|
2020-01-02 16:49:21 -03:00
|
|
|
inline bool is_user_address(VirtualAddress vaddr)
|
|
|
|
|
{
|
2021-07-06 23:25:22 -03:00
|
|
|
return vaddr.get() < USER_RANGE_CEILING;
|
2020-01-02 16:49:21 -03:00
|
|
|
}
|
2020-01-19 05:14:14 -03:00
|
|
|
|
|
|
|
|
inline bool is_user_range(VirtualAddress vaddr, size_t size)
|
|
|
|
|
{
|
|
|
|
|
if (vaddr.offset(size) < vaddr)
|
|
|
|
|
return false;
|
2021-09-10 21:34:55 -03:00
|
|
|
if (!is_user_address(vaddr))
|
|
|
|
|
return false;
|
|
|
|
|
if (size <= 1)
|
|
|
|
|
return true;
|
|
|
|
|
return is_user_address(vaddr.offset(size - 1));
|
2020-01-19 05:14:14 -03:00
|
|
|
}
|
2020-02-15 09:12:02 -03:00
|
|
|
|
2021-08-06 08:54:48 -03:00
|
|
|
inline bool is_user_range(VirtualRange const& range)
|
2021-02-12 20:47:47 -03:00
|
|
|
{
|
|
|
|
|
return is_user_range(range.base(), range.size());
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-15 09:12:02 -03:00
|
|
|
inline bool PhysicalPage::is_shared_zero_page() const
|
|
|
|
|
{
|
|
|
|
|
return this == &MM.shared_zero_page();
|
|
|
|
|
}
|
2020-02-15 21:27:42 -03:00
|
|
|
|
2020-09-05 00:12:25 -03:00
|
|
|
inline bool PhysicalPage::is_lazy_committed_page() const
|
|
|
|
|
{
|
|
|
|
|
return this == &MM.lazy_committed_page();
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-15 21:27:42 -03:00
|
|
|
}
|