diff options
-rw-r--r-- | kexec/kexec-elf-exec.c | 10 | ||||
-rw-r--r-- | kexec/kexec-elf.h | 2 |
2 files changed, 8 insertions, 4 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; diff --git a/kexec/kexec-elf.h b/kexec/kexec-elf.h index 298d351..b7332de 100644 --- a/kexec/kexec-elf.h +++ b/kexec/kexec-elf.h @@ -89,7 +89,7 @@ extern int build_elf_info(const char *buf, off_t len, struct mem_ehdr *ehdr); extern int build_elf_exec_info(const char *buf, off_t len, struct mem_ehdr *ehdr); extern int build_elf_rel_info(const char *buf, off_t len, struct mem_ehdr *ehdr); -extern int elf_exec_load(const struct mem_ehdr *ehdr, struct kexec_info *info); +extern int elf_exec_load(struct mem_ehdr *ehdr, struct kexec_info *info); extern int elf_rel_load(struct mem_ehdr *ehdr, struct kexec_info *info, unsigned long min, unsigned long max, int end); |