slab: add umalloc

This commit is contained in:
Michael Shaw 2025-02-12 17:20:20 -05:00
commit b496366469
8 changed files with 238 additions and 12 deletions

View file

@ -7,6 +7,7 @@
#include <kernel/lock.h>
#include <kernel/rbtree.h>
#include <kernel/slab.h>
#include <lib/sem.h>
@ -24,6 +25,12 @@
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define USER_STACK_BASE 0x00007FFFF0000000
#define USER_HEAP_BASE 0x0000000100000000 /* 4GB */
#define PM_BUD 0
#define PM_SLB 1
typedef int64_t pid_t;
struct proc_mmap_entry {
@ -60,6 +67,22 @@ struct procregs {
} PACKED;
struct proc_mapping {
uintptr_t vaddr;
paddr_t paddr;
size_t len;
uint64_t attr;
uint64_t type;
slab_t *slab;
struct proc_mapping *next;
};
struct proc_allocation {
struct proc_mapping *mappings;
struct proc_mapping *last;
size_t num_mappings;
};
struct proc {
struct procregs regs;
uint8_t state;
@ -83,6 +106,10 @@ struct proc {
uintptr_t stack_start;
uintptr_t stack_size;
uintptr_t heap_start;
struct rbtree umalloc_tree;
};
struct procregs *proc_current_regs();