aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/load.c
diff options
context:
space:
mode:
authorMarvin Borner2020-08-09 16:51:01 +0200
committerMarvin Borner2020-08-09 16:51:01 +0200
commit162d024a53e1e31e00ff0b6f47dd4590edebc551 (patch)
tree711d3886c300dfaddffdafaa89b690b45eb2101d /kernel/features/load.c
parent79f2fa136f26a0b87917336e089485712ee49bd6 (diff)
Heavy restructuring of libc, kernel and apps
Diffstat (limited to 'kernel/features/load.c')
-rw-r--r--kernel/features/load.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/features/load.c b/kernel/features/load.c
new file mode 100644
index 0000000..cc1a094
--- /dev/null
+++ b/kernel/features/load.c
@@ -0,0 +1,19 @@
+// MIT License, Copyright (c) 2020 Marvin Borner
+
+#include <def.h>
+#include <fs.h>
+#include <load.h>
+#include <mem.h>
+#include <print.h>
+#include <proc.h>
+
+void bin_load(char *path, struct proc *proc)
+{
+ char *data = read_file(path);
+ u32 stack = (u32)malloc(0x1000) + 0x1000;
+
+ proc->regs.ebp = (u32)stack;
+ proc->regs.esp = (u32)stack;
+ proc->regs.useresp = (u32)stack;
+ proc->regs.eip = (u32)data;
+}