wip: separate allocators into a kernel one and a user one

This commit is contained in:
0x35c
2025-11-12 16:02:52 +01:00
parent a776a45f68
commit 9f142941c3
22 changed files with 149 additions and 56 deletions

View File

@ -9,16 +9,16 @@
struct pcb *create_process(uid_t uid)
{
static pid_t pid = 1;
struct pcb *new_pcb = vmalloc(sizeof(struct pcb));
struct pcb *new_pcb = kmalloc(sizeof(struct pcb));
if (!new_pcb)
return NULL;
new_pcb->uid = uid;
new_pcb->pid = pid++;
new_pcb->tid = 1;
new_pcb->heap = alloc_pages(4096, &new_pcb->cr3);
new_pcb->heap = kalloc_pages(4096, &new_pcb->cr3);
if (!new_pcb->heap) {
vfree(new_pcb);
kfree(new_pcb);
return NULL;
}
memcpy(new_pcb->heap, current_pd, 4096);
@ -48,8 +48,8 @@ void remove_process(struct pcb *pcb)
struct pcb *left = pcb->prev;
struct pcb *right = pcb->next;
if (pcb->heap)
free_pages(pcb->heap, 4096);
kfree_pages(pcb->heap, 4096);
left->next = right;
right->prev = left;
vfree(pcb);
kfree(pcb);
}