Since we have the kernel's entry point stored in the ELF header use it,
and stop hardcoding the value.

Signed-off-by: "Eric W. Biederman" <ebied...@xmission.com>
---
 arch/x86/boot/compressed/head_32.S |    2 +-
 arch/x86/boot/compressed/head_64.S |    2 +-
 arch/x86/boot/compressed/misc.c    |   16 +++++++++-------
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/x86/boot/compressed/head_32.S 
b/arch/x86/boot/compressed/head_32.S
index c85e3ac..1b15e2c 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -211,7 +211,7 @@ relocated:
  * Jump to the decompressed kernel.
  */
        xorl    %ebx, %ebx
-       jmp     *%ebp
+       jmp     *%eax
 
 /*
  * Stack and heap for uncompression
diff --git a/arch/x86/boot/compressed/head_64.S 
b/arch/x86/boot/compressed/head_64.S
index 87e03a1..9b8d782 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -337,7 +337,7 @@ relocated:
 /*
  * Jump to the decompressed kernel.
  */
-       jmp     *%rbp
+       jmp     *%rax
 
        .data
 gdt:
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 7116dcb..fc96c3e 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -273,7 +273,7 @@ static void error(char *x)
                asm("hlt");
 }
 
-static void parse_elf(void *output)
+static void *parse_elf(void *output)
 {
 #ifdef CONFIG_X86_64
        Elf64_Ehdr ehdr;
@@ -323,13 +323,15 @@ static void parse_elf(void *output)
        }
 
        free(phdrs);
+       return output + (ehdr.e_entry - LOAD_PHYSICAL_ADDR);
 }
 
-asmlinkage void decompress_kernel(void *rmode, memptr heap,
-                                 unsigned char *input_data,
-                                 unsigned long input_len,
-                                 unsigned char *output)
+asmlinkage void *decompress_kernel(void *rmode, memptr heap,
+                                  unsigned char *input_data,
+                                  unsigned long input_len,
+                                  unsigned char *output)
 {
+       void *entry;
        real_mode = rmode;
 
        if (cmdline_find_option_bool("quiet"))
@@ -372,8 +374,8 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
        if (!quiet)
                putstr("\nDecompressing Linux... ");
        decompress(input_data, input_len, NULL, NULL, output, NULL, error);
-       parse_elf(output);
+       entry = parse_elf(output);
        if (!quiet)
                putstr("done.\nBooting the kernel.\n");
-       return;
+       return entry;
 }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to