forked from GJDuck/e9patch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe9mapping.h
More file actions
49 lines (38 loc) · 1.26 KB
/
e9mapping.h
File metadata and controls
49 lines (38 loc) · 1.26 KB
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
/*
* e9mapping.h
*
* Physical address space allocation and optimization.
*/
#ifndef __E9MAPPING_H
#define __E9MAPPING_H
#include <vector>
#include <cstdint>
#include "e9alloc.h"
/*
* Representation of a mapping.
*/
struct Mapping
{
// Occupancy:
uint64_t key; // Occupancy bitmap key.
intptr_t lb; // Occupancy lower bound.
intptr_t ub; // Occupancy Upper bound.
// Virtual memory:
intptr_t base; // Virtual base address.
size_t size; // Size of mapping in bytes.
Allocator::iterator i; // Virtual memory contents.
int prot; // Protections.
bool preload; // Preload mapping?
// Physical memory:
off_t offset; // Physical file offet.
// Grouping:
Mapping *next; // Next mapping.
Mapping *merged; // Next merged mapping.
};
typedef std::vector<Mapping *> MappingSet;
void buildMappings(const Allocator &allocator, const size_t MAPPING_SIZE,
MappingSet &mappings);
void optimizeMappings(MappingSet &mappings);
void flattenMapping(uint8_t *buf, const Mapping *mapping, uint8_t fill);
void getVirtualBounds(const Mapping *mapping, std::vector<Bounds> &bounds);
#endif