Skip to content

Commit d212348

Browse files
committed
Bump compiler version.
We have to remove the `#[naked]` attribute from `_start` for now, since it emits a warning now when used with non-asm statements in the function body. For now, just hope for the compiler's mercy to not emit code using the stack pointer before we've actually set up a stack.
1 parent d2fd491 commit d212348

File tree

23 files changed

+77
-43
lines changed

23 files changed

+77
-43
lines changed

04_zero_overhead_abstraction/README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu/smp.rs 04_zero_overhead_abs
5353
diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs
5454
--- 03_hacky_hello_world/src/_arch/aarch64/cpu.rs
5555
+++ 04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs
56-
@@ -4,8 +4,34 @@
56+
@@ -4,8 +4,35 @@
5757

5858
//! Architectural processor code.
5959

@@ -72,8 +72,9 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstrac
7272
+///
7373
+/// # Safety
7474
+///
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()`).
7778
+#[no_mangle]
7879
+pub unsafe fn _start() -> ! {
7980
+ use crate::runtime_init;
@@ -90,7 +91,7 @@ diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu.rs 04_zero_overhead_abstrac
9091

9192
//--------------------------------------------------------------------------------------------------
9293
// Public Code
93-
@@ -14,13 +40,7 @@
94+
@@ -14,13 +41,7 @@
9495
/// Pause execution on the core.
9596
#[inline(always)]
9697
pub fn wait_forever() -> ! {

04_zero_overhead_abstraction/src/_arch/aarch64/cpu.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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()`).
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
use crate::runtime_init;

05_safe_globals/src/_arch/aarch64/cpu.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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()`).
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
use crate::runtime_init;

06_drivers_gpio_uart/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile
183183
diff -uNr 05_safe_globals/src/_arch/aarch64/cpu.rs 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
184184
--- 05_safe_globals/src/_arch/aarch64/cpu.rs
185185
+++ 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
186-
@@ -37,6 +37,17 @@
186+
@@ -38,6 +38,17 @@
187187
// Public Code
188188
//--------------------------------------------------------------------------------------------------
189189

06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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()`).
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
use crate::runtime_init;

07_uart_chainloader/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ diff -uNr 06_drivers_gpio_uart/Makefile 07_uart_chainloader/Makefile
179179
diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs 07_uart_chainloader/src/_arch/aarch64/cpu.rs
180180
--- 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs
181181
+++ 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()`).
184184
#[no_mangle]
185185
pub unsafe fn _start() -> ! {
186186
- use crate::runtime_init;
@@ -194,7 +194,7 @@ diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs 07_uart_chainloader/src/
194194
} else {
195195
// If not core0, infinitely wait for events.
196196
wait_forever()
197-
@@ -55,3 +55,19 @@
197+
@@ -56,3 +56,19 @@
198198
asm::wfe()
199199
}
200200
}

07_uart_chainloader/src/_arch/aarch64/cpu.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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()`).
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
use crate::relocate;

08_timestamps/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ diff -uNr 07_uart_chainloader/Makefile 08_timestamps/Makefile
115115
diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/aarch64/cpu.rs
116116
--- 07_uart_chainloader/src/_arch/aarch64/cpu.rs
117117
+++ 08_timestamps/src/_arch/aarch64/cpu.rs
118-
@@ -21,12 +21,12 @@
119-
#[naked]
118+
@@ -22,12 +22,12 @@
119+
/// actually set (`SP.set()`).
120120
#[no_mangle]
121121
pub unsafe fn _start() -> ! {
122122
- use crate::relocate;
@@ -130,7 +130,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/a
130130
} else {
131131
// If not core0, infinitely wait for events.
132132
wait_forever()
133-
@@ -39,15 +39,6 @@
133+
@@ -40,15 +40,6 @@
134134

135135
pub use asm::nop;
136136

@@ -146,7 +146,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/a
146146
/// Pause execution on the core.
147147
#[inline(always)]
148148
pub fn wait_forever() -> ! {
149-
@@ -55,19 +46,3 @@
149+
@@ -56,19 +47,3 @@
150150
asm::wfe()
151151
}
152152
}

08_timestamps/src/_arch/aarch64/cpu.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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()`).
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
use crate::runtime_init;

09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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()`).
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
use crate::runtime_init;

