diff options
author | Vivek Goyal <vgoyal@in.ibm.com> | 2006-07-26 17:21:53 -0700 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2006-07-27 12:07:33 -0600 |
commit | 6dcc69c0eb91b643f77c042db31ba23b4a67f1d6 (patch) | |
tree | b0efb1272482a8320ca94cdc0e0a042f0dcca713 /kexec/kexec-elf-exec.c | |
parent | 70543d23c5ddf2d91efa87847de061c1f964e38c (diff) |
kexec-tools: Fix for loading files of type ET_DYN through kexec
o Fix the logic to load a the files of type ET_DYN. Helpful in loading
the relocatable kernel to a different address than the address
executable is compiled for.
Diffstat (limited to 'kexec/kexec-elf-exec.c')
-rw-r--r-- | kexec/kexec-elf-exec.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kexec/kexec-elf-exec.c b/kexec/kexec-elf-exec.c index 324516c..ec00a05 100644 --- a/kexec/kexec-elf-exec.c +++ b/kexec/kexec-elf-exec.c @@ -47,7 +47,7 @@ int build_elf_exec_info(const char *buf, off_t len, struct mem_ehdr *ehdr) } -int elf_exec_load(const struct mem_ehdr *ehdr, struct kexec_info *info) +int elf_exec_load(struct mem_ehdr *ehdr, struct kexec_info *info) { unsigned long base; int result; @@ -79,8 +79,8 @@ int elf_exec_load(const struct mem_ehdr *ehdr, struct kexec_info *info) } start = phdr->p_paddr; stop = start + phdr->p_memsz; - if (start > first) { - start = first; + if (first > start) { + first = start; } if (last < stop) { last = stop; @@ -126,6 +126,10 @@ int elf_exec_load(const struct mem_ehdr *ehdr, struct kexec_info *info) phdr->p_data, size, phdr->p_paddr + base, phdr->p_memsz); } + + /* Update entry point to reflect new load address*/ + ehdr->e_entry += base; + result = 0; out: return result; |