crash_dump.c 646 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * kernel/crash_dump.c - Memory preserving reboot related code.
  4. *
  5. * Created by: Simon Horman <[email protected]>
  6. * Original code moved from kernel/crash.c
  7. * Original code comment copied from the i386 version of this file
  8. */
  9. #include <linux/errno.h>
  10. #include <linux/types.h>
  11. #include <linux/crash_dump.h>
  12. #include <linux/uio.h>
  13. #include <asm/page.h>
  14. ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn,
  15. size_t csize, unsigned long offset)
  16. {
  17. void *vaddr;
  18. if (!csize)
  19. return 0;
  20. vaddr = __va(pfn<<PAGE_SHIFT);
  21. csize = copy_to_iter(vaddr + offset, csize, iter);
  22. return csize;
  23. }