Move headers to include/
This commit is contained in:
32
include/mem/kheap.h
Normal file
32
include/mem/kheap.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* @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>
|
||||
#include <stdint.h>
|
||||
|
||||
struct heap_block_t {
|
||||
size_t size;
|
||||
bool free; // 1byte
|
||||
uint8_t reserved[7]; // (7+1 = 8 bytes)
|
||||
struct heap_block_t* next;
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
void kheap_init(void);
|
||||
void* kmalloc(size_t size);
|
||||
void kfree(void* ptr);
|
||||
void* kalloc_stack(void);
|
||||
void kheap_map_page(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user