summaryrefslogtreecommitdiff
path: root/src/stem/linker
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-02-05 20:49:34 +0100
committerAlexis211 <alexis211@gmail.com>2010-02-05 20:49:34 +0100
commit893244c8b5272df86da5d333332eec26ae8f15f2 (patch)
tree066a20bc1cca70f1aa97df616b2b4fc31d698b40 /src/stem/linker
parentf9fd53ccbb1bb38ed21360179f44b27e2a729701 (diff)
downloadTCE-893244c8b5272df86da5d333332eec26ae8f15f2.tar.gz
TCE-893244c8b5272df86da5d333332eec26ae8f15f2.zip
More work, does not work
Diffstat (limited to 'src/stem/linker')
-rw-r--r--src/stem/linker/elf.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/stem/linker/elf.c b/src/stem/linker/elf.c
index 62030ee..dc7481b 100644
--- a/src/stem/linker/elf.c
+++ b/src/stem/linker/elf.c
@@ -2,6 +2,7 @@
#include <mem/paging.h>
#include <mem/seg.h>
#include <stdlib.h>
+#include <core/sys.h>
int elf_check(uint8_t *data) {
struct elf_ehdr *h = (struct elf_ehdr*)data;
@@ -29,3 +30,15 @@ thread_entry elf_load(uint8_t *data, struct process* process) {
}
return (thread_entry)ehdr->e_entry;
}
+
+struct process* elf_exec(uint8_t *data) {
+ if (elf_check(data)) return 0;
+
+ struct process* p = process_new(0, 0, PL_DRIVER);
+
+ thread_entry e = elf_load(data, p);
+
+ thread_new(p, e, 0);
+
+ return p;
+}