-
-
Notifications
You must be signed in to change notification settings - Fork 847
Commit 02c01c8
committed
Refactor memory subsystem code
This patch refactors big chunks of the memory subsystem code.
Most of all, it does away with the the design being based around the raw pointer
type "*const Page". While raw pointers to an actual page seemed like a
compelling idea, in practice it turned out difficult. Rust feels a bit
inconsistent with respect to raw pointers. While it is safe to create them out
of nowhere (only dereferencing is unsafe), it gets weird when multi-threading
comes into picture.
For example, wrapping them into synchronization primitives caused issues because
they don't implement Send. For this reason, we switch to the PageAddress type
which is based on usize, which makes things a lot easier.
Other changes/benefits include:
- Gets rid of unsafe code in the removed PageSlice type.
- Decouple the translation table code and MMIO VA allocation.
- For the translation table tool, make better use of what the ELF format already
provides with respect to memory segmentation and translation. For example, the
tool now queries the ELF file for VA->PA translations and other segment
attributes. This has also the added benefit of reduced BSP code and more
generic code in the tool.
- Packs rbelftools in the Docker image now (used by translation table tool).
- In tutorials 14/15/16, rearrange the PA and VA layout.1 parent 89472ab commit 02c01c8
File tree
115 files changed
+5926
-3764
lines changed- 01_wait_forever/src/bsp/raspberrypi
- 02_runtime_init
- src/bsp/raspberrypi
- 03_hacky_hello_world/src/bsp/raspberrypi
- 04_safe_globals/src/bsp/raspberrypi
- 05_drivers_gpio_uart/src/bsp/raspberrypi
- 06_uart_chainloader
- src/bsp/raspberrypi
- 07_timestamps
- src/bsp/raspberrypi
- 08_hw_debug_JTAG/src/bsp/raspberrypi
- 09_privilege_level/src/bsp/raspberrypi
- 10_virtual_mem_part1_identity_mapping
- src/bsp/raspberrypi
- memory
- 11_exceptions_part1_groundwork
- src/bsp/raspberrypi
- memory
- 12_integrated_testing/src/bsp/raspberrypi
- memory
- 13_exceptions_part2_peripheral_IRQs
- src/bsp/raspberrypi
- memory
- 14_virtual_mem_part2_mmio_remap
- src
- _arch/aarch64/memory
- mmu
- bsp
- device_driver
- arm
- bcm
- bcm2xxx_interrupt_controller
- raspberrypi
- memory
- memory
- mmu
- tests
- 15_virtual_mem_part3_precomputed_tables
- src
- _arch/aarch64
- cpu
- memory
- mmu
- bsp
- device_driver
- arm
- bcm
- bcm2xxx_interrupt_controller
- raspberrypi
- memory
- memory
- mmu
- tests
- translation_table_tool
- 16_virtual_mem_part4_higher_half_kernel
- src
- _arch/aarch64
- cpu
- memory
- mmu
- bsp
- device_driver
- arm
- bcm
- bcm2xxx_interrupt_controller
- raspberrypi
- memory
- memory
- mmu
- tests
- translation_table_tool
- X1_JTAG_boot/src/bsp/raspberrypi
- common
- docker/rustembedded-osdev-utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
115 files changed
+5926
-3764
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 | + | ||
20 | + | ||
21 | + | ||
19 | 22 |
| |
20 | 23 |
| |
21 | 24 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
7 | - | ||
6 | + | ||
7 | + | ||
8 | 8 |
| |
9 | - | ||
10 | 9 |
| |
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
11 | 17 |
| |
12 | 18 |
| |
13 | - | ||
19 | + | ||
14 | 20 |
| |
15 | 21 |
| |
16 | 22 |
| |
17 | 23 |
| |
18 | - | ||
24 | + | ||
19 | 25 |
| |
20 | 26 |
| |
21 | 27 |
| |
22 | 28 |
| |
23 | 29 |
| |
24 | 30 |
| |
25 | 31 |
| |
26 | - | ||
32 | + | ||
27 | 33 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
200 | 200 |
| |
201 | 201 |
| |
202 | 202 |
| |
203 | - | ||
203 | + | ||
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | ||
215 | + | ||
216 | + | ||
217 | + | ||
218 | + | ||
219 | + | ||
204 | 220 |
| |
205 | 221 |
| |
206 | - | ||
207 | - | ||
222 | + | ||
223 | + | ||
224 | + | ||
225 | + | ||
208 | 226 |
| |
209 | 227 |
| |
210 | 228 |
| |
211 | 229 |
| |
212 | - | ||
213 | - | ||
214 | - | ||
215 | - | ||
216 | - | ||
217 | - | ||
230 | + | ||
231 | + | ||
232 | + | ||
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | ||
237 | + | ||
238 | + | ||
239 | + | ||
240 | + | ||
241 | + | ||
242 | + | ||
243 | + | ||
218 | 244 |
| |
219 | 245 |
| |
220 | 246 |
| |
| |||
226 | 252 |
| |
227 | 253 |
| |
228 | 254 |
| |
229 | - | ||
255 | + | ||
230 | 256 |
| |
231 | - | ||
232 | - | ||
257 | + | ||
258 | + | ||
233 | 259 |
| |
234 | 260 |
| |
235 | 261 |
| |
236 | 262 |
| |
237 | - | ||
263 | + | ||
238 | 264 |
| |
239 | 265 |
| |
240 | - | ||
266 | + | ||
241 | 267 |
| |
242 | 268 |
| |
243 | 269 |
| |
244 | 270 |
| |
245 | 271 |
| |
246 | - | ||
272 | + | ||
247 | 273 |
| |
248 | 274 |
| |
249 | 275 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
7 | - | ||
6 | + | ||
8 | 7 |
| |
9 | - | ||
8 | + | ||
9 | + | ||
10 | 10 |
| |
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
11 | 22 |
| |
12 | 23 |
| |
13 | - | ||
14 | - | ||
24 | + | ||
25 | + | ||
26 | + | ||
15 | 27 |
| |
16 | 28 |
| |
17 | 29 |
| |
18 | 30 |
| |
19 | - | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | - | ||
24 | - | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
25 | 44 |
| |
26 | 45 |
| |
27 | 46 |
| |
| |||
32 | 51 |
| |
33 | 52 |
| |
34 | 53 |
| |
35 | - | ||
54 | + | ||
36 | 55 |
| |
37 | - | ||
38 | - | ||
56 | + | ||
57 | + | ||
39 | 58 |
| |
40 | 59 |
| |
41 | 60 |
| |
42 | 61 |
| |
43 | - | ||
62 | + | ||
44 | 63 |
| |
45 | 64 |
| |
46 | - | ||
65 | + | ||
47 | 66 |
| |
48 | 67 |
| |
49 | 68 |
| |
50 | 69 |
| |
51 | 70 |
| |
52 | - | ||
71 | + | ||
53 | 72 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
7 | - | ||
6 | + | ||
8 | 7 |
| |
9 | - | ||
8 | + | ||
9 | + | ||
10 | 10 |
| |
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
11 | 22 |
| |
12 | 23 |
| |
13 | - | ||
14 | - | ||
24 | + | ||
25 | + | ||
26 | + | ||
15 | 27 |
| |
16 | 28 |
| |
17 | 29 |
| |
18 | 30 |
| |
19 | - | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | - | ||
24 | - | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
25 | 44 |
| |
26 | 45 |
| |
27 | 46 |
| |
| |||
32 | 51 |
| |
33 | 52 |
| |
34 | 53 |
| |
35 | - | ||
54 | + | ||
36 | 55 |
| |
37 | - | ||
38 | - | ||
56 | + | ||
57 | + | ||
39 | 58 |
| |
40 | 59 |
| |
41 | 60 |
| |
42 | 61 |
| |
43 | - | ||
62 | + | ||
44 | 63 |
| |
45 | 64 |
| |
46 | - | ||
65 | + | ||
47 | 66 |
| |
48 | 67 |
| |
49 | 68 |
| |
50 | 69 |
| |
51 | 70 |
| |
52 | - | ||
71 | + | ||
53 | 72 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
7 | - | ||
6 | + | ||
8 | 7 |
| |
9 | - | ||
8 | + | ||
9 | + | ||
10 | 10 |
| |
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
11 | 22 |
| |
12 | 23 |
| |
13 | - | ||
14 | - | ||
24 | + | ||
25 | + | ||
26 | + | ||
15 | 27 |
| |
16 | 28 |
| |
17 | 29 |
| |
18 | 30 |
| |
19 | - | ||
20 | - | ||
21 | - | ||
22 | - | ||
23 | - | ||
24 | - | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
25 | 44 |
| |
26 | 45 |
| |
27 | 46 |
| |
| |||
32 | 51 |
| |
33 | 52 |
| |
34 | 53 |
| |
35 | - | ||
54 | + | ||
36 | 55 |
| |
37 | - | ||
38 | - | ||
56 | + | ||
57 | + | ||
39 | 58 |
| |
40 | 59 |
| |
41 | 60 |
| |
42 | 61 |
| |
43 | - | ||
62 | + | ||
44 | 63 |
| |
45 | 64 |
| |
46 | - | ||
65 | + | ||
47 | 66 |
| |
48 | 67 |
| |
49 | 68 |
| |
50 | 69 |
| |
51 | 70 |
| |
52 | - | ||
71 | + | ||
53 | 72 |
|
0 commit comments