blob: 5885d76206d71bb3afac9612d73a65f221548f81 (
plain)
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
62
63
64
65
|
# Allocator
---
KPL uses `mmap` to allocate slabs of non-executable and executable memory
Once memory is used it is not returned to the OS until KPL exits
## Non-Executable
### Mapping
Two linked list of pages is kept, tracing the size of map and how much is used:
#### Small Page Allocator
For allocations less then a page size `< 2 ^ 12`
#### Large Page Allocator
For allocations a page size or larger `>= 2 ^ 12`
### Object Sizes
Every Object KPL allocates is sized to the next power of 2
Because each power of two requires its own ring buffer, minimum allocation size is `2 ^ 6` and max is `2 ^ 27`
### Ring Buffer Sizes
The total number of objects each ring buffer can store can by modified by MACRO'S at compile time
The program will exit if more objects are allocated then it's corresponding ring buffer can hold
### Ring Buffer Implementation
Each ring buffer is implemented as an atomic multi-producer multi-consumer queue
### Operation
#### Constructor
#### Requesting Objects
#### Returning Objects
#### Destructor
## Executable
### Mapping
A linked list of pages is kept, tracing the size of each map and how much is used
### Operation
#### Constructor
#### Requesting Memory
#### Writing To Memory
#### Making Memory Executable
#### Destructor
|