summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Chubb <peter.chubb@nicta.com.au>2014-01-16 08:39:06 +1100
committerSimon Horman <horms@verge.net.au>2014-01-16 09:21:52 +0900
commit0780897b8b06fe40234e3d4eac66ce6031145220 (patch)
tree31b0b78869106f15d7f454e06dac5876fbe5d69d
parentfbd61f27cb637d984b0a15e2d711605d28b3043e (diff)
Fix value of mbi->mem_lower for multiboot-x86
In the multiboot header, there is a field, `mem_lower' that is meant to contain the size of memory starting at zero and ending below 640k. If your kernel is compiled with CONFIG_X86_RESERVE_LOW non zero (the usual case), then a hole is inserted into kernel's physical memory map at zero, so the test to find the size of this region in kexec/arch/i386/kexec-multiboot-x86.c never succeeds, so the value is always zero. On a PC99 architecture, there is always memory at physycal address zero; assume that a region that starts below 64k actually starts at zero, and use it for the mem_lower variable. Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/i386/kexec-multiboot-x86.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
index 2f59d7b..fce7f05 100644
--- a/kexec/arch/i386/kexec-multiboot-x86.c
+++ b/kexec/arch/i386/kexec-multiboot-x86.c
@@ -258,10 +258,18 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
mmap[i].length_high = length >> 32;
if (range[i].type == RANGE_RAM) {
mmap[i].Type = 1; /* RAM */
- /* Is this the "low" memory? */
- if ((range[i].start == 0)
- && (range[i].end > mem_lower))
+ /*
+ * Is this the "low" memory? Can't just test
+ * against zero, because Linux protects (and
+ * hides) the first few pages of physical
+ * memory.
+ */
+
+ if ((range[i].start <= 64*1024)
+ && (range[i].end > mem_lower)) {
+ range[i].start = 0;
mem_lower = range[i].end;
+ }
/* Is this the "high" memory? */
if ((range[i].start <= 0x100000)
&& (range[i].end > mem_upper + 0x100000))