Blob Blame History Raw
--- kexec-tools-1.101/kexec/kexec-elf.h.orig	2006-07-31 10:41:57.000000000 -0400
+++ kexec-tools-1.101/kexec/kexec-elf.h	2006-07-31 10:42:09.000000000 -0400
@@ -89,7 +89,7 @@ extern int build_elf_info(const char *bu
 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);
 
--- kexec-tools-1.101/kexec/kexec-elf-exec.c.orig	2006-07-31 10:14:20.000000000 -0400
+++ kexec-tools-1.101/kexec/kexec-elf-exec.c	2006-07-31 10:18:25.000000000 -0400
@@ -47,7 +47,7 @@ int build_elf_exec_info(const char *buf,
 }
 
 
-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 
 			}
 			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 
 			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;