Move headers to include/

This commit is contained in:
2026-03-18 11:48:33 +01:00
parent a1e8aacd01
commit f7735eb3a4
45 changed files with 89 additions and 88 deletions

32
include/mem/kheap.h Normal file
View 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