diff options
author | Vivek Goyal <vgoyal@in.ibm.com> | 2006-12-06 20:14:04 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:04 -0500 |
commit | e69f202d0a1419219198566e1c22218a5c71a9a6 (patch) | |
tree | 16bb59505500797e1ea7e09ee9c3b495ce65b76a /arch/i386/boot/compressed/head.S | |
parent | 6a044b3a0a1829ef19bb29548ffe553f48e8d80c (diff) |
[PATCH] i386: Implement CONFIG_PHYSICAL_ALIGN
o Now CONFIG_PHYSICAL_START is being replaced with CONFIG_PHYSICAL_ALIGN.
Hardcoding the kernel physical start value creates a problem in relocatable
kernel context due to boot loader limitations. For ex, if somebody
compiles a relocatable kernel to be run from address 4MB, but this kernel
will run from location 1MB as grub loads the kernel at physical address
1MB. Kernel thinks that I am a relocatable kernel and I should run from
the address I have been loaded at. So somebody wanting to run kernel
from 4MB alignment location (for improved performance regions) can't do
that.
o Hence, Eric proposed that probably CONFIG_PHYSICAL_ALIGN will make
more sense in relocatable kernel context. At run time kernel will move
itself to a physical addr location which meets user specified alignment
restrictions.
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
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 | */ |