mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
Add an InterruptDisabler helper class and use that for kmalloc.
The naive spinlock was not nearly enough to protect kmalloc from reentrancy problems. I don't want to deal with coming up with a fancy lock for kmalloc right now, so I made an InterruptDisabler thingy instead. It does CLI and then STI iff interrupts were previously enabled.
This commit is contained in:
@@ -18,7 +18,7 @@ bool ProcFileSystem::initialize()
|
||||
{
|
||||
SyntheticFileSystem::initialize();
|
||||
addFile(createGeneratedFile("summary", [] {
|
||||
cli();
|
||||
InterruptDisabler disabler;
|
||||
auto tasks = Task::allTasks();
|
||||
char* buffer;
|
||||
auto stringImpl = StringImpl::createUninitialized(tasks.size() * 128, buffer);
|
||||
@@ -36,7 +36,6 @@ bool ProcFileSystem::initialize()
|
||||
}
|
||||
ptr += ksprintf(ptr, "kmalloc: alloc: %u / free: %u\n", sum_alloc, sum_free);
|
||||
*ptr = '\0';
|
||||
sti();
|
||||
return ByteBuffer::copy((byte*)buffer, ptr - buffer);
|
||||
}));
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user