sched: fix page faulting on process switching
This is the first version of the kernel with fully isolated threads for user and kernel tasks, where process 0 is only used for scheduling and interrupt handling. User process have a "buddy" kernel process that handles its tasks in the kernel. This system allows for easy blocking of threads without much need for thought. Just `sswtch` in an infinite read loop, and your userspace process will be blocked. Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
parent
72827c1e00
commit
f92e88597d
8 changed files with 125 additions and 30 deletions
|
|
@ -53,13 +53,13 @@ struct procregs {
|
|||
|
||||
struct proc {
|
||||
struct procregs regs;
|
||||
uint8_t state;
|
||||
pid_t pid;
|
||||
pid_t ppid;
|
||||
uint64_t cr3;
|
||||
spinlock_t lock;
|
||||
|
||||
bool is_kernel;
|
||||
uint8_t state;
|
||||
|
||||
struct rbtree page_map;
|
||||
spinlock_t page_map_lock;
|
||||
|
|
@ -71,6 +71,9 @@ struct proc {
|
|||
struct rbtree children;
|
||||
|
||||
struct proc *buddy_proc;
|
||||
|
||||
uintptr_t stack_start;
|
||||
uintptr_t stack_size;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue