1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:55:07 +00:00

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.
This commit is contained in:
Andreas Kling 2018-11-01 11:44:21 +01:00
parent c45f166c63
commit 5891691640
4 changed files with 12 additions and 32 deletions

View file

@ -61,11 +61,7 @@ ByteBuffer procfs$pid_vm(const Task& task)
ByteBuffer procfs$pid_stack(Task& task)
{
InterruptDisabler disabler;
ASSERT(false);
if (current != &task) {
MM.unmapRegionsForTask(*current);
MM.mapRegionsForTask(task);
}
OtherTaskPagingScope pagingScope(task);
struct RecognizedSymbol {
dword address;
const KSym* ksym;
@ -91,10 +87,6 @@ ByteBuffer procfs$pid_stack(Task& task)
bufptr += ksprintf(bufptr, "%p %s +%u\n", symbol.address, symbol.ksym->name.characters(), offset);
}
buffer.trim(bufptr - (char*)buffer.pointer());
if (current != &task) {
MM.unmapRegionsForTask(task);
MM.mapRegionsForTask(*current);
}
return buffer;
}