summaryrefslogtreecommitdiff
path: root/kernel/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/proc.c')
-rw-r--r--kernel/proc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/proc.c b/kernel/proc.c
new file mode 100644
index 0000000..1178952
--- /dev/null
+++ b/kernel/proc.c
@@ -0,0 +1,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);
+}