summaryrefslogtreecommitdiff
path: root/Kernel/MemoryManager.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-01 11:44:21 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-01 11:44:21 +0100
commit5891691640a272d3ea4bc0a20a3738854dda1242 (patch)
treec308c6695bdc8124c9fb1195915bbccf2d6614c0 /Kernel/MemoryManager.h
parentc45f166c6323224ea1ffc20914a003ef96d3a72b (diff)
downloadserenity-5891691640a272d3ea4bc0a20a3738854dda1242.zip
Fix /proc/PID/stack in the new per-process page directory world.
I added an RAII helper called OtherTaskPagingScope. While present, it switches the kernel over to using another task's page directory. This is perfect for e.g walking the stack in /proc/PID/stack.
Diffstat (limited to 'Kernel/MemoryManager.h')
-rw-r--r--Kernel/MemoryManager.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/Kernel/MemoryManager.h b/Kernel/MemoryManager.h
index 34d173d343..33c124aed1 100644
--- a/Kernel/MemoryManager.h
+++ b/Kernel/MemoryManager.h
@@ -54,13 +54,10 @@ public:
bool mapSubregion(Task&, Task::Subregion&);
bool unmapSubregion(Task&, Task::Subregion&);
- bool mapSubregionsForTask(Task&);
- bool unmapSubregionsForTask(Task&);
bool mapRegion(Task&, Task::Region&);
bool unmapRegion(Task&, Task::Region&);
bool mapRegionsForTask(Task&);
- bool unmapRegionsForTask(Task&);
void registerZone(Zone&);
void unregisterZone(Zone&);
@@ -182,3 +179,13 @@ private:
Vector<PhysicalAddress> m_freePages;
};
+
+struct KernelPagingScope {
+ KernelPagingScope() { MM.enter_kernel_paging_scope(); }
+ ~KernelPagingScope() { MM.enter_task_paging_scope(*current); }
+};
+
+struct OtherTaskPagingScope {
+ OtherTaskPagingScope(Task& task) { MM.enter_task_paging_scope(task); }
+ ~OtherTaskPagingScope() { MM.enter_task_paging_scope(*current); }
+};