This source file includes following definitions.
- copy_oldmem_page
- elfcorehdr_read
1
2
3
4
5
6
7
8
9 #include <linux/crash_dump.h>
10 #include <linux/errno.h>
11 #include <linux/io.h>
12 #include <linux/memblock.h>
13 #include <linux/uaccess.h>
14 #include <asm/memory.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28 ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
29 size_t csize, unsigned long offset,
30 int userbuf)
31 {
32 void *vaddr;
33
34 if (!csize)
35 return 0;
36
37 vaddr = memremap(__pfn_to_phys(pfn), PAGE_SIZE, MEMREMAP_WB);
38 if (!vaddr)
39 return -ENOMEM;
40
41 if (userbuf) {
42 if (copy_to_user((char __user *)buf, vaddr + offset, csize)) {
43 memunmap(vaddr);
44 return -EFAULT;
45 }
46 } else {
47 memcpy(buf, vaddr + offset, csize);
48 }
49
50 memunmap(vaddr);
51
52 return csize;
53 }
54
55
56
57
58
59
60
61
62
63
64 ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos)
65 {
66 memcpy(buf, phys_to_virt((phys_addr_t)*ppos), count);
67 return count;
68 }