bump-allocated PID but kheap needs fix to kmalloc more than PAGE_SIZE

This commit is contained in:
2026-02-02 11:05:27 +01:00
parent 4a90de9521
commit 7bb542d901
8 changed files with 96 additions and 31 deletions

View File

@@ -3,6 +3,7 @@
#include "mem/paging/pmm.h"
#include <stddef.h>
#include <kernel.h>
#include "sched/process.h"
extern uint64_t kernel_phys_base;
extern uint64_t kernel_virt_base;
@@ -103,4 +104,12 @@ void kfree(void* ptr)
// Set it free!
struct heap_block_t* block = (struct heap_block_t*)((uintptr_t)ptr - sizeof(struct heap_block_t));
block->free = true;
}
// Should alloc enough for a stack (at least 64kb) to be used for a process.
// Should return a pointer to top of the stack (as stack grows DOWNWARDS)
void* kalloc_stack()
{
void* ptr = kmalloc(PROCESS_STACK_SIZE);
return ptr+PROCESS_STACK_SIZE;
}