31 lines
638 B
C
31 lines
638 B
C
/*
|
|
* @author xamidev <xamidev@riseup.net>
|
|
* @brief Kernel heap
|
|
* @license GPL-3.0-only
|
|
*/
|
|
|
|
#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.
|
|
|
|
#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);
|
|
void* kalloc_stack();
|
|
void kheap_map_page();
|
|
|
|
#endif |