diff options
| author | Carlos Maiolino <[email protected]> | 2025-09-14 14:18:41 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-09-14 14:18:41 +0200 |
| commit | cd2c4e4a25cb41ca6fe622f0ccf1b1a3dd9d5660 (patch) | |
| tree | 319ff940278d98f0010bdcdfcbc08bf22cb6aec0 /src/include/mm | |
| parent | 833f883ab85d57d8f9cfae5a2181b3e097fae8bd (diff) | |
Add a kernel heap
Use the heap API to implement a 100MiB heap to
be used by the kernel code.
Add example usage to src/kernel.c
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'src/include/mm')
| -rw-r--r-- | src/include/mm/kernel_heap.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/mm/kernel_heap.h b/src/include/mm/kernel_heap.h new file mode 100644 index 0000000..4527a11 --- /dev/null +++ b/src/include/mm/kernel_heap.h @@ -0,0 +1,20 @@ +#ifndef KERNEL_HEAP_H +#define KERNEL_HEAP_H + +#include <mm/heap.h> + +#define KERNEL_HEAP_SIZE_BYTES (1024 * 1024 * 100) /* 100 MiB */ +#define KERNEL_HEAP_ENTRIES (KERNEL_HEAP_SIZE_BYTES / PAGE_SIZE) + +/* Addresses taken from OSDev x86 memory map */ +#define KERNEL_HEAP_ADDR (0x01000000) + +/* This should give us 480.5 kiB, enough for the current table size */ +#define KERNEL_HEAP_TBL_ADDR (0x00007E00) + + +void kernel_heap_init(); +void * kmalloc(size_t size); +void kfree(void *ptr); + +#endif /* KERNEL_HEAP_H */ |
