1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 15:44:57 +00:00

Add subregions to /proc/PID/vm

This commit is contained in:
Andreas Kling 2018-10-28 10:03:54 +01:00
parent 1d5afbdffc
commit 0a6a2521e8
2 changed files with 17 additions and 2 deletions

View file

@ -30,7 +30,7 @@ ByteBuffer procfs$pid_vm(const Task& task)
{
InterruptDisabler disabler;
char* buffer;
auto stringImpl = StringImpl::createUninitialized(80 + task.regionCount() * 80, buffer);
auto stringImpl = StringImpl::createUninitialized(80 + task.regionCount() * 80 + 80 + task.subregionCount() * 80, buffer);
memset(buffer, 0, stringImpl->length());
char* ptr = buffer;
ptr += ksprintf(ptr, "BEGIN END SIZE NAME\n");
@ -41,6 +41,18 @@ ByteBuffer procfs$pid_vm(const Task& task)
region->size,
region->name.characters());
}
if (task.subregionCount()) {
ptr += ksprintf(ptr, "\nREGION OFFSET BEGIN END SIZE NAME\n");
for (auto& subregion : task.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);
}