forked from Bananymous/banan-os
LibELF: Optimize LoadableELF::clone() memory usage
We only clone mapped pages that have been marked as writeble. Read/execute only pages will be exactly as in the file itself and can be demand paged also :D
This commit is contained in:
parent
603fc200e6
commit
7e9e4c47ae
|
@ -252,6 +252,9 @@ namespace LibELF
|
||||||
break;
|
break;
|
||||||
case PT_LOAD:
|
case PT_LOAD:
|
||||||
{
|
{
|
||||||
|
if (!(program_header.p_flags & LibELF::PF_W))
|
||||||
|
continue;
|
||||||
|
|
||||||
PageTable::flags_t flags = PageTable::Flags::UserSupervisor | PageTable::Flags::Present;
|
PageTable::flags_t flags = PageTable::Flags::UserSupervisor | PageTable::Flags::Present;
|
||||||
if (program_header.p_flags & LibELF::PF_W)
|
if (program_header.p_flags & LibELF::PF_W)
|
||||||
flags |= PageTable::Flags::ReadWrite;
|
flags |= PageTable::Flags::ReadWrite;
|
||||||
|
|
Loading…
Reference in New Issue