summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
blob: 7d42bce5ae12ca33f617989cbe4c99e0d3d08860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <arch/generic.h>
#include <kernel/mem.h>
#include <kernel/proc.h>

struct process *process_current;

struct process *process_new(void *eip) {
	struct process *proc;
	proc = page_alloc(1); // TODO kmalloc
	proc->stack_top = proc->esp = page_alloc(1) + 1 * PAGE_SIZE;
	proc->eip = eip;

	return proc;
}

void process_switch(struct process *proc) {
	process_current = proc;
	sysexit(proc->eip, proc->esp);
}