From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from lemon.ertos.nicta.com.au ([203.143.174.143]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3YBV-00042V-0E for kexec@lists.infradead.org; Wed, 15 Jan 2014 21:39:38 +0000 Date: Thu, 16 Jan 2014 08:39:06 +1100 Message-ID: <84ppntsz5x.wl%peter.chubb@nicta.com.au> From: Peter Chubb In-Reply-To: <20140115034833.GA30883@verge.net.au> References: <84k3e2lyde.wl%peter.chubb@nicta.com.au> <20140115034833.GA30883@verge.net.au> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: [PATCH] Fix value of mbi->mem_lower for multiboot-x86 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=twosheds.infradead.org@lists.infradead.org To: kexec@lists.infradead.org Cc: Simon Horman , Peter Chubb 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 --- kexec/arch/i386/kexec-multiboot-x86.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) Index: kexec-tools-2.0.4/kexec/arch/i386/kexec-multiboot-x86.c =================================================================== --- kexec-tools-2.0.4.orig/kexec/arch/i386/kexec-multiboot-x86.c 2013-03-14 18:45:16.000000000 +1000 +++ kexec-tools-2.0.4/kexec/arch/i386/kexec-multiboot-x86.c 2014-01-15 10:21:02.138172304 +1000 @@ -261,10 +261,18 @@ int multiboot_x86_load(int argc, char ** 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)) -- Dr Peter Chubb peter.chubb AT nicta.com.au http://www.ssrg.nicta.com.au Software Systems Research Group/NICTA _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec