IBNOS
Classes | Macros | Functions
allocator.c File Reference
#include <memory/physmem.h>
#include <memory/paging.h>
#include <util/util.h>
#include <util/list.h>
Include dependency graph for allocator.c:

Go to the source code of this file.

Classes

struct  heapEntry
 

Macros

#define HEAP_ALIGN_SIZE   16
 
#define HEAP_ALIGN_MASK   (HEAP_ALIGN_SIZE - 1)
 
#define SMALL_HEAP_MAGIC   0xFEEFABB1
 
#define LARGE_HEAP_MAGIC   0xFEEFABB2
 
#define VALIDATE_UNUSED_LIST(unused_list)
 

Functions

void * heapAlloc (uint32_t length)
 Allocates a block of kernel memory. More...
 
void heapFree (void *addr)
 Deallocates a block of kernel memory. More...
 
uint32_t heapSize (void *addr)
 Determines the size of a specific kernel memory block. More...
 
void * heapReAlloc (void *addr, uint32_t length)
 Resizes a block of kernel memory. More...
 
void heapVerify ()
 Runs some internal checks to ensure that the heap is still valid. More...
 

Macro Definition Documentation

◆ VALIDATE_UNUSED_LIST

#define VALIDATE_UNUSED_LIST (   unused_list)
Value:
do \
{ \
LL_FOR_EACH(heap, unused_list, struct heapEntry, entry) \
{ \
assert(((uint32_t)heap & HEAP_ALIGN_MASK) == 0); \
assert(heap->heapMagic == SMALL_HEAP_MAGIC); \
assert(heap->length >= sizeof(struct heapEntry) + 16); \
assert(!heap->reserved); \
} \
} \
while(0)
#define SMALL_HEAP_MAGIC
Definition: allocator.c:41
#define HEAP_ALIGN_MASK
Definition: allocator.c:40