util.h 741 Bytes
Newer Older
Adam Blank's avatar
Adam Blank committed
1
2
3
4
5
6
7
8
9
#ifndef _UTIL_H
#define _UTIL_H

#include <stdint.h>

#define PAGE_SIZE 4096

typedef uint8_t page_t[PAGE_SIZE];

10
11
12
13
14
/**
 * Forces a memory read of the byte at the given address.
 * This will load the byte at the address into the cache.
 */
void force_read(const void *address);
Adam Blank's avatar
Adam Blank committed
15

16
17
18
19
20
/**
 * Evicts any cache line currently storing the given address.
 * This ensures that the byte at the address is no longer in the cache.
 */
void flush_cache_line(const void *address);
Adam Blank's avatar
Adam Blank committed
21

22
23
24
25
26
27
/**
 * Counts the number of processor clocks elapsed when reading a byte at the given address.
 * Note that the number of clocks can be quite large
 * if the process happens to be interrupted in this function.
 */
uint64_t time_read(const void *address);
Adam Blank's avatar
Adam Blank committed
28
29

#endif /* _UTIL_H */