]> git.itanic.dy.fi Git - scan-pagemap/blob - pagemap.h
Store the process pid to the maps structure
[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         /* Name of the mapping, such as library name or something else */
36         char name[128];
37         int pid; /* Process which address space the mapping belongs to */
38 };
39
40 #define list_to_maps(list_head)                         \
41         container_of((list_head), struct maps, list)
42
43 struct process {
44         struct pageframe *pageframes;
45         struct maps *maps;
46         char *name;
47 };
48
49 #endif