summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
diff options
context:
space:
mode:
authordzwdz2021-07-10 16:37:45 +0200
committerdzwdz2021-07-10 16:37:45 +0200
commitd093a8eea6bfb0ff7e621e9ba3307dae698322aa (patch)
tree08a5272e2813cf8db8feda4ff91d919cb9ad7330 /src/kernel/proc.c
parent1faac72e2514c335e2d5721dce8c9fd1da722062 (diff)
separate the source code from object files; more modular Makefile
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r--src/kernel/proc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
new file mode 100644
index 0000000..776238c
--- /dev/null
+++ b/src/kernel/proc.c
@@ -0,0 +1,19 @@
+#include <kernel/mem.h>
+#include <kernel/proc.h>
+#include <platform/asm.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);
+}