crash_dump.c 1.1 KB

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