Small kernel heap for VMM internals, kmalloc/kfree
This commit is contained in:
17
src/kmain.c
17
src/kmain.c
@@ -12,6 +12,8 @@
|
||||
#include "io/kbd/ps2.h"
|
||||
#include "mem/paging/pmm.h"
|
||||
#include "mem/paging/paging.h"
|
||||
#include "mem/paging/vmm.h"
|
||||
#include "mem/heap/kheap.h"
|
||||
|
||||
// Limine version used
|
||||
__attribute__((used, section(".limine_requests")))
|
||||
@@ -53,8 +55,8 @@ static volatile LIMINE_REQUESTS_END_MARKER;
|
||||
|
||||
struct limine_framebuffer* framebuffer;
|
||||
|
||||
// Panic
|
||||
static void hcf()
|
||||
// Panic (should dump registers etc. in the future)
|
||||
void hcf()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
@@ -92,7 +94,18 @@ void kmain()
|
||||
SET_INTERRUPTS;
|
||||
|
||||
pmm_init(memmap_request.response, hhdm_request.response);
|
||||
|
||||
// Remap kernel , HHDM and framebuffer
|
||||
paging_init(kerneladdr_request.response, framebuffer);
|
||||
|
||||
kheap_init();
|
||||
|
||||
void* ptr = kmalloc(10); DEBUG("(KMALLOC TEST) Allocated 10 bytes at 0x%p", ptr);
|
||||
void* ptr2 = kmalloc(200); DEBUG("(KMALLOC TEST) Allocated 200 bytes at 0x%p", ptr2);
|
||||
kfree(ptr);
|
||||
void* ptr3 = kmalloc(5); DEBUG("(KMALLOC TEST) Allocated 5 bytes at 0x%p", ptr3);
|
||||
|
||||
vmm_init();
|
||||
|
||||
keyboard_init(FR);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user