Implement kernel brk
This commit is contained in:
18
src/kernel/memory/kbrk.c
Normal file
18
src/kernel/memory/kbrk.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <memory.h>
|
||||
#include <debug.h>
|
||||
|
||||
static long _brk = KERNEL_BRK0;
|
||||
|
||||
long kbrk(long brk, long, long, long, long, long)
|
||||
{
|
||||
if(brk)
|
||||
{
|
||||
while(_brk < brk) {
|
||||
vmm_set_page(kernel_P4, _brk, pmm_alloc(), PAGE_WRITE | PAGE_PRESENT);
|
||||
_brk += PAGE_SIZE;
|
||||
}
|
||||
return _brk;
|
||||
} else {
|
||||
return _brk;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user