diff options
author | Baoquan He <bhe@redhat.com> | 2016-11-10 15:30:57 +0900 |
---|---|---|
committer | Atsushi Kumagai <ats-kumagai@wm.jp.nec.com> | 2016-11-11 13:46:00 +0900 |
commit | acdbb1d6aee9207ccdea697326574e8d6142cd73 (patch) | |
tree | 2acaacca001b429f7843bfc5ba8bf5f8a1ce0ddf /arch | |
parent | ecb3719bb8d6396b09f47f3710d1c1bbb9515af1 (diff) |
[PATCH v2 1/2] Adapt code to get value of phys_base
* Required for kernel 4.9
Kernel code only exports virtual address of phys_base now and it's helpless
for Crash and Makedumpfile. Below patch which changes code to export value
of phys_base has been posted to upstream. So adapt code to get it.
kexec: Change to export the value of phys_base instead of symbol address
marc.info/?l=linux-kernel&m=147856863629624&w=2
Signed-off-by: Baoquan He <bhe@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86_64.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86_64.c b/arch/x86_64.c index 3ef33ae..010ea10 100644 --- a/arch/x86_64.c +++ b/arch/x86_64.c @@ -62,6 +62,10 @@ get_phys_base_x86_64(void) * Get the relocatable offset */ info->phys_base = 0; /* default/traditional */ + if (NUMBER(phys_base) != NOT_FOUND_NUMBER) { + info->phys_base = NUMBER(phys_base); + return TRUE; + } for (i = 0; get_pt_load(i, &phys_start, NULL, &virt_start, NULL); i++) { if (virt_start >= __START_KERNEL_map) { @@ -187,12 +191,6 @@ vtop4_x86_64(unsigned long vaddr) { unsigned long page_dir, pml4, pgd_paddr, pgd_pte, pmd_paddr, pmd_pte; unsigned long pte_paddr, pte; - unsigned long phys_base; - - if (SYMBOL(phys_base) != NOT_FOUND_SYMBOL) - phys_base = info->phys_base; - else - phys_base = 0; if (SYMBOL(init_level4_pgt) == NOT_FOUND_SYMBOL) { ERRMSG("Can't get the symbol of init_level4_pgt.\n"); @@ -202,7 +200,7 @@ vtop4_x86_64(unsigned long vaddr) /* * Get PGD. */ - page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + phys_base; + page_dir = SYMBOL(init_level4_pgt) - __START_KERNEL_map + info->phys_base; page_dir += pml4_index(vaddr) * sizeof(unsigned long); if (!readmem(PADDR, page_dir, &pml4, sizeof pml4)) { ERRMSG("Can't get pml4 (page_dir:%lx).\n", page_dir); |