-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglobals.h
61 lines (35 loc) · 1.35 KB
/
globals.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef GLOBALS_H
#define GLOBALS_H
#define DEBUG
// define to use bit flip simulation through /dev/mem
//#define SIMULATE
//#define FLUSH
//#define USE_HUGEPAGES
//#define USE_VFORK
extern int g_flip_offset;
// Which bit in the 64-bit PTE to flip.
extern const int g_test_bit_to_flip; // Bit 8 in the physical page number.
extern uintptr_t g_victim_phys_addr;
extern uint64_t *g_filler_mem;
extern int g_flip_offset;
extern int g_temp_file_fd;
extern size_t g_file_size;
extern int g_spraying_pagetables;
extern uint8_t *g_aggr[4];
extern uint64_t *g_shared_page;
extern int g_flush_step;
// we need three children, each one can create 1GB of page tables
extern int g_child_id;
extern const int g_child_count;
extern int g_child_pids[1];
extern int g_write_pipes[1][2];
extern int g_read_pipes[1][2];
extern void **g_file_mappings;
extern FILE *g_output_file;
int hammer_victim(int simulate, volatile uint8_t *aggr[4], uint8_t pattern, int try_pattern = 0);
int spray_page_tables(int iterations);
void flush_tlb(int iterations, int step = 1, bool safe = true);
void check_mappings(int iterations, uint64_t **page_table, void **virtual_target, char quiet);
uint64_t *find_access_address(uint64_t *page_table, int iterations);
void dump_memory(volatile uint64_t *access_address, uint64_t *page_table, int iterations, bool screen = true);
#endif //GLOBALS_H