summaryrefslogtreecommitdiff
path: root/kernel/proc.c
diff options
context:
space:
mode:
authordzwdz2021-06-25 21:57:30 +0200
committerdzwdz2021-06-25 21:57:30 +0200
commit7e8a831e1fa1fb98d2486f0c262c2609c176abab (patch)
treead3304a0d16281e019b1e33f7383ed4b97f89afb /kernel/proc.c
parent654ca8603381ffa385350242cfb96906cf612279 (diff)
malloc stub + processes
well, there's only one process, but shh
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);
+}