diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-05 10:23:00 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-05 10:23:00 +0100 |
commit | 72cdc62155be8af67ff9328bc4226a69bbbb659c (patch) | |
tree | be86883b319ff581da9b04007ece362ebc75f4fe /Kernel/ProcFileSystem.cpp | |
parent | b5c5286ee19b6414ad20496e31913efb79002b2c (diff) | |
download | serenity-72cdc62155be8af67ff9328bc4226a69bbbb659c.zip |
Replace zones with individually tracked physical pages.
It's just a simple struct { ref_count, paddr }.
This will allow me to implement lazy zeroing and COW pages.
Diffstat (limited to 'Kernel/ProcFileSystem.cpp')
-rw-r--r-- | Kernel/ProcFileSystem.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Kernel/ProcFileSystem.cpp b/Kernel/ProcFileSystem.cpp index 8ad761fbea..d68813eb6f 100644 --- a/Kernel/ProcFileSystem.cpp +++ b/Kernel/ProcFileSystem.cpp @@ -49,7 +49,7 @@ ByteBuffer procfs$pid_vm(Process& process) { ProcessInspectionScope scope(process); char* buffer; - auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 80, buffer); + auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 80 + 4096, buffer); memset(buffer, 0, stringImpl->length()); char* ptr = buffer; ptr += ksprintf(ptr, "BEGIN END SIZE NAME\n"); @@ -59,6 +59,10 @@ ByteBuffer procfs$pid_vm(Process& process) region->linearAddress.offset(region->size - 1).get(), region->size, region->name.characters()); + for (auto& physical_page : region->physical_pages) { + ptr += ksprintf(ptr, "P%x ", physical_page ? physical_page->paddr().get() : 0); + } + ptr += ksprintf(ptr, "\n"); } *ptr = '\0'; return ByteBuffer::copy((byte*)buffer, ptr - buffer); @@ -130,6 +134,8 @@ void ProcFileSystem::removeProcess(Process& process) ByteBuffer procfs$mm() { + // FIXME: Implement +#if 0 InterruptDisabler disabler; size_t zonePageCount = 0; for (auto* zone : MM.m_zones) @@ -143,9 +149,11 @@ ByteBuffer procfs$mm() ptr += ksprintf(ptr, "\n"); } ptr += ksprintf(ptr, "Zone count: %u\n", MM.m_zones.size()); - ptr += ksprintf(ptr, "Free physical pages: %u\n", MM.m_freePages.size()); + ptr += ksprintf(ptr, "Free physical pages: %u\n", MM.m_free_physical_pages.size()); buffer.trim(ptr - (char*)buffer.pointer()); return buffer; +#endif + return { }; } |