![]() |
Xyris
0.5
|
#include <Library/errno.hpp>
#include <Locking/Mutex.hpp>
#include <Memory/heap.hpp>
#include <Memory/paging.hpp>
#include <stddef.h>
Go to the source code of this file.
Functions | |
int | liballoc_lock () |
int | liballoc_unlock () |
void * | liballoc_alloc (unsigned int count) |
int | liballoc_free (void *page, unsigned int count) |
Liballoc heap implementation.
Definition in file heap.cpp.
void* liballoc_alloc | ( | unsigned int | ) |
This is the hook into the local system which allocates pages. It accepts an integer parameter which is the number of pages required. The page size was set up in the liballoc_init function.
Definition at line 31 of file heap.cpp.
int liballoc_free | ( | void * | , |
unsigned int | |||
) |
This frees previously allocated memory. The void* parameter passed to the function is the exact same value returned from a previous liballoc_alloc call.
The integer value is the number of pages to free.
Definition at line 36 of file heap.cpp.
int liballoc_lock | ( | ) |
This function is supposed to lock the memory data structures. It could be as simple as disabling interrupts or acquiring a spinlock. It's up to you to decide.
int liballoc_unlock | ( | ) |
This function unlocks what was previously locked by the liballoc_lock function. If it disabled interrupts, it enables interrupts. If it had acquiried a spinlock, it releases the spinlock. etc.