diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-28 10:03:54 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-28 10:03:54 +0100 |
commit | 0a6a2521e8f32a434dc0bf824c7ad1e2b989088a (patch) | |
tree | 3060365c58eb172bb32af1b49a55dcf6e9f10094 | |
parent | 1d5afbdffc2ca0262c9ca335c1a30e7b214d13a5 (diff) | |
download | serenity-0a6a2521e8f32a434dc0bf824c7ad1e2b989088a.zip |
Add subregions to /proc/PID/vm
-rw-r--r-- | Kernel/ProcFileSystem.cpp | 14 | ||||
-rw-r--r-- | Kernel/Task.h | 5 |
2 files changed, 17 insertions, 2 deletions
diff --git a/Kernel/ProcFileSystem.cpp b/Kernel/ProcFileSystem.cpp index 6596ac2dd8..8457361cf4 100644 --- a/Kernel/ProcFileSystem.cpp +++ b/Kernel/ProcFileSystem.cpp @@ -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); } diff --git a/Kernel/Task.h b/Kernel/Task.h index 99a53a87c5..88d3f348a9 100644 --- a/Kernel/Task.h +++ b/Kernel/Task.h @@ -15,7 +15,8 @@ class Zone; class Task : public InlineLinkedListNode<Task> { friend class InlineLinkedListNode<Task>; - class Region; + struct Region; + struct Subregion; public: static Task* createKernelTask(void (*entry)(), String&& name); static Task* createUserTask(const String& path, uid_t, gid_t, pid_t parentPID, int& error, const char** args = nullptr); @@ -114,6 +115,8 @@ public: size_t regionCount() const { return m_regions.size(); } const Vector<RetainPtr<Region>>& regions() const { return m_regions; } + size_t subregionCount() const { return m_regions.size(); } + const Vector<OwnPtr<Subregion>>& subregions() const { return m_subregions; } void dumpRegions(); void didSchedule() { ++m_timesScheduled; } |