From 39dd40d3e83acbe8ef2f1465e02e8d3e26e6a21d Mon Sep 17 00:00:00 2001 From: Jay Lan Date: Fri, 19 Sep 2008 19:17:05 -0700 Subject: IA64: better calculate PT_LOAD segment size This patch combines consecutive PL_LOAD segments into one. The end address of the last PL_LOAD segment, calculated by adding p_memsz to p_paddr & rounded up to ELF_PAGE_SIZE, will be the end address of this loaded_segments[] entry. This patch fixes the kdump kernel MCA problem caused by under- allocation of memory and a "kdump broken on ALtix 350" problem reported by Bernhard Walle. Simon, this patch replaces my previous patch I submitted on the underallocation issue. Signed-off-by: Jay Lan Signed-off-by: Simon Horman --- kexec/arch/ia64/crashdump-ia64.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c index 9a9053a..82c95d0 100644 --- a/kexec/arch/ia64/crashdump-ia64.c +++ b/kexec/arch/ia64/crashdump-ia64.c @@ -86,19 +86,20 @@ static void add_loaded_segments_info(struct kexec_info *info, loaded_segments[loaded_segments_num].end = loaded_segments[loaded_segments_num].start; + /* Consolidate consecutive PL_LOAD segments into one. + * The end addr of the last PL_LOAD segment, calculated by + * adding p_memsz to p_paddr & rounded up to ELF_PAGE_SIZE, + * will be the end address of this loaded_segments entry. + */ while (i < ehdr->e_phnum) { phdr = &ehdr->e_phdr[i]; if (phdr->p_type != PT_LOAD) break; - if (loaded_segments[loaded_segments_num].end != - phdr->p_paddr & ~(ELF_PAGE_SIZE-1)) - break; - loaded_segments[loaded_segments_num].end += - (phdr->p_memsz + ELF_PAGE_SIZE - 1) & - ~(ELF_PAGE_SIZE - 1); + loaded_segments[loaded_segments_num].end = + (phdr->p_paddr + phdr->p_memsz + + ELF_PAGE_SIZE - 1) & ~(ELF_PAGE_SIZE - 1); i++; } - loaded_segments_num++; } } -- cgit