Turn threads into processes by giving them unique page directories

This commit is contained in:
2022-01-14 22:01:28 +01:00
parent 0272605d36
commit 0e1cf97e19
9 changed files with 98 additions and 68 deletions

View File

@@ -1,25 +1,26 @@
#pragma once
#include <stdint.h>
struct thread
struct process
{
struct thread *q_next;
uint64_t tid;
uint64_t pid;
void *stack_ptr;
uint64_t state;
uint64_t P4;
struct process *q_next;
uint8_t stack[];
};
// proc/thread.c
extern struct thread *current_thread;
// proc/process.c
extern struct process *current_proc;
// proc/swtch.S
void *switch_stack(void *out, void *in);
// proc/thread.c
struct thread *new_thread(void (*function)(void));
struct thread *thread();
// proc/process.c
struct process *new_process(void (*function)(void));
struct process *proc();
// proc/scheduler.c
void scheduler_insert(struct thread *new);
void scheduler_insert(struct process *new);
void start_scheduler();