1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * /proc/kcore definitions
4  */
5 #ifndef _LINUX_KCORE_H
6 #define _LINUX_KCORE_H
7 
8 enum kcore_type {
9 	KCORE_TEXT,
10 	KCORE_VMALLOC,
11 	KCORE_RAM,
12 	KCORE_VMEMMAP,
13 	KCORE_USER,
14 	KCORE_OTHER,
15 	KCORE_REMAP,
16 };
17 
18 struct kcore_list {
19 	struct list_head list;
20 	unsigned long addr;
21 	unsigned long vaddr;
22 	size_t size;
23 	int type;
24 };
25 
26 struct vmcore {
27 	struct list_head list;
28 	unsigned long long paddr;
29 	unsigned long long size;
30 	loff_t offset;
31 };
32 
33 struct vmcoredd_node {
34 	struct list_head list;	/* List of dumps */
35 	void *buf;		/* Buffer containing device's dump */
36 	unsigned int size;	/* Size of the buffer */
37 };
38 
39 #ifdef CONFIG_PROC_KCORE
40 void __init kclist_add(struct kcore_list *, void *, size_t, int type);
41 static inline
kclist_add_remap(struct kcore_list * m,void * addr,void * vaddr,size_t sz)42 void kclist_add_remap(struct kcore_list *m, void *addr, void *vaddr, size_t sz)
43 {
44 	m->vaddr = (unsigned long)vaddr;
45 	kclist_add(m, addr, sz, KCORE_REMAP);
46 }
47 
48 extern int __init register_mem_pfn_is_ram(int (*fn)(unsigned long pfn));
49 #else
50 static inline
kclist_add(struct kcore_list * new,void * addr,size_t size,int type)51 void kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
52 {
53 }
54 
55 static inline
kclist_add_remap(struct kcore_list * m,void * addr,void * vaddr,size_t sz)56 void kclist_add_remap(struct kcore_list *m, void *addr, void *vaddr, size_t sz)
57 {
58 }
59 #endif
60 
61 #endif /* _LINUX_KCORE_H */
62