26 lines
577 B
C
26 lines
577 B
C
#ifndef KHEAP_H
|
|
#define KHEAP_H
|
|
|
|
// We need some kind of simple kernel heap to make our linked list
|
|
// for the VMM, as we need "malloc" and "free" for that data structure.
|
|
// When the kernel heap is ready, we can alloc our VM object linked list
|
|
// and then continue working on the VMM.
|
|
|
|
// 16MB should be enough for some linked lists
|
|
#define KHEAP_SIZE (16*1024*1024)
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
|
|
struct heap_block_t
|
|
{
|
|
size_t size;
|
|
bool free;
|
|
struct heap_block_t* next;
|
|
};
|
|
|
|
void kheap_init();
|
|
void* kmalloc(size_t size);
|
|
void kfree(void* ptr);
|
|
|
|
#endif |