summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-09-07 12:05:40 -0700
committerSimon Horman <horms@verge.net.au>2010-09-09 17:02:48 +0900
commitedde04f854800eeed21d29a733aca0abc20990eb (patch)
treee82fefcbc6033d36d5d283cfaa04fcb4b18ec645
parentd9bf000b6260ee4558b2d2eb3af08e09cd1fe794 (diff)
crashdump: Move kern_vaddr_start from kexec_info into crash_elf_info
These fields as defined in kexec_info are not biarch safe and beyond that crash_elf_info is the structure for passing this kind of information not kexec_info. So move them in prepartion for properly cleaning up biarch x86 functionality. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> [ horms@verge.net.au: converted stray elf_info-> to elf_info. ] Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/ia64/crashdump-ia64.c6
-rw-r--r--kexec/arch/x86_64/crashdump-x86_64.c16
-rw-r--r--kexec/crashdump-elf.c14
-rw-r--r--kexec/crashdump.h3
-rw-r--r--kexec/kexec.h3
5 files changed, 22 insertions, 20 deletions
diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c
index 6b64271..8932395 100644
--- a/kexec/arch/ia64/crashdump-ia64.c
+++ b/kexec/arch/ia64/crashdump-ia64.c
@@ -238,7 +238,7 @@ int load_crashdump_segments(struct kexec_info *info, struct mem_ehdr *ehdr,
get_crash_memory_ranges(&nr_ranges) == 0) {
int i;
- info->kern_paddr_start = kernel_code_start;
+ elf_info.kern_paddr_start = kernel_code_start;
for (i=0; i < nr_ranges; i++) {
unsigned long long mstart = crash_memory_range[i].start;
unsigned long long mend = crash_memory_range[i].end;
@@ -246,11 +246,11 @@ int load_crashdump_segments(struct kexec_info *info, struct mem_ehdr *ehdr,
continue;
if (kernel_code_start >= mstart &&
kernel_code_start < mend) {
- info->kern_vaddr_start = mstart + LOAD_OFFSET;
+ elf_info.kern_vaddr_start = mstart + LOAD_OFFSET;
break;
}
}
- info->kern_size = kernel_code_end - kernel_code_start + 1;
+ elf_info.kern_size = kernel_code_end - kernel_code_start + 1;
if (crash_create_elf64_headers(info, &elf_info,
crash_memory_range, nr_ranges,
&tmp, &sz, EFI_PAGE_SIZE) < 0)
diff --git a/kexec/arch/x86_64/crashdump-x86_64.c b/kexec/arch/x86_64/crashdump-x86_64.c
index 46f18b9..a6ad89c 100644
--- a/kexec/arch/x86_64/crashdump-x86_64.c
+++ b/kexec/arch/x86_64/crashdump-x86_64.c
@@ -62,7 +62,8 @@ static int get_kernel_page_offset(struct kexec_info *info,
/* Read kernel physical load addr from the file returned by proc_iomem()
* (Kernel Code) and store in kexec_info */
-static int get_kernel_paddr(struct kexec_info *info)
+static int get_kernel_paddr(struct kexec_info *info,
+ struct crash_elf_info *elf_info)
{
uint64_t start;
@@ -70,7 +71,7 @@ static int get_kernel_paddr(struct kexec_info *info)
return 0;
if (parse_iomem_single("Kernel code\n", &start, NULL) == 0) {
- info->kern_paddr_start = start;
+ elf_info->kern_paddr_start = start;
#ifdef DEBUG
printf("kernel load physical addr start = 0x%016Lx\n", start);
#endif
@@ -88,7 +89,8 @@ static int get_kernel_paddr(struct kexec_info *info)
* hard codes the values to remain backward compatible. Once things stablize
* we should get rid of backward compatible code. */
-static int get_kernel_vaddr_and_size(struct kexec_info *info)
+static int get_kernel_vaddr_and_size(struct kexec_info *info,
+ struct crash_elf_info *elf_info)
{
int result;
const char kcore[] = "/proc/kcore";
@@ -135,11 +137,11 @@ static int get_kernel_vaddr_and_size(struct kexec_info *info)
if ((saddr >= __START_KERNEL_map) &&
(eaddr <= __START_KERNEL_map + KERNEL_TEXT_SIZE)) {
saddr = (saddr) & (~(KERN_VADDR_ALIGN - 1));
- info->kern_vaddr_start = saddr;
+ elf_info->kern_vaddr_start = saddr;
size = eaddr - saddr;
/* Align size to page size boundary. */
size = (size + align - 1) & (~(align - 1));
- info->kern_size = size;
+ elf_info->kern_size = size;
#ifdef DEBUG
printf("kernel vaddr = 0x%lx size = 0x%lx\n",
saddr, size);
@@ -625,10 +627,10 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
if (get_kernel_page_offset(info, &elf_info))
return -1;
- if (get_kernel_paddr(info))
+ if (get_kernel_paddr(info, &elf_info))
return -1;
- if (get_kernel_vaddr_and_size(info))
+ if (get_kernel_vaddr_and_size(info, &elf_info))
return -1;
if (get_crash_memory_ranges(&mem_range, &nr_ranges,
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
index f000e42..954d670 100644
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -68,7 +68,7 @@ int FUNC(struct kexec_info *info,
/*
* Certain architectures such as x86_64 and ia64 require a separate
* PT_LOAD program header for the kernel. This is controlled through
- * info->kern_size.
+ * elf_info->kern_size.
*
* The separate PT_LOAD program header is required either because the
* kernel is mapped at a different location than the rest of the
@@ -85,7 +85,7 @@ int FUNC(struct kexec_info *info,
* PT_LOAD program header and in the physical RAM program headers.
*/
- if (info->kern_size && !xen_present()) {
+ if (elf_info->kern_size && !xen_present()) {
sz += sizeof(PHDR);
}
@@ -195,17 +195,17 @@ int FUNC(struct kexec_info *info,
}
/* Setup an PT_LOAD type program header for the region where
- * Kernel is mapped if info->kern_size is non-zero.
+ * Kernel is mapped if elf_info->kern_size is non-zero.
*/
- if (info->kern_size && !xen_present()) {
+ if (elf_info->kern_size && !xen_present()) {
phdr = (PHDR *) bufp;
bufp += sizeof(PHDR);
phdr->p_type = PT_LOAD;
phdr->p_flags = PF_R|PF_W|PF_X;
- phdr->p_offset = phdr->p_paddr = info->kern_paddr_start;
- phdr->p_vaddr = info->kern_vaddr_start;
- phdr->p_filesz = phdr->p_memsz = info->kern_size;
+ phdr->p_offset = phdr->p_paddr = elf_info->kern_paddr_start;
+ phdr->p_vaddr = elf_info->kern_vaddr_start;
+ phdr->p_filesz = phdr->p_memsz = elf_info->kern_size;
phdr->p_align = 0;
(elf->e_phnum)++;
dbgprintf_phdr("Kernel text Elf header", phdr);
diff --git a/kexec/crashdump.h b/kexec/crashdump.h
index 31f711c..eccdb9f 100644
--- a/kexec/crashdump.h
+++ b/kexec/crashdump.h
@@ -27,6 +27,9 @@ struct crash_elf_info {
unsigned long backup_src_end;
unsigned long long page_offset;
+ unsigned long long kern_vaddr_start;
+ unsigned long long kern_paddr_start;
+ unsigned long kern_size;
unsigned long lowmem_limit;
int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 6a8a345..9a70224 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -122,9 +122,6 @@ struct kexec_info {
struct mem_ehdr rhdr;
unsigned long backup_start;
unsigned long kexec_flags;
- unsigned long kern_vaddr_start;
- unsigned long kern_paddr_start;
- unsigned long kern_size;
};
struct arch_map_entry {