Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
crash_dump.c
Go to the documentation of this file.
1 /*
2  * kernel/crash_dump.c - Memory preserving reboot related code.
3  *
4  * Created by: Simon Horman <[email protected]>
5  * Original code moved from kernel/crash.c
6  * Original code comment copied from the i386 version of this file
7  */
8 
9 #include <linux/errno.h>
10 #include <linux/types.h>
11 #include <linux/crash_dump.h>
12 
13 #include <asm/page.h>
14 #include <asm/uaccess.h>
15 
33 ssize_t
34 copy_oldmem_page(unsigned long pfn, char *buf,
35  size_t csize, unsigned long offset, int userbuf)
36 {
37  void *vaddr;
38 
39  if (!csize)
40  return 0;
41  vaddr = __va(pfn<<PAGE_SHIFT);
42  if (userbuf) {
43  if (copy_to_user(buf, (vaddr + offset), csize)) {
44  return -EFAULT;
45  }
46  } else
47  memcpy(buf, (vaddr + offset), csize);
48  return csize;
49 }
50