Use ELF program headers to load executables smarter.

This turned out way better than the old code. ELF loading is now quite
straightforward, and we don't need the weird concept of subregions anymore.

Next step is to respect the is_writable flag.
This commit is contained in:
Andreas Kling 2018-11-03 11:28:23 +01:00
parent dd060d0fa8
commit aa6d06b47e
Notes: sideshowbarker 2024-07-19 18:34:04 +09:00
9 changed files with 42 additions and 198 deletions

View file

@ -49,7 +49,7 @@ ByteBuffer procfs$pid_vm(Process& process)
{
ProcessInspectionScope scope(process);
char* buffer;
auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 80 + 80 + process.subregionCount() * 80, buffer);
auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 80, buffer);
memset(buffer, 0, stringImpl->length());
char* ptr = buffer;
ptr += ksprintf(ptr, "BEGIN END SIZE NAME\n");
@ -60,18 +60,6 @@ ByteBuffer procfs$pid_vm(Process& process)
region->size,
region->name.characters());
}
if (process.subregionCount()) {
ptr += ksprintf(ptr, "\nREGION OFFSET BEGIN END SIZE NAME\n");
for (auto& subregion : process.subregions()) {
ptr += ksprintf(ptr, "%x %x %x -- %x %x %s\n",
subregion->region->linearAddress.get(),
subregion->offset,
subregion->linearAddress.get(),
subregion->linearAddress.offset(subregion->size - 1).get(),
subregion->size,
subregion->name.characters());
}
}
*ptr = '\0';
return ByteBuffer::copy((byte*)buffer, ptr - buffer);
}