]> git.itanic.dy.fi Git - scan-pagemap/blob - pagemap.h
parser: Increment refcount for each pageframe
[scan-pagemap] / pagemap.h
1 #ifndef _PAGEMAP_H
2 #define _PAGEMAP_H
3
4 #include "utils.h"
5 #include "list.h"
6 #include "bintree.h"
7
8 #define PAGE_SHIFT      12
9 #define PAGE_SIZE       (2 << PAGE_SHIFT)
10
11 struct maps;
12
13 struct pageframe {
14         struct bintree tree;
15         struct maps *maps;      /* List to mappings which point to this pfn */
16         unsigned long pfn;      /* page frame number */
17         int swap_type;
18         int swap_offset;
19         int page_shift;
20         int page_swapped;
21         int page_present;
22         int refcount;
23 };
24
25 #define tree_to_pageframe(tree_struct)                          \
26         container_of((tree_struct), struct pageframe, tree)
27
28 struct maps {
29         struct list_head list;
30
31         /* Memory segment of a mapping */
32         unsigned long start;
33         unsigned long end;
34         unsigned long size;
35
36         /* Name of the mapping, such as library name or something else */
37         char name[128];
38         int pid; /* Process which address space the mapping belongs to */
39 };
40
41 #define list_to_maps(list_head)                         \
42         container_of((list_head), struct maps, list)
43
44 struct process {
45         struct pageframe *pageframes;
46         struct maps *maps;
47         char *name;
48 };
49
50 #endif