bump-allocated PID but kheap needs fix to kmalloc more than PAGE_SIZE
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user