1 // SPDX-License-Identifier: GPL-2.0-only
3 * Routines for doing kexec-based kdump
5 * Copyright (C) 2017 Linaro Limited
6 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
9 #include <linux/crash_dump.h>
10 #include <linux/errno.h>
12 #include <linux/uio.h>
13 #include <asm/memory.h>
15 ssize_t
copy_oldmem_page(struct iov_iter
*iter
, unsigned long pfn
,
16 size_t csize
, unsigned long offset
)
23 vaddr
= memremap(__pfn_to_phys(pfn
), PAGE_SIZE
, MEMREMAP_WB
);
27 csize
= copy_to_iter(vaddr
+ offset
, csize
, iter
);
35 * elfcorehdr_read - read from ELF core header
36 * @buf: buffer where the data is placed
37 * @count: number of bytes to read
38 * @ppos: address in the memory
40 * This function reads @count bytes from elf core header which exists
41 * on crash dump kernel's memory.
43 ssize_t
elfcorehdr_read(char *buf
, size_t count
, u64
*ppos
)
45 memcpy(buf
, phys_to_virt((phys_addr_t
)*ppos
), count
);