summaryrefslogtreecommitdiff
path: root/kernel/proc.c
blob: 11789527c106729a42f738d00d6236e9e8a2c027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <kernel/mem.h>
#include <kernel/proc.h>
#include <platform/sysenter.h>

struct process *process_current;

struct process *process_new(void *eip) {
	struct process *proc;
	proc = malloc(sizeof(struct process));

	// should allocate an actual page. TODO
	proc->stack_top = proc->esp = malloc(4096);
	proc->eip = eip;

	return proc;
}

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