diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-01 17:42:36 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-01 17:42:36 +0200 |
commit | e9683297bf480f9590b0e5796f4520fb430e2e03 (patch) | |
tree | 93ef75cd154edf4c342d0a22cd56eb3670feb2b5 /src/kernel/linker | |
parent | e8cf65c07d78e3cfbac953b1b97c51998a5900df (diff) | |
download | TCE-e9683297bf480f9590b0e5796f4520fb430e2e03.tar.gz TCE-e9683297bf480f9590b0e5796f4520fb430e2e03.zip |
Now using Doug Lea's malloc for userland too. And improved stability.
Diffstat (limited to 'src/kernel/linker')
-rw-r--r-- | src/kernel/linker/elf.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/kernel/linker/elf.c b/src/kernel/linker/elf.c index 7eaae94..af6d057 100644 --- a/src/kernel/linker/elf.c +++ b/src/kernel/linker/elf.c @@ -1,7 +1,7 @@ #include "elf.h" #include <mem/paging.h> #include <mem/seg.h> -#include <stdlib.h> +#include <stdlib_common.h> #include <core/sys.h> int elf_check(uint8_t *data) { @@ -14,6 +14,7 @@ thread_entry elf_load(uint8_t *data, struct process* process) { struct elf_ehdr *ehdr = (struct elf_ehdr*)data; struct elf_phdr *phdr; int i; + size_t dataseg = 0; if (elf_check(data)) return 0; struct page_directory *r = current_pagedir; @@ -28,9 +29,15 @@ thread_entry elf_load(uint8_t *data, struct process* process) { if (phdr[i].p_memsz > phdr[i].p_filesz) { memset((uint8_t*)phdr[i].p_vaddr + phdr[i].p_memsz, 0, phdr[i].p_memsz - phdr[i].p_filesz); } + if (phdr[i].p_vaddr + phdr[i].p_memsz > dataseg) { + dataseg = phdr[i].p_vaddr + phdr[i].p_memsz; + dataseg = (dataseg & 0xFFFFF000) + 0x1000; + } } } + process->data = dataseg; + pagedir_switch(r); sti(); |