Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * arch/arm/kernel/crash_dump.c
0004  *
0005  * Copyright (C) 2010 Nokia Corporation.
0006  * Author: Mika Westerberg
0007  *
0008  * This code is taken from arch/x86/kernel/crash_dump_64.c
0009  *   Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
0010  *   Copyright (C) IBM Corporation, 2004. All rights reserved
0011  */
0012 
0013 #include <linux/errno.h>
0014 #include <linux/crash_dump.h>
0015 #include <linux/uaccess.h>
0016 #include <linux/io.h>
0017 #include <linux/uio.h>
0018 
0019 ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn,
0020              size_t csize, unsigned long offset)
0021 {
0022     void *vaddr;
0023 
0024     if (!csize)
0025         return 0;
0026 
0027     vaddr = ioremap(__pfn_to_phys(pfn), PAGE_SIZE);
0028     if (!vaddr)
0029         return -ENOMEM;
0030 
0031     csize = copy_to_iter(vaddr + offset, csize, iter);
0032 
0033     iounmap(vaddr);
0034     return csize;
0035 }