mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Kernel+LibC: Make all SharedBuffers purgeable (default: non-volatile)
This patch makes SharedBuffer use a PurgeableVMObject as its underlying memory object. A new syscall is added to control the volatile flag of a SharedBuffer.
This commit is contained in:
parent
65229a4082
commit
0317ca5ccc
6 changed files with 50 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <AK/kmalloc.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <SharedBuffer.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -64,3 +65,19 @@ void SharedBuffer::seal()
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void SharedBuffer::set_volatile()
|
||||
{
|
||||
u32 rc = syscall(SC_set_shared_buffer_volatile, m_shared_buffer_id, true);
|
||||
ASSERT(rc == 0);
|
||||
}
|
||||
|
||||
bool SharedBuffer::set_nonvolatile()
|
||||
{
|
||||
u32 rc = syscall(SC_set_shared_buffer_volatile, m_shared_buffer_id, false);
|
||||
if (rc == 0)
|
||||
return true;
|
||||
if (rc == 1)
|
||||
return false;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue