| 1 | // SPDX-License-Identifier: GPL-2.0-only |
|---|---|
| 2 | /* |
| 3 | * arch/arm/kernel/crash_dump.c |
| 4 | * |
| 5 | * Copyright (C) 2010 Nokia Corporation. |
| 6 | * Author: Mika Westerberg |
| 7 | * |
| 8 | * This code is taken from arch/x86/kernel/crash_dump_64.c |
| 9 | * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) |
| 10 | * Copyright (C) IBM Corporation, 2004. All rights reserved |
| 11 | */ |
| 12 | |
| 13 | #include <linux/errno.h> |
| 14 | #include <linux/crash_dump.h> |
| 15 | #include <linux/uaccess.h> |
| 16 | #include <linux/io.h> |
| 17 | #include <linux/uio.h> |
| 18 | |
| 19 | ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, |
| 20 | size_t csize, unsigned long offset) |
| 21 | { |
| 22 | void *vaddr; |
| 23 | |
| 24 | if (!csize) |
| 25 | return 0; |
| 26 | |
| 27 | vaddr = ioremap(__pfn_to_phys(pfn), PAGE_SIZE); |
| 28 | if (!vaddr) |
| 29 | return -ENOMEM; |
| 30 | |
| 31 | csize = copy_to_iter(addr: vaddr + offset, bytes: csize, i: iter); |
| 32 | |
| 33 | iounmap(addr: vaddr); |
| 34 | return csize; |
| 35 | } |
| 36 |
