]> git.itanic.dy.fi Git - scan-pagemap/blob - pagemap.h
Initial commit
[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 };
23
24 #define tree_to_pageframe(tree_struct)                          \
25         container_of((tree_struct), struct pageframe, tree)
26
27 struct maps {
28         struct list_head list;
29
30         /* Memory segment of a mapping */
31         unsigned long start;
32         unsigned long end;
33         unsigned long size;
34
35         /*
36          * Name of the mapping, such as library name or something else
37          */
38         char name[128];
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