mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
ProcFS: Expose the physical page map of each region in /proc/PID/vm
You can now see the state of each underlying physical page slot in a VM region.
This commit is contained in:
parent
24b5fd4c4c
commit
7f9a86b495
Notes:
sideshowbarker
2024-07-19 09:03:41 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7f9a86b4959
1 changed files with 14 additions and 0 deletions
|
@ -315,6 +315,20 @@ Optional<KBuffer> procfs$pid_vm(InodeIdentifier identifier)
|
|||
region_object.add("amount_dirty", (u32)region.amount_dirty());
|
||||
region_object.add("cow_pages", region.cow_pages());
|
||||
region_object.add("name", region.name());
|
||||
|
||||
StringBuilder pagemap_builder;
|
||||
for (size_t i = 0; i < region.page_count(); ++i) {
|
||||
auto page_index = region.first_page_index() + i;
|
||||
auto& physical_page_slot = region.vmobject().physical_pages()[page_index];
|
||||
if (!physical_page_slot)
|
||||
pagemap_builder.append('N');
|
||||
else if (physical_page_slot == MM.shared_zero_page())
|
||||
pagemap_builder.append('Z');
|
||||
else
|
||||
pagemap_builder.append('P');
|
||||
}
|
||||
region_object.add("pagemap", pagemap_builder.to_string());
|
||||
|
||||
}
|
||||
array.finish();
|
||||
return builder.build();
|
||||
|
|
Loading…
Reference in a new issue