wip: better way of handling thread switch (iret in the switch)
This commit is contained in:
@ -6,31 +6,6 @@
|
||||
|
||||
#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;
|
||||
// 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)
|
||||
{
|
||||
static uint32_t pid = 1;
|
||||
@ -47,14 +22,16 @@ struct pcb *create_process(uint8_t uid)
|
||||
}
|
||||
memcpy(new_pcb->heap, current_pcb->heap, 4096);
|
||||
|
||||
new_pcb->next = new_pcb;
|
||||
new_pcb->prev = new_pcb;
|
||||
|
||||
if (current_pcb) {
|
||||
new_pcb->next = current_pcb->next;
|
||||
new_pcb->prev = current_pcb;
|
||||
current_pcb->next = new_pcb;
|
||||
if (current_pcb->prev == current_pcb)
|
||||
current_pcb->prev = new_pcb;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
current_pcb = new_pcb;
|
||||
}
|
||||
new_pcb->signals.pending = SIG_IGN;
|
||||
|
||||
Reference in New Issue
Block a user