diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-09-07 11:37:21 -0700 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2010-09-08 11:02:29 -0700 |
commit | 3578b1f1437f8d1b569d1e30f6d4e15edd1cce53 (patch) | |
tree | 66679d79d96385fef104a734f881c044d3351b5d /kexec/arch/x86_64 | |
parent | 3cab31db10dd74aa148ad20aaa3455723bf45138 (diff) |
x86_64 crashdump: Move calculation of the page offset into crashdump-x86_64.c
Don't calculate page_offfset in arch_init. Performing the work there
badly messes up biarch support, so move the work into crashdump_x86_64.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kexec/arch/x86_64')
-rw-r--r-- | kexec/arch/x86_64/arch_init.c | 18 | ||||
-rw-r--r-- | kexec/arch/x86_64/crashdump-x86_64.c | 22 | ||||
-rw-r--r-- | kexec/arch/x86_64/crashdump-x86_64.h | 5 |
3 files changed, 23 insertions, 22 deletions
diff --git a/kexec/arch/x86_64/arch_init.c b/kexec/arch/x86_64/arch_init.c index 4cffbf6..bebb92d 100644 --- a/kexec/arch/x86_64/arch_init.c +++ b/kexec/arch/x86_64/arch_init.c @@ -6,25 +6,7 @@ #include <limits.h> #include <stdio.h> -#include "crashdump-x86_64.h" - -#define PAGE_OFFSET_PRE_2_6_27 0xffff810000000000UL -#define PAGE_OFFSET 0xffff880000000000UL - -unsigned long page_offset; - int arch_init(void) { - int kv; - - kv = kernel_version(); - if (kv < 0) - return -1; - - if (kv < KERNEL_VERSION(2, 6, 27)) - page_offset = PAGE_OFFSET_PRE_2_6_27; - else - page_offset = PAGE_OFFSET; - return 0; } diff --git a/kexec/arch/x86_64/crashdump-x86_64.c b/kexec/arch/x86_64/crashdump-x86_64.c index 8b6581b..46f18b9 100644 --- a/kexec/arch/x86_64/crashdump-x86_64.c +++ b/kexec/arch/x86_64/crashdump-x86_64.c @@ -40,6 +40,24 @@ /* Forward Declaration. */ static int exclude_region(int *nr_ranges, uint64_t start, uint64_t end); +static int get_kernel_page_offset(struct kexec_info *info, + struct crash_elf_info *elf_info) +{ + int kv; + + kv = kernel_version(); + if (kv < 0) + return -1; + + if (kv < KERNEL_VERSION(2, 6, 27)) + elf_info->page_offset = PAGE_OFFSET_PRE_2_6_27; + else + elf_info->page_offset = PAGE_OFFSET; + + return 0; +} + + #define KERN_VADDR_ALIGN 0x100000 /* 1MB */ /* Read kernel physical load addr from the file returned by proc_iomem() @@ -602,9 +620,11 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline, machine: EM_X86_64, backup_src_start: BACKUP_SRC_START, backup_src_end: BACKUP_SRC_END, - page_offset: page_offset, }; + if (get_kernel_page_offset(info, &elf_info)) + return -1; + if (get_kernel_paddr(info)) return -1; diff --git a/kexec/arch/x86_64/crashdump-x86_64.h b/kexec/arch/x86_64/crashdump-x86_64.h index 2129104..9392709 100644 --- a/kexec/arch/x86_64/crashdump-x86_64.h +++ b/kexec/arch/x86_64/crashdump-x86_64.h @@ -8,9 +8,8 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline, #define __START_KERNEL_map 0xffffffff80000000UL -extern unsigned long page_offset; - -#define __pa(x) (((unsigned long)(x)>=__START_KERNEL_map)?(unsigned long)(x) - (unsigned long)__START_KERNEL_map:(unsigned long)(x) - page_offset) +#define PAGE_OFFSET_PRE_2_6_27 0xffff810000000000UL +#define PAGE_OFFSET 0xffff880000000000UL #define MAXMEM 0x3fffffffffffUL |