fix: remove the kernel process and add a shell process (still not working tho)

This commit is contained in:
0x35c
2025-11-05 16:46:55 +01:00
parent 374ea13173
commit 359484b2e4
5 changed files with 34 additions and 22 deletions

View File

@ -2,22 +2,34 @@
#include "alloc.h"
#include "interrupts.h"
#include "memory.h"
#include "thread.h"
#include "string.h"
int8_t create_kernel_process(void)
{
struct pcb *new_pcb = vmalloc(sizeof(struct pcb));
if (!new_pcb)
return -1;
new_pcb->pid = 0;
new_pcb->uid = 0;
new_pcb->heap = kernel_pd;
new_pcb->cr3 = (uint32_t *)((uint32_t)kernel_pd - HEAP_END);
new_pcb->next = new_pcb;
new_pcb->prev = new_pcb;
return 0;
}
// int8_t create_kernel_process(void)
// {
// struct pcb *new_pcb = vmalloc(sizeof(struct pcb));
// if (!new_pcb)
// return -1;
// new_pcb->pid = 0;
// new_pcb->uid = 0;
// new_pcb->heap = kernel_pd;
// new_pcb->cr3 = (uint32_t *)((uint32_t)kernel_pd - HEAP_END);
// new_pcb->next = new_pcb;
// new_pcb->prev = new_pcb;
// struct tcb *kern_thread = vmalloc(sizeof(struct tcb));
// if (!kern_thread) {
// vfree(new_pcb);
// return -1;
// }
// kern_thread->esp = ;
// kern_thread->next = NULL;
// kern_thread->process = new_pcb;
// kern_thread->state = RUNNING;
// kern_thread->tid = 1;
// return 0;
// }
struct pcb *create_process(uint8_t uid)
{