10_privilege_level/README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,14 @@ Minipush 1.0
225225
diff -uNr 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs 10_privilege_level/src/_arch/aarch64/cpu.rs
226226
--- 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs
227227
+++ 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.
230236
#[no_mangle]
231237
pub unsafe fn _start() -> ! {
232238
- use crate::runtime_init;
@@ -252,6 +258,8 @@ diff -uNr 09_hw_debug_JTAG/src/_arch/aarch64/cpu.rs 10_privilege_level/src/_arch
252258
+/// - The HW state of EL1 must be prepared in a sound way.
253259
+/// - Exception return from EL2 must must continue execution in EL1 with
254260
+/// `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.
255263
+#[inline(always)]
256264
+unsafe fn el2_to_el1_transition() -> ! {
257265
+ use crate::runtime_init;

10_privilege_level/src/_arch/aarch64/cpu.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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.
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
3940
/// - The HW state of EL1 must be prepared in a sound way.
4041
/// - Exception return from EL2 must must continue execution in EL1 with
4142
/// `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.
4245
#[inline(always)]
4346
unsafe fn el2_to_el1_transition() -> ! {
4447
use crate::runtime_init;

11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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.
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
3940
/// - The HW state of EL1 must be prepared in a sound way.
4041
/// - Exception return from EL2 must must continue execution in EL1 with
4142
/// `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.
4245
#[inline(always)]
4346
unsafe fn el2_to_el1_transition() -> ! {
4447
use crate::runtime_init;

12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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.
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
3940
/// - The HW state of EL1 must be prepared in a sound way.
4041
/// - Exception return from EL2 must must continue execution in EL1 with
4142
/// `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.
4245
#[inline(always)]
4346
unsafe fn el2_to_el1_transition() -> ! {
4447
use crate::runtime_init;

13_integrated_testing/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ diff -uNr 12_exceptions_part1_groundwork/Makefile 13_integrated_testing/Makefile
935935
diff -uNr 12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs 13_integrated_testing/src/_arch/aarch64/cpu.rs
936936
--- 12_exceptions_part1_groundwork/src/_arch/aarch64/cpu.rs
937937
+++ 13_integrated_testing/src/_arch/aarch64/cpu.rs
938-
@@ -87,3 +87,20 @@
938+
@@ -90,3 +90,20 @@
939939
asm::wfe()
940940
}
941941
}

13_integrated_testing/src/_arch/aarch64/cpu.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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.
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
3940
/// - The HW state of EL1 must be prepared in a sound way.
4041
/// - Exception return from EL2 must must continue execution in EL1 with
4142
/// `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.
4245
#[inline(always)]
4346
unsafe fn el2_to_el1_transition() -> ! {
4447
use crate::runtime_init;

14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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.
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
3940
/// - The HW state of EL1 must be prepared in a sound way.
4041
/// - Exception return from EL2 must must continue execution in EL1 with
4142
/// `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.
4245
#[inline(always)]
4346
unsafe fn el2_to_el1_transition() -> ! {
4447
use crate::runtime_init;

15_virtual_mem_part2_mmio_remap/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Minipush 1.0
311311
diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs 15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs
312312
--- 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu.rs
313313
+++ 15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs
314-
@@ -68,7 +68,7 @@
314+
@@ -71,7 +71,7 @@
315315
ELR_EL2.set(runtime_init::runtime_init as *const () as u64);
316316

317317
// Set up SP_EL1 (stack pointer), which will be used by EL1 once we "return" to it.

15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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.
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
// Expect the boot core to start in EL2.
@@ -39,6 +40,8 @@ pub unsafe fn _start() -> ! {
3940
/// - The HW state of EL1 must be prepared in a sound way.
4041
/// - Exception return from EL2 must must continue execution in EL1 with
4142
/// `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.
4245
#[inline(always)]
4346
unsafe fn el2_to_el1_transition() -> ! {
4447
use crate::runtime_init;

X1_JTAG_boot/jtag_boot_rpi3.img

-336 Bytes
Binary file not shown.

X1_JTAG_boot/jtag_boot_rpi4.img

-288 Bytes
Binary file not shown.

X1_JTAG_boot/src/_arch/aarch64/cpu.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use cortex_a::{asm, regs::*};
1717
///
1818
/// # Safety
1919
///
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()`).
2223
#[no_mangle]
2324
pub unsafe fn _start() -> ! {
2425
use crate::runtime_init;

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2020-12-08"
2+
channel = "nightly-2020-12-09"
33
components = ["llvm-tools-preview"]
44
targets = ["aarch64-unknown-none-softfloat"]

0 commit comments

Comments
 (0)