diff options
Diffstat (limited to 'arch/i386/boot/compressed/head.S')
-rw-r--r-- | arch/i386/boot/compressed/head.S | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/arch/i386/boot/compressed/head.S b/arch/i386/boot/compressed/head.S index e4dd7a6b9b0f..f395a4bb38bb 100644 --- a/arch/i386/boot/compressed/head.S +++ b/arch/i386/boot/compressed/head.S | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/linkage.h> | 26 | #include <linux/linkage.h> |
27 | #include <asm/segment.h> | 27 | #include <asm/segment.h> |
28 | #include <asm/page.h> | 28 | #include <asm/page.h> |
29 | #include <asm/boot.h> | ||
29 | 30 | ||
30 | .section ".text.head" | 31 | .section ".text.head" |
31 | .globl startup_32 | 32 | .globl startup_32 |
@@ -52,17 +53,17 @@ startup_32: | |||
52 | 1: popl %ebp | 53 | 1: popl %ebp |
53 | subl $1b, %ebp | 54 | subl $1b, %ebp |
54 | 55 | ||
55 | /* Compute the delta between where we were compiled to run at | 56 | /* %ebp contains the address we are loaded at by the boot loader and %ebx |
56 | * and where the code will actually run at. | 57 | * contains the address where we should move the kernel image temporarily |
58 | * for safe in-place decompression. | ||
57 | */ | 59 | */ |
58 | /* Start with the delta to where the kernel will run at. If we are | 60 | |
59 | * a relocatable kernel this is the delta to our load address otherwise | ||
60 | * this is the delta to CONFIG_PHYSICAL start. | ||
61 | */ | ||
62 | #ifdef CONFIG_RELOCATABLE | 61 | #ifdef CONFIG_RELOCATABLE |
63 | movl %ebp, %ebx | 62 | movl %ebp, %ebx |
63 | addl $(CONFIG_PHYSICAL_ALIGN - 1), %ebx | ||
64 | andl $(~(CONFIG_PHYSICAL_ALIGN - 1)), %ebx | ||
64 | #else | 65 | #else |
65 | movl $(CONFIG_PHYSICAL_START - startup_32), %ebx | 66 | movl $LOAD_PHYSICAL_ADDR, %ebx |
66 | #endif | 67 | #endif |
67 | 68 | ||
68 | /* Replace the compressed data size with the uncompressed size */ | 69 | /* Replace the compressed data size with the uncompressed size */ |
@@ -94,9 +95,10 @@ startup_32: | |||
94 | /* Compute the kernel start address. | 95 | /* Compute the kernel start address. |
95 | */ | 96 | */ |
96 | #ifdef CONFIG_RELOCATABLE | 97 | #ifdef CONFIG_RELOCATABLE |
97 | leal startup_32(%ebp), %ebp | 98 | addl $(CONFIG_PHYSICAL_ALIGN - 1), %ebp |
99 | andl $(~(CONFIG_PHYSICAL_ALIGN - 1)), %ebp | ||
98 | #else | 100 | #else |
99 | movl $CONFIG_PHYSICAL_START, %ebp | 101 | movl $LOAD_PHYSICAL_ADDR, %ebp |
100 | #endif | 102 | #endif |
101 | 103 | ||
102 | /* | 104 | /* |
@@ -150,8 +152,8 @@ relocated: | |||
150 | * and where it was actually loaded. | 152 | * and where it was actually loaded. |
151 | */ | 153 | */ |
152 | movl %ebp, %ebx | 154 | movl %ebp, %ebx |
153 | subl $CONFIG_PHYSICAL_START, %ebx | 155 | subl $LOAD_PHYSICAL_ADDR, %ebx |
154 | 156 | jz 2f /* Nothing to be done if loaded at compiled addr. */ | |
155 | /* | 157 | /* |
156 | * Process relocations. | 158 | * Process relocations. |
157 | */ | 159 | */ |