mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 03:55:06 +00:00
Kernel: Use PrivateInodeVMObject for loading program executables
This will be a memory usage pessimization until we actually implement CoW sharing of the memory pages with SharedInodeVMObject. However, it's a huge architectural improvement, so let's take it and improve on this incrementally. fork() should still be neutral, since all private mappings are CoW'ed.
This commit is contained in:
parent
48bbfe51fb
commit
e2697c2ddd
1 changed files with 3 additions and 11 deletions
|
@ -67,6 +67,7 @@
|
||||||
#include <Kernel/TTY/TTY.h>
|
#include <Kernel/TTY/TTY.h>
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/VM/PageDirectory.h>
|
#include <Kernel/VM/PageDirectory.h>
|
||||||
|
#include <Kernel/VM/PrivateInodeVMObject.h>
|
||||||
#include <Kernel/VM/PurgeableVMObject.h>
|
#include <Kernel/VM/PurgeableVMObject.h>
|
||||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||||
#include <LibBareMetal/IO.h>
|
#include <LibBareMetal/IO.h>
|
||||||
|
@ -808,17 +809,8 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
||||||
if (parts.is_empty())
|
if (parts.is_empty())
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
RefPtr<SharedInodeVMObject> vmobject;
|
auto& inode = interpreter_description ? *interpreter_description->inode() : *main_program_description->inode();
|
||||||
if (interpreter_description) {
|
auto vmobject = PrivateInodeVMObject::create_with_inode(inode);
|
||||||
vmobject = SharedInodeVMObject::create_with_inode(*interpreter_description->inode());
|
|
||||||
} else {
|
|
||||||
vmobject = SharedInodeVMObject::create_with_inode(*main_program_description->inode());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (static_cast<const SharedInodeVMObject&>(*vmobject).writable_mappings()) {
|
|
||||||
dbg() << "Refusing to execute a write-mapped program";
|
|
||||||
return -ETXTBSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable profiling temporarily in case it's running on this process.
|
// Disable profiling temporarily in case it's running on this process.
|
||||||
bool was_profiling = is_profiling();
|
bool was_profiling = is_profiling();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue