crash_dump.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include <linux/kernel.h>
  2. #include <linux/crash_dump.h>
  3. #include <linux/init.h>
  4. #include <linux/errno.h>
  5. #include <linux/export.h>
  6. /*
  7. * If we have booted due to a crash, max_pfn will be a very low value. We need
  8. * to know the amount of memory that the previous kernel used.
  9. */
  10. unsigned long saved_max_pfn;
  11. /*
  12. * stores the physical address of elf header of crash image
  13. *
  14. * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
  15. * is_kdump_kernel() to determine if we are booting after a panic. Hence put
  16. * it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
  17. */
  18. unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
  19. EXPORT_SYMBOL_GPL(elfcorehdr_addr);
  20. /*
  21. * stores the size of elf header of crash image
  22. */
  23. unsigned long long elfcorehdr_size;
  24. /*
  25. * elfcorehdr= specifies the location of elf core header stored by the crashed
  26. * kernel. This option will be passed by kexec loader to the capture kernel.
  27. *
  28. * Syntax: elfcorehdr=[size[KMG]@]offset[KMG]
  29. */
  30. static int __init setup_elfcorehdr(char *arg)
  31. {
  32. char *end;
  33. if (!arg)
  34. return -EINVAL;
  35. elfcorehdr_addr = memparse(arg, &end);
  36. if (*end == '@') {
  37. elfcorehdr_size = elfcorehdr_addr;
  38. elfcorehdr_addr = memparse(end + 1, &end);
  39. }
  40. return end > arg ? 0 : -EINVAL;
  41. }
  42. early_param("elfcorehdr", setup_elfcorehdr);