1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

Kernel: Change method name to clarify physical memory mmap validation

This commit is contained in:
Liav A 2021-12-23 21:11:18 +02:00 committed by Idan Horowitz
parent f9c4f65e1f
commit 876559d283
3 changed files with 3 additions and 3 deletions

View file

@ -46,7 +46,7 @@ ErrorOr<Memory::Region*> MemoryDevice::mmap(Process& process, OpenFileDescriptio
auto viewed_address = PhysicalAddress(offset); auto viewed_address = PhysicalAddress(offset);
dbgln("MemoryDevice: Trying to mmap physical memory at {} for range of {} bytes", viewed_address, range.size()); dbgln("MemoryDevice: Trying to mmap physical memory at {} for range of {} bytes", viewed_address, range.size());
if (!MM.is_allowed_to_mmap_to_userspace(viewed_address, range)) { if (!MM.is_allowed_to_mmap_physical_memory_to_userspace(viewed_address, range)) {
dbgln("MemoryDevice: Trying to mmap physical memory at {} for range of {} bytes failed due to violation of access", viewed_address, range.size()); dbgln("MemoryDevice: Trying to mmap physical memory at {} for range of {} bytes failed due to violation of access", viewed_address, range.size());
return EINVAL; return EINVAL;
} }

View file

@ -209,7 +209,7 @@ UNMAP_AFTER_INIT void MemoryManager::register_reserved_ranges()
m_reserved_memory_ranges.append(ContiguousReservedMemoryRange { range.start, m_physical_memory_ranges.last().start.get() + m_physical_memory_ranges.last().length - range.start.get() }); m_reserved_memory_ranges.append(ContiguousReservedMemoryRange { range.start, m_physical_memory_ranges.last().start.get() + m_physical_memory_ranges.last().length - range.start.get() });
} }
bool MemoryManager::is_allowed_to_mmap_to_userspace(PhysicalAddress start_address, VirtualRange const& range) const bool MemoryManager::is_allowed_to_mmap_physical_memory_to_userspace(PhysicalAddress start_address, VirtualRange const& range) const
{ {
// Note: Guard against overflow in case someone tries to mmap on the edge of // Note: Guard against overflow in case someone tries to mmap on the edge of
// the RAM // the RAM

View file

@ -230,7 +230,7 @@ public:
PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; } PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; }
Vector<UsedMemoryRange> const& used_memory_ranges() { return m_used_memory_ranges; } Vector<UsedMemoryRange> const& used_memory_ranges() { return m_used_memory_ranges; }
bool is_allowed_to_mmap_to_userspace(PhysicalAddress, VirtualRange const&) const; bool is_allowed_to_mmap_physical_memory_to_userspace(PhysicalAddress, VirtualRange const&) const;
PhysicalPageEntry& get_physical_page_entry(PhysicalAddress); PhysicalPageEntry& get_physical_page_entry(PhysicalAddress);
PhysicalAddress get_physical_address(PhysicalPage const&); PhysicalAddress get_physical_address(PhysicalPage const&);