Re-make: kernel heap (malloc, free) via free list alloc + add UEFI emulation doc

This commit is contained in:
xamidev
2024-09-04 21:49:26 +02:00
parent 3b39a0a1f4
commit 4d05e0d620
4 changed files with 79 additions and 35 deletions

View File

@@ -7,10 +7,19 @@
#define KHEAP_H
#include <stdint.h>
#include "system.h"
uint32_t kmalloc_a(uint32_t sz);
uint32_t kmalloc_p(uint32_t sz, uint32_t *phys);
uint32_t kmalloc_ap(uint32_t sz, uint32_t *phys);
uint32_t kmalloc(uint32_t sz);
typedef struct block
{
size_t size;
struct block* next;
} block_t;
#define HEAP_SIZE 1024*1024 // 1MB malloc-able
void init_alloc();
void* malloc(size_t size);
void free(void* ptr);
#endif