File tree 23 files changed +77
-43
lines changed
04_zero_overhead_abstraction
05_safe_globals/src/_arch/aarch64
09_hw_debug_JTAG/src/_arch/aarch64
11_virtual_mem_part1_identity_mapping/src/_arch/aarch64
12_exceptions_part1_groundwork/src/_arch/aarch64
14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64
15_virtual_mem_part2_mmio_remap
23 files changed +77
-43
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu/smp.rs 04_zero_overhead_abs
53
53
diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs
54
54
--- 03_hacky_hello_world/src/_arch/aarch64/cpu.rs
55
55
+++ 04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs
56
- @@ -4,8 +4,34 @@
56
+ @@ -4,8 +4,35 @@
57
57
58
58
//! Architectural processor code.
59
59
@@ -72,8 +72,9 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstrac
72
72
+ ///
73
73
+ /// # Safety
74
74
+ ///
75
- + /// - Linker script must ensure to place this function at `0x80_000`.
76
- + #[naked]
75
+ + /// - Linker script must ensure to place this function where it is expected by the target machine.
76
+ + /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
77
+ + /// actually set (`SP.set()`).
77
78
+ #[no_mangle]
78
79
+ pub unsafe fn _start() -> ! {
79
80
+ use crate::runtime_init;
@@ -90,7 +91,7 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstrac
90
91
91
92
//--------------------------------------------------------------------------------------------------
92
93
// Public Code
93
- @@ -14,13 +40 ,7 @@
94
+ @@ -14,13 +41 ,7 @@
94
95
/// Pause execution on the core.
95
96
#[inline(always)]
96
97
pub fn wait_forever() -> ! {
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
22
+ /// actually set (`SP.set()`).
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
22
+ /// actually set (`SP.set()`).
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile
183
183
diff -uNr 05_safe_globals/src/_arch/aarch64/cpu.rs 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
184
184
--- 05_safe_globals/src/_arch/aarch64/cpu.rs
185
185
+++ 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
186
- @@ -37 ,6 +37 ,17 @@
186
+ @@ -38 ,6 +38 ,17 @@
187
187
// Public Code
188
188
//--------------------------------------------------------------------------------------------------
189
189
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
22
+ /// actually set (`SP.set()`).
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -179,8 +179,8 @@ diff -uNr 06_drivers_gpio_uart/Makefile 07_uart_chainloader/Makefile
179
179
diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs 07_uart_chainloader/src/_arch/aarch64/cpu.rs
180
180
--- 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
181
181
+++ 07_uart_chainloader/src/_arch/aarch64/cpu.rs
182
- @@ -21 ,12 +21 ,12 @@
183
- #[naked]
182
+ @@ -22 ,12 +22 ,12 @@
183
+ /// actually set (`SP.set()`).
184
184
#[no_mangle]
185
185
pub unsafe fn _start() -> ! {
186
186
- use crate::runtime_init;
@@ -194,7 +194,7 @@ diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs 07_uart_chainloader/src/
194
194
} else {
195
195
// If not core0, infinitely wait for events.
196
196
wait_forever()
197
- @@ -55 ,3 +55 ,19 @@
197
+ @@ -56 ,3 +56 ,19 @@
198
198
asm::wfe()
199
199
}
200
200
}
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
22
+ /// actually set (`SP.set()`).
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
use crate :: relocate;
Original file line number Diff line number Diff line change @@ -115,8 +115,8 @@ diff -uNr 07_uart_chainloader/Makefile 08_timestamps/Makefile
115
115
diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/aarch64/cpu.rs
116
116
--- 07_uart_chainloader/src/_arch/aarch64/cpu.rs
117
117
+++ 08_timestamps/src/_arch/aarch64/cpu.rs
118
- @@ -21 ,12 +21 ,12 @@
119
- #[naked]
118
+ @@ -22 ,12 +22 ,12 @@
119
+ /// actually set (`SP.set()`).
120
120
#[no_mangle]
121
121
pub unsafe fn _start() -> ! {
122
122
- use crate::relocate;
@@ -130,7 +130,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/a
130
130
} else {
131
131
// If not core0, infinitely wait for events.
132
132
wait_forever()
133
- @@ -39 ,15 +39 ,6 @@
133
+ @@ -40 ,15 +40 ,6 @@
134
134
135
135
pub use asm::nop;
136
136
@@ -146,7 +146,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/a
146
146
/// Pause execution on the core.
147
147
#[inline(always)]
148
148
pub fn wait_forever() -> ! {
149
- @@ -55 ,19 +46 ,3 @@
149
+ @@ -56 ,19 +47 ,3 @@
150
150
asm::wfe()
151
151
}
152
152
}
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
22
+ /// actually set (`SP.set()`).
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
22
+ /// actually set (`SP.set()`).
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -225,8 +225,14 @@ Minipush 1.0
225
225
diff -uNr 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs 10_privilege_level/src/_arch/aarch64/cpu.rs
226
226
--- 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs
227
227
+++ 10_privilege_level/src/_arch/aarch64/cpu.rs
228
- @@ -21,18 +21,59 @@
229
- #[naked]
228
+ @@ -18,22 +18,65 @@
229
+ /// # Safety
230
+ ///
231
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
232
+ - /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
233
+ - /// actually set (`SP.set()`).
234
+ + /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
235
+ + /// a stack for EL2.
230
236
#[no_mangle]
231
237
pub unsafe fn _start() -> ! {
232
238
- use crate::runtime_init;
@@ -252,6 +258,8 @@ diff -uNr 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs 10_privilege_level/src/_arch
252
258
+ /// - The HW state of EL1 must be prepared in a sound way.
253
259
+ /// - Exception return from EL2 must must continue execution in EL1 with
254
260
+ /// `runtime_init::runtime_init()`.
261
+ + /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
262
+ + /// a stack for EL2.
255
263
+ #[inline(always)]
256
264
+ unsafe fn el2_to_el1_transition() -> ! {
257
265
+ use crate::runtime_init;
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
22
+ /// a stack for EL2.
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
39
40
/// - The HW state of EL1 must be prepared in a sound way.
40
41
/// - Exception return from EL2 must must continue execution in EL1 with
41
42
/// `runtime_init::runtime_init()`.
43
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
44
+ /// a stack for EL2.
42
45
#[ inline( always) ]
43
46
unsafe fn el2_to_el1_transition ( ) -> ! {
44
47
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
22
+ /// a stack for EL2.
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
39
40
/// - The HW state of EL1 must be prepared in a sound way.
40
41
/// - Exception return from EL2 must must continue execution in EL1 with
41
42
/// `runtime_init::runtime_init()`.
43
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
44
+ /// a stack for EL2.
42
45
#[ inline( always) ]
43
46
unsafe fn el2_to_el1_transition ( ) -> ! {
44
47
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
22
+ /// a stack for EL2.
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
39
40
/// - The HW state of EL1 must be prepared in a sound way.
40
41
/// - Exception return from EL2 must must continue execution in EL1 with
41
42
/// `runtime_init::runtime_init()`.
43
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
44
+ /// a stack for EL2.
42
45
#[ inline( always) ]
43
46
unsafe fn el2_to_el1_transition ( ) -> ! {
44
47
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -935,7 +935,7 @@ diff -uNr 12_exceptions_part1_groundwork/Makefile 13_integrated_testing/Makefile
935
935
diff -uNr 12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs 13_integrated_testing/src/_arch/aarch64/cpu.rs
936
936
--- 12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs
937
937
+++ 13_integrated_testing/src/_arch/aarch64/cpu.rs
938
- @@ -87 ,3 +87 ,20 @@
938
+ @@ -90 ,3 +90 ,20 @@
939
939
asm::wfe()
940
940
}
941
941
}
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
22
+ /// a stack for EL2.
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
39
40
/// - The HW state of EL1 must be prepared in a sound way.
40
41
/// - Exception return from EL2 must must continue execution in EL1 with
41
42
/// `runtime_init::runtime_init()`.
43
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
44
+ /// a stack for EL2.
42
45
#[ inline( always) ]
43
46
unsafe fn el2_to_el1_transition ( ) -> ! {
44
47
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
22
+ /// a stack for EL2.
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
39
40
/// - The HW state of EL1 must be prepared in a sound way.
40
41
/// - Exception return from EL2 must must continue execution in EL1 with
41
42
/// `runtime_init::runtime_init()`.
43
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
44
+ /// a stack for EL2.
42
45
#[ inline( always) ]
43
46
unsafe fn el2_to_el1_transition ( ) -> ! {
44
47
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ Minipush 1.0
311
311
diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs 15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs
312
312
--- 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs
313
313
+++ 15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs
314
- @@ -68 ,7 +68 ,7 @@
314
+ @@ -71 ,7 +71 ,7 @@
315
315
ELR_EL2.set(runtime_init::runtime_init as *const () as u64);
316
316
317
317
// Set up SP_EL1 (stack pointer), which will be used by EL1 once we "return" to it.
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
22
+ /// a stack for EL2.
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
39
40
/// - The HW state of EL1 must be prepared in a sound way.
40
41
/// - Exception return from EL2 must must continue execution in EL1 with
41
42
/// `runtime_init::runtime_init()`.
43
+ /// - We have to hope that the compiler omits any stack pointer usage, because we are not setting up
44
+ /// a stack for EL2.
42
45
#[ inline( always) ]
43
46
unsafe fn el2_to_el1_transition ( ) -> ! {
44
47
use crate :: runtime_init;
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
17
17
///
18
18
/// # Safety
19
19
///
20
- /// - Linker script must ensure to place this function at `0x80_000`.
21
- #[ naked]
20
+ /// - Linker script must ensure to place this function where it is expected by the target machine.
21
+ /// - We have to hope that the compiler omits any stack pointer usage before the stack pointer is
22
+ /// actually set (`SP.set()`).
22
23
#[ no_mangle]
23
24
pub unsafe fn _start ( ) -> ! {
24
25
use crate :: runtime_init;
Original file line number Diff line number Diff line change 1
1
[toolchain]
2
- channel = "nightly-2020-12-08 "
2
+ channel = "nightly-2020-12-09 "
3
3
components = ["llvm-tools-preview"]
4
4
targets = ["aarch64-unknown-none-softfloat"]
You can’t perform that action at this time.
0 commit comments