mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
Kernel: Hoist VM range allocation up to sys$mmap() itself
Instead of letting each File subclass do range allocation in their mmap() override, do it up front in sys$mmap(). This makes us honor alignment requests for file-backed memory mappings and simplifies the code somwhat.
This commit is contained in:
parent
adcc1c1eff
commit
ab14b0ac64
Notes:
sideshowbarker
2024-07-18 22:51:58 +09:00
Author: https://github.com/awesomekling
Commit: ab14b0ac64
13 changed files with 26 additions and 36 deletions
|
@ -69,7 +69,7 @@ KResultOr<size_t> InodeFile::write(FileDescription& description, size_t offset,
|
|||
return nwritten;
|
||||
}
|
||||
|
||||
KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& description, VirtualAddress preferred_vaddr, size_t offset, size_t size, int prot, bool shared)
|
||||
KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& description, const Range& range, size_t offset, int prot, bool shared)
|
||||
{
|
||||
// FIXME: If PROT_EXEC, check that the underlying file system isn't mounted noexec.
|
||||
RefPtr<InodeVMObject> vmobject;
|
||||
|
@ -79,7 +79,7 @@ KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& descriptio
|
|||
vmobject = PrivateInodeVMObject::create_with_inode(inode());
|
||||
if (!vmobject)
|
||||
return ENOMEM;
|
||||
return process.allocate_region_with_vmobject(preferred_vaddr, size, *vmobject, offset, description.absolute_path(), prot, shared);
|
||||
return process.allocate_region_with_vmobject(range, vmobject.release_nonnull(), offset, description.absolute_path(), prot, shared);
|
||||
}
|
||||
|
||||
String InodeFile::absolute_path(const FileDescription& description) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue