MyOS Kernel
|
#include "cpu/arch_consts.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "cpu/serial.h"
#include "cpu/halt.h"
Macros | |
#define | KMALLOC_BMAP_SZ (((KMALLOC_SZ*1024)/4)/8) |
The size of the kmalloc bitmap. | |
Functions | |
static char | get_bmap_bit (size_t index) |
static void | set_bmap_bit (size_t index) |
static void | clear_bmap_bit (size_t index) |
void * | kmalloc (size_t size) |
void | kfree (void *mem) |
Variables | |
static char | bitmap [KMALLOC_BMAP_SZ] |
Bitmap of used areas of the heap. | |
static void * | data =(void*)KMALLOC_START |
Start of the kmalloc heap. | |
|
static |
Clear a bit in the heap bitmap
index | The bit to clear |
|
static |
Get a bit in the heap bitmap
index | The bit to get |
void kfree | ( | void * | mem | ) |
Free a block in the kernel heap
mem | The address of the block |
void* kmalloc | ( | size_t | size | ) |
Allocate a block in the kernel heap
size | The size of the block |
|
static |
Set a bit in the heap bitmap
index | The bit to set |