ApertureOS
Data Structures | Macros | Functions | Variables
kmalloc.c File Reference
#include "kmalloc.h"
#include "managers.h"
#include "utils/common.h"
#include "utils/native.h"
Include dependency graph for kmalloc.c:

Data Structures

struct  kmalloc_info
 

Macros

#define IS_FREE(x)   ((x->pointer & 1) == 0)
 
#define IS_USED(x)   ((x->pointer & 1) == 1)
 
#define MARK_FREE(x)   (x->pointer = CLEAR_BIT(x->pointer, 0))
 
#define MARK_USED(x)   (x->pointer = SET_BIT(x->pointer, 0))
 
#define GET_ADDR(x)   (x->pointer & ~1)
 
#define SET_ADDR(x, val)   (x->pointer = val | (x->pointer & 1))
 
#define STORE_SIZE   MB(128)
 

Functions

void kmalloc_init ()
 Initialize the kernel memory allocator. More...
 
void kcompact ()
 Compact the kernel memory allocation table. More...
 
void * kmalloc (size_t size)
 kernel malloc More...
 
void kfree (void *addr)
 kernel free More...
 

Variables

void * k_pages_base_addr
 
int max_allocs = 0
 
uint32_t free_space = 0
 
kmalloc_infoallocation_info = NULL
 
kmalloc_infonext_free_block = NULL
 
bool retry = FALSE
 

Macro Definition Documentation

#define GET_ADDR (   x)    (x->pointer & ~1)
#define IS_FREE (   x)    ((x->pointer & 1) == 0)
#define IS_USED (   x)    ((x->pointer & 1) == 1)
#define MARK_FREE (   x)    (x->pointer = CLEAR_BIT(x->pointer, 0))
#define MARK_USED (   x)    (x->pointer = SET_BIT(x->pointer, 0))
#define SET_ADDR (   x,
  val 
)    (x->pointer = val | (x->pointer & 1))
#define STORE_SIZE   MB(128)

Variable Documentation

kmalloc_info* allocation_info = NULL
uint32_t free_space = 0
void* k_pages_base_addr
int max_allocs = 0
kmalloc_info * next_free_block = NULL
bool retry = FALSE