diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-28 10:26:07 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-28 10:28:21 +0100 |
commit | c76dc9a047c54293f148b3b35c5e538ed2871ed1 (patch) | |
tree | 9e8bd3172f8264999fffb788b8b8dde1d8bcc1b0 /Kernel/MemoryManager.h | |
parent | 0a6a2521e8f32a434dc0bf824c7ad1e2b989088a (diff) | |
download | serenity-c76dc9a047c54293f148b3b35c5e538ed2871ed1.zip |
Add /proc/mm and a /bin/mm utility that just dumps it.
This shows some info about the MM. Right now it's just the zone count
and the number of free physical pages. Lots more can be added.
Also added "exit" to sh so we can nest shells and exit from them.
I also noticed that we were leaking all the physical pages, so fixed that.
Diffstat (limited to 'Kernel/MemoryManager.h')
-rw-r--r-- | Kernel/MemoryManager.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Kernel/MemoryManager.h b/Kernel/MemoryManager.h index 0c88607433..4ed3ff66f7 100644 --- a/Kernel/MemoryManager.h +++ b/Kernel/MemoryManager.h @@ -5,7 +5,7 @@ #include <AK/Retainable.h> #include <AK/RetainPtr.h> #include <AK/Vector.h> -#include <AK/HashMap.h> +#include <AK/HashTable.h> #include "Task.h" class Task; @@ -17,7 +17,7 @@ enum class PageFaultResponse { struct Zone : public Retainable<Zone> { public: - ~Zone() { } + ~Zone(); size_t size() const { return m_pages.size() * PAGE_SIZE; } const Vector<PhysicalAddress>& pages() const { return m_pages; } @@ -25,10 +25,7 @@ public: private: friend class MemoryManager; friend bool copyToZone(Zone&, const void* data, size_t); - explicit Zone(Vector<PhysicalAddress>&& pages) - : m_pages(move(pages)) - { - } + explicit Zone(Vector<PhysicalAddress>&&); Vector<PhysicalAddress> m_pages; }; @@ -38,6 +35,7 @@ bool copyToZone(Zone&, const void* data, size_t); #define MM MemoryManager::the() class MemoryManager { + friend ByteBuffer procfs$mm(); public: static MemoryManager& the() PURE; @@ -62,6 +60,9 @@ public: bool mapRegionsForTask(Task&); bool unmapRegionsForTask(Task&); + void registerZone(Zone&); + void unregisterZone(Zone&); + private: MemoryManager(); ~MemoryManager(); @@ -161,7 +162,7 @@ private: dword* m_pageTableZero; dword* m_pageTableOne; - HashMap<int, RetainPtr<Zone>> m_zones; + HashTable<Zone*> m_zones; Vector<PhysicalAddress> m_freePages; }; |