summaryrefslogtreecommitdiff
path: root/src/kernel/proc.h
blob: b2a05c0ff72053df3f5bd6bf8844a426cef47537 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include <kernel/arch/generic.h>

enum process_state {
	PS_RUNNING,
	PS_DEAD,
};

struct process {
	void *stack_top;
	struct pagedir *pages;
	struct registers regs;
	enum process_state state;

	struct process *sibling;
	struct process *child;
};

extern struct process *process_first;
extern struct process *process_current;

// creates the root process
struct process *process_seed();
struct process *process_clone(struct process *orig);
_Noreturn void process_switch(struct process *proc);

struct process *process_find(enum process_state);