Back to home page

LXR

 
 

    


0001 #include <linux/kernel.h>
0002 #include <linux/crash_dump.h>
0003 #include <linux/init.h>
0004 #include <linux/errno.h>
0005 #include <linux/export.h>
0006 
0007 /*
0008  * If we have booted due to a crash, max_pfn will be a very low value. We need
0009  * to know the amount of memory that the previous kernel used.
0010  */
0011 unsigned long saved_max_pfn;
0012 
0013 /*
0014  * stores the physical address of elf header of crash image
0015  *
0016  * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
0017  * is_kdump_kernel() to determine if we are booting after a panic. Hence put
0018  * it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
0019  */
0020 unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
0021 EXPORT_SYMBOL_GPL(elfcorehdr_addr);
0022 
0023 /*
0024  * stores the size of elf header of crash image
0025  */
0026 unsigned long long elfcorehdr_size;
0027 
0028 /*
0029  * elfcorehdr= specifies the location of elf core header stored by the crashed
0030  * kernel. This option will be passed by kexec loader to the capture kernel.
0031  *
0032  * Syntax: elfcorehdr=[size[KMG]@]offset[KMG]
0033  */
0034 static int __init setup_elfcorehdr(char *arg)
0035 {
0036     char *end;
0037     if (!arg)
0038         return -EINVAL;
0039     elfcorehdr_addr = memparse(arg, &end);
0040     if (*end == '@') {
0041         elfcorehdr_size = elfcorehdr_addr;
0042         elfcorehdr_addr = memparse(end + 1, &end);
0043     }
0044     return end > arg ? 0 : -EINVAL;
0045 }
0046 early_param("elfcorehdr", setup_elfcorehdr);