1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

Teach Process::exec() about the magic of file-backed VMO's.

This is really sweet! :^) The four instances of /bin/sh spawned at
startup now share their read-only text pages.

There are problems and limitations here, and plenty of room for
improvement. But it kinda works.
This commit is contained in:
Andreas Kling 2018-11-08 21:20:09 +01:00
parent 992769c9d4
commit cd1e7419f0
10 changed files with 159 additions and 70 deletions

View file

@ -1,7 +1,7 @@
#include "ELFImage.h"
#include <AK/kstdio.h>
ELFImage::ELFImage(ByteBuffer&& buffer)
ELFImage::ELFImage(const byte* buffer)
: m_buffer(buffer)
{
m_valid = parse();
@ -133,11 +133,7 @@ const char* ELFImage::table_string(unsigned offset) const
const char* ELFImage::raw_data(unsigned offset) const
{
#ifdef SERENITY
return reinterpret_cast<const char*>(m_buffer.pointer()) + offset;
#else
return reinterpret_cast<const char*>(m_file.pointer()) + offset;
#endif
return reinterpret_cast<const char*>(m_buffer) + offset;
}
const Elf32_Ehdr& ELFImage::header() const