diff --git a/01_wait_forever/src/_arch/aarch64/cpu/boot.rs b/01_wait_forever/src/_arch/aarch64/cpu/boot.rs index 4bc6ed6d..13aee3a3 100644 --- a/01_wait_forever/src/_arch/aarch64/cpu/boot.rs +++ b/01_wait_forever/src/_arch/aarch64/cpu/boot.rs @@ -12,4 +12,4 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); diff --git a/01_wait_forever/src/main.rs b/01_wait_forever/src/main.rs index b01a84cb..84e9c8c1 100644 --- a/01_wait_forever/src/main.rs +++ b/01_wait_forever/src/main.rs @@ -103,8 +103,6 @@ //! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. -#![feature(asm)] -#![feature(global_asm)] #![no_main] #![no_std] diff --git a/02_runtime_init/Cargo.lock b/02_runtime_init/Cargo.lock index 1fd03899..19fc8b73 100644 --- a/02_runtime_init/Cargo.lock +++ b/02_runtime_init/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/02_runtime_init/Cargo.toml b/02_runtime_init/Cargo.toml index c4fd83e3..52786a40 100644 --- a/02_runtime_init/Cargo.toml +++ b/02_runtime_init/Cargo.toml @@ -24,5 +24,4 @@ path = "src/main.rs" # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/02_runtime_init/README.md b/02_runtime_init/README.md index 7c8d44cf..530c1a3f 100644 --- a/02_runtime_init/README.md +++ b/02_runtime_init/README.md @@ -40,15 +40,14 @@ diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml authors = ["Andre Richter "] edition = "2021" -@@ -21,3 +21,8 @@ +@@ -21,3 +21,7 @@ ##-------------------------------------------------------------------------------------------------- [dependencies] + +# Platform specific dependencies +[target.'cfg(target_arch = "aarch64")'.dependencies] -+cortex-a = { version = "6.x.x" } -+ ++cortex-a = { version = "7.x.x" } diff -uNr 01_wait_forever/Makefile 02_runtime_init/Makefile --- 01_wait_forever/Makefile @@ -69,7 +68,7 @@ diff -uNr 01_wait_forever/src/_arch/aarch64/cpu/boot.rs 02_runtime_init/src/_arc @@ -13,3 +13,15 @@ // Assembly counterpart to this file. - global_asm!(include_str!("boot.s")); + core::arch::global_asm!(include_str!("boot.s")); + +//-------------------------------------------------------------------------------------------------- +// Public Code @@ -303,17 +302,15 @@ diff -uNr 01_wait_forever/src/cpu.rs 02_runtime_init/src/cpu.rs diff -uNr 01_wait_forever/src/main.rs 02_runtime_init/src/main.rs --- 01_wait_forever/src/main.rs +++ 02_runtime_init/src/main.rs -@@ -102,8 +102,8 @@ +@@ -102,6 +102,7 @@ //! //! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. +//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. --#![feature(asm)] - #![feature(global_asm)] #![no_main] #![no_std] -@@ -112,4 +112,11 @@ +@@ -110,4 +111,11 @@ mod cpu; mod panic_wait; diff --git a/02_runtime_init/src/_arch/aarch64/cpu/boot.rs b/02_runtime_init/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/02_runtime_init/src/_arch/aarch64/cpu/boot.rs +++ b/02_runtime_init/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/02_runtime_init/src/main.rs b/02_runtime_init/src/main.rs index cf15402f..561ee9d2 100644 --- a/02_runtime_init/src/main.rs +++ b/02_runtime_init/src/main.rs @@ -104,7 +104,6 @@ //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. -#![feature(global_asm)] #![no_main] #![no_std] diff --git a/03_hacky_hello_world/Cargo.lock b/03_hacky_hello_world/Cargo.lock index 1213b384..cdaf44bf 100644 --- a/03_hacky_hello_world/Cargo.lock +++ b/03_hacky_hello_world/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/03_hacky_hello_world/Cargo.toml b/03_hacky_hello_world/Cargo.toml index 75cf6701..cca92834 100644 --- a/03_hacky_hello_world/Cargo.toml +++ b/03_hacky_hello_world/Cargo.toml @@ -24,5 +24,4 @@ path = "src/main.rs" # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index c9c5862a..cb04d375 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -208,12 +208,11 @@ diff -uNr 02_runtime_init/src/console.rs 03_hacky_hello_world/src/console.rs diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs --- 02_runtime_init/src/main.rs +++ 03_hacky_hello_world/src/main.rs -@@ -104,13 +104,17 @@ +@@ -104,12 +104,16 @@ //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`. //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. +#![feature(format_args_nl)] - #![feature(global_asm)] +#![feature(panic_info_message)] #![no_main] #![no_std] @@ -226,7 +225,7 @@ diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs /// Early init code. /// -@@ -118,5 +122,7 @@ +@@ -117,5 +121,7 @@ /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { diff --git a/03_hacky_hello_world/src/_arch/aarch64/cpu/boot.rs b/03_hacky_hello_world/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/03_hacky_hello_world/src/_arch/aarch64/cpu/boot.rs +++ b/03_hacky_hello_world/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/03_hacky_hello_world/src/main.rs b/03_hacky_hello_world/src/main.rs index de9a0576..7ae7138d 100644 --- a/03_hacky_hello_world/src/main.rs +++ b/03_hacky_hello_world/src/main.rs @@ -105,7 +105,6 @@ //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![no_main] #![no_std] diff --git a/04_safe_globals/Cargo.lock b/04_safe_globals/Cargo.lock index bd028f28..08a979d5 100644 --- a/04_safe_globals/Cargo.lock +++ b/04_safe_globals/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/04_safe_globals/Cargo.toml b/04_safe_globals/Cargo.toml index 3d282da6..cb51da55 100644 --- a/04_safe_globals/Cargo.toml +++ b/04_safe_globals/Cargo.toml @@ -24,5 +24,4 @@ path = "src/main.rs" # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/04_safe_globals/README.md b/04_safe_globals/README.md index b03f0c11..86767a95 100644 --- a/04_safe_globals/README.md +++ b/04_safe_globals/README.md @@ -224,15 +224,15 @@ diff -uNr 03_hacky_hello_world/src/console.rs 04_safe_globals/src/console.rs diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs --- 03_hacky_hello_world/src/main.rs +++ 04_safe_globals/src/main.rs -@@ -107,6 +107,7 @@ +@@ -106,6 +106,7 @@ + #![feature(format_args_nl)] - #![feature(global_asm)] #![feature(panic_info_message)] +#![feature(trait_alias)] #![no_main] #![no_std] -@@ -115,6 +116,7 @@ +@@ -114,6 +115,7 @@ mod cpu; mod panic_wait; mod print; @@ -240,7 +240,7 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs /// Early init code. /// -@@ -122,7 +124,15 @@ +@@ -121,7 +123,15 @@ /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { diff --git a/04_safe_globals/src/_arch/aarch64/cpu/boot.rs b/04_safe_globals/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/04_safe_globals/src/_arch/aarch64/cpu/boot.rs +++ b/04_safe_globals/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/04_safe_globals/src/main.rs b/04_safe_globals/src/main.rs index 82262ea1..dddacdb2 100644 --- a/04_safe_globals/src/main.rs +++ b/04_safe_globals/src/main.rs @@ -105,7 +105,6 @@ //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/05_drivers_gpio_uart/Cargo.lock b/05_drivers_gpio_uart/Cargo.lock index 8ac198e1..ff66f548 100644 --- a/05_drivers_gpio_uart/Cargo.lock +++ b/05_drivers_gpio_uart/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/05_drivers_gpio_uart/Cargo.toml b/05_drivers_gpio_uart/Cargo.toml index 44d10141..b2f17d8d 100644 --- a/05_drivers_gpio_uart/Cargo.toml +++ b/05_drivers_gpio_uart/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/05_drivers_gpio_uart/README.md b/05_drivers_gpio_uart/README.md index 00d23212..e9f59429 100644 --- a/05_drivers_gpio_uart/README.md +++ b/05_drivers_gpio_uart/README.md @@ -140,7 +140,7 @@ diff -uNr 04_safe_globals/Cargo.toml 05_drivers_gpio_uart/Cargo.toml + # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] - cortex-a = { version = "6.x.x" } + cortex-a = { version = "7.x.x" } diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile --- 04_safe_globals/Makefile @@ -1340,9 +1340,9 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs +#![allow(clippy::upper_case_acronyms)] +#![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] - #![feature(global_asm)] #![feature(panic_info_message)] -@@ -114,6 +116,7 @@ + #![feature(trait_alias)] +@@ -113,6 +115,7 @@ mod bsp; mod console; mod cpu; @@ -1350,7 +1350,7 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs mod panic_wait; mod print; mod synchronization; -@@ -123,16 +126,54 @@ +@@ -122,16 +125,54 @@ /// # Safety /// /// - Only a single core must be active and running this function. diff --git a/05_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.rs b/05_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/05_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.rs +++ b/05_drivers_gpio_uart/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/05_drivers_gpio_uart/src/main.rs b/05_drivers_gpio_uart/src/main.rs index 0261a136..1ca13aeb 100644 --- a/05_drivers_gpio_uart/src/main.rs +++ b/05_drivers_gpio_uart/src/main.rs @@ -107,7 +107,6 @@ #![allow(clippy::upper_case_acronyms)] #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/06_uart_chainloader/Cargo.lock b/06_uart_chainloader/Cargo.lock index 98f3ca1c..c642ff43 100644 --- a/06_uart_chainloader/Cargo.lock +++ b/06_uart_chainloader/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/06_uart_chainloader/Cargo.toml b/06_uart_chainloader/Cargo.toml index 1ea68580..f00c87a8 100644 --- a/06_uart_chainloader/Cargo.toml +++ b/06_uart_chainloader/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/06_uart_chainloader/README.md b/06_uart_chainloader/README.md index 857a3a83..ef4bee8c 100644 --- a/06_uart_chainloader/README.md +++ b/06_uart_chainloader/README.md @@ -456,15 +456,7 @@ diff -uNr 05_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 06_uart_chainloader diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs --- 05_drivers_gpio_uart/src/main.rs +++ 06_uart_chainloader/src/main.rs -@@ -105,6 +105,7 @@ - //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. - - #![allow(clippy::upper_case_acronyms)] -+#![feature(asm)] - #![feature(const_fn_fn_ptr_basics)] - #![feature(format_args_nl)] - #![feature(global_asm)] -@@ -142,38 +143,56 @@ +@@ -141,38 +141,56 @@ kernel_main() } @@ -480,7 +472,7 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs use bsp::console::console; use console::interface::All; - use driver::interface::DriverManager; -- + - println!( - "[0] {} version {}", - env!("CARGO_PKG_NAME"), @@ -495,37 +487,36 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs - .enumerate() - { - println!(" {}. {}", i + 1, driver.compatible()); -- } - -- println!( -- "[3] Chars written: {}", -- bsp::console::console().chars_written() -- ); -- println!("[4] Echoing input now"); + println!("{}", MINILOAD_LOGO); + println!("{:^37}", bsp::board_name()); + println!(); + println!("[ML] Requesting binary"); + console().flush(); - -- // Discard any spurious received characters before going into echo mode. ++ + // Discard any spurious received characters before starting with the loader protocol. - console().clear_rx(); -- loop { -- let c = bsp::console::console().read_char(); -- bsp::console::console().write_char(c); ++ console().clear_rx(); + + // Notify `Minipush` to send the binary. + for _ in 0..3 { + console().write_char(3 as char); } -+ + +- println!( +- "[3] Chars written: {}", +- bsp::console::console().chars_written() +- ); +- println!("[4] Echoing input now"); + // Read the binary's size. + let mut size: u32 = u32::from(console().read_char() as u8); + size |= u32::from(console().read_char() as u8) << 8; + size |= u32::from(console().read_char() as u8) << 16; + size |= u32::from(console().read_char() as u8) << 24; -+ + +- // Discard any spurious received characters before going into echo mode. +- console().clear_rx(); +- loop { +- let c = bsp::console::console().read_char(); +- bsp::console::console().write_char(c); + // Trust it's not too big. + console().write_char('O'); + console().write_char('K'); @@ -536,7 +527,7 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs + for i in 0..size { + core::ptr::write_volatile(kernel_addr.offset(i as isize), console().read_char() as u8) + } -+ } + } + + println!("[ML] Loaded! Executing the payload now\n"); + console().flush(); diff --git a/06_uart_chainloader/demo_payload_rpi3.img b/06_uart_chainloader/demo_payload_rpi3.img index 7b482d7b..f49c5288 100755 Binary files a/06_uart_chainloader/demo_payload_rpi3.img and b/06_uart_chainloader/demo_payload_rpi3.img differ diff --git a/06_uart_chainloader/demo_payload_rpi4.img b/06_uart_chainloader/demo_payload_rpi4.img index e7b0e939..fa4374e9 100755 Binary files a/06_uart_chainloader/demo_payload_rpi4.img and b/06_uart_chainloader/demo_payload_rpi4.img differ diff --git a/06_uart_chainloader/src/_arch/aarch64/cpu/boot.rs b/06_uart_chainloader/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/06_uart_chainloader/src/_arch/aarch64/cpu/boot.rs +++ b/06_uart_chainloader/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/06_uart_chainloader/src/main.rs b/06_uart_chainloader/src/main.rs index 5c45cb5f..225e26fb 100644 --- a/06_uart_chainloader/src/main.rs +++ b/06_uart_chainloader/src/main.rs @@ -105,10 +105,8 @@ //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. #![allow(clippy::upper_case_acronyms)] -#![feature(asm)] #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/07_timestamps/Cargo.lock b/07_timestamps/Cargo.lock index 663d313c..dab65cbb 100644 --- a/07_timestamps/Cargo.lock +++ b/07_timestamps/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/07_timestamps/Cargo.toml b/07_timestamps/Cargo.toml index 4ad9af38..970def3b 100644 --- a/07_timestamps/Cargo.toml +++ b/07_timestamps/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/07_timestamps/README.md b/07_timestamps/README.md index f04b8fe4..02670c16 100644 --- a/07_timestamps/README.md +++ b/07_timestamps/README.md @@ -536,15 +536,7 @@ diff -uNr 06_uart_chainloader/src/cpu.rs 07_timestamps/src/cpu.rs diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs --- 06_uart_chainloader/src/main.rs +++ 07_timestamps/src/main.rs -@@ -105,7 +105,6 @@ - //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. - - #![allow(clippy::upper_case_acronyms)] --#![feature(asm)] - #![feature(const_fn_fn_ptr_basics)] - #![feature(format_args_nl)] - #![feature(global_asm)] -@@ -121,6 +120,7 @@ +@@ -119,6 +119,7 @@ mod panic_wait; mod print; mod synchronization; @@ -552,7 +544,7 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs /// Early init code. /// -@@ -143,56 +143,38 @@ +@@ -141,56 +142,38 @@ kernel_main() } diff --git a/07_timestamps/src/_arch/aarch64/cpu/boot.rs b/07_timestamps/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/07_timestamps/src/_arch/aarch64/cpu/boot.rs +++ b/07_timestamps/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/07_timestamps/src/main.rs b/07_timestamps/src/main.rs index 1e6bf16a..2df465b7 100644 --- a/07_timestamps/src/main.rs +++ b/07_timestamps/src/main.rs @@ -107,7 +107,6 @@ #![allow(clippy::upper_case_acronyms)] #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/08_hw_debug_JTAG/Cargo.lock b/08_hw_debug_JTAG/Cargo.lock index 884ec5f0..2abe1c74 100644 --- a/08_hw_debug_JTAG/Cargo.lock +++ b/08_hw_debug_JTAG/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/08_hw_debug_JTAG/Cargo.toml b/08_hw_debug_JTAG/Cargo.toml index b6d42173..638d4de1 100644 --- a/08_hw_debug_JTAG/Cargo.toml +++ b/08_hw_debug_JTAG/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs b/08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs +++ b/08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/08_hw_debug_JTAG/src/main.rs b/08_hw_debug_JTAG/src/main.rs index 1e6bf16a..2df465b7 100644 --- a/08_hw_debug_JTAG/src/main.rs +++ b/08_hw_debug_JTAG/src/main.rs @@ -107,7 +107,6 @@ #![allow(clippy::upper_case_acronyms)] #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/09_privilege_level/Cargo.lock b/09_privilege_level/Cargo.lock index 1703eebe..f65b5430 100644 --- a/09_privilege_level/Cargo.lock +++ b/09_privilege_level/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/09_privilege_level/Cargo.toml b/09_privilege_level/Cargo.toml index b76d2e77..dccb5622 100644 --- a/09_privilege_level/Cargo.toml +++ b/09_privilege_level/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/09_privilege_level/README.md b/09_privilege_level/README.md index 3dbe5bd6..8dc09193 100644 --- a/09_privilege_level/README.md +++ b/09_privilege_level/README.md @@ -211,17 +211,19 @@ diff -uNr 08_hw_debug_JTAG/Cargo.toml 09_privilege_level/Cargo.toml diff -uNr 08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs 09_privilege_level/src/_arch/aarch64/cpu/boot.rs --- 08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs +++ 09_privilege_level/src/_arch/aarch64/cpu/boot.rs -@@ -11,17 +11,68 @@ +@@ -11,8 +11,53 @@ //! //! crate::cpu::boot::arch_boot ++use core::arch::global_asm; +use cortex_a::{asm, registers::*}; +use tock_registers::interfaces::Writeable; + // Assembly counterpart to this file. - global_asm!(include_str!("boot.s")); - - //-------------------------------------------------------------------------------------------------- +-core::arch::global_asm!(include_str!("boot.s")); ++global_asm!(include_str!("boot.s")); ++ ++//-------------------------------------------------------------------------------------------------- +// Private Code +//-------------------------------------------------------------------------------------------------- + @@ -261,11 +263,10 @@ diff -uNr 08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs 09_privilege_level/src/ + // are no plans to ever return to EL2, just re-use the same stack. + SP_EL1.set(phys_boot_core_stack_end_exclusive_addr); +} -+ -+//-------------------------------------------------------------------------------------------------- - // Public Code - //-------------------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------------------- + // Public Code +@@ -21,7 +66,14 @@ /// The Rust entry of the `kernel` binary. /// /// The function is called from the assembly `_start` function. @@ -501,7 +502,7 @@ diff -uNr 08_hw_debug_JTAG/src/exception.rs 09_privilege_level/src/exception.rs diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs --- 08_hw_debug_JTAG/src/main.rs +++ 09_privilege_level/src/main.rs -@@ -117,6 +117,7 @@ +@@ -116,6 +116,7 @@ mod console; mod cpu; mod driver; @@ -509,7 +510,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs mod panic_wait; mod print; mod synchronization; -@@ -145,6 +146,8 @@ +@@ -144,6 +145,8 @@ /// The main function running after the early init. fn kernel_main() -> ! { @@ -518,7 +519,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs use core::time::Duration; use driver::interface::DriverManager; use time::interface::TimeManager; -@@ -156,6 +159,12 @@ +@@ -155,6 +158,12 @@ ); info!("Booting on: {}", bsp::board_name()); @@ -531,7 +532,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs info!( "Architectural timer resolution: {} ns", time::time_manager().resolution().as_nanos() -@@ -170,11 +179,15 @@ +@@ -169,11 +178,15 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/09_privilege_level/src/_arch/aarch64/cpu/boot.rs b/09_privilege_level/src/_arch/aarch64/cpu/boot.rs index 4f006862..f54ae739 100644 --- a/09_privilege_level/src/_arch/aarch64/cpu/boot.rs +++ b/09_privilege_level/src/_arch/aarch64/cpu/boot.rs @@ -11,6 +11,7 @@ //! //! crate::cpu::boot::arch_boot +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/09_privilege_level/src/main.rs b/09_privilege_level/src/main.rs index 74902def..7a692a0c 100644 --- a/09_privilege_level/src/main.rs +++ b/09_privilege_level/src/main.rs @@ -107,7 +107,6 @@ #![allow(clippy::upper_case_acronyms)] #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/10_virtual_mem_part1_identity_mapping/Cargo.lock b/10_virtual_mem_part1_identity_mapping/Cargo.lock index d0180466..23fe8e43 100644 --- a/10_virtual_mem_part1_identity_mapping/Cargo.lock +++ b/10_virtual_mem_part1_identity_mapping/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/10_virtual_mem_part1_identity_mapping/Cargo.toml b/10_virtual_mem_part1_identity_mapping/Cargo.toml index e52ac34c..144767d3 100644 --- a/10_virtual_mem_part1_identity_mapping/Cargo.toml +++ b/10_virtual_mem_part1_identity_mapping/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/10_virtual_mem_part1_identity_mapping/README.md b/10_virtual_mem_part1_identity_mapping/README.md index ed01e03d..759f324b 100644 --- a/10_virtual_mem_part1_identity_mapping/README.md +++ b/10_virtual_mem_part1_identity_mapping/README.md @@ -1089,9 +1089,9 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s #![feature(const_fn_fn_ptr_basics)] +#![feature(core_intrinsics)] #![feature(format_args_nl)] - #![feature(global_asm)] #![feature(panic_info_message)] -@@ -118,6 +120,7 @@ + #![feature(trait_alias)] +@@ -117,6 +119,7 @@ mod cpu; mod driver; mod exception; @@ -1099,7 +1099,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s mod panic_wait; mod print; mod synchronization; -@@ -128,9 +131,17 @@ +@@ -127,9 +130,17 @@ /// # Safety /// /// - Only a single core must be active and running this function. @@ -1118,7 +1118,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s for i in bsp::driver::driver_manager().all_device_drivers().iter() { if let Err(x) = i.init() { -@@ -159,6 +170,9 @@ +@@ -158,6 +169,9 @@ ); info!("Booting on: {}", bsp::board_name()); @@ -1128,7 +1128,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s let (_, privilege_level) = exception::current_privilege_level(); info!("Current privilege level: {}", privilege_level); -@@ -182,6 +196,13 @@ +@@ -181,6 +195,13 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu/boot.rs b/10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu/boot.rs index 4f006862..f54ae739 100644 --- a/10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu/boot.rs +++ b/10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/cpu/boot.rs @@ -11,6 +11,7 @@ //! //! crate::cpu::boot::arch_boot +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/10_virtual_mem_part1_identity_mapping/src/main.rs b/10_virtual_mem_part1_identity_mapping/src/main.rs index f7c949be..86d7f473 100644 --- a/10_virtual_mem_part1_identity_mapping/src/main.rs +++ b/10_virtual_mem_part1_identity_mapping/src/main.rs @@ -109,7 +109,6 @@ #![feature(const_fn_fn_ptr_basics)] #![feature(core_intrinsics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/11_exceptions_part1_groundwork/Cargo.lock b/11_exceptions_part1_groundwork/Cargo.lock index d25b6b78..2c16d5d5 100644 --- a/11_exceptions_part1_groundwork/Cargo.lock +++ b/11_exceptions_part1_groundwork/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/11_exceptions_part1_groundwork/Cargo.toml b/11_exceptions_part1_groundwork/Cargo.toml index e92d9f43..aa8a870c 100644 --- a/11_exceptions_part1_groundwork/Cargo.toml +++ b/11_exceptions_part1_groundwork/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/11_exceptions_part1_groundwork/README.md b/11_exceptions_part1_groundwork/README.md index ec6a312d..8424b79c 100644 --- a/11_exceptions_part1_groundwork/README.md +++ b/11_exceptions_part1_groundwork/README.md @@ -502,7 +502,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs 1 -use cortex_a::registers::*; -use tock_registers::interfaces::Readable; -+use core::{cell::UnsafeCell, fmt}; ++use core::{arch::global_asm, cell::UnsafeCell, fmt}; +use cortex_a::{asm::barrier, registers::*}; +use tock_registers::{ + interfaces::{Readable, Writeable}, @@ -1013,7 +1013,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/exception.rs 11_exceptions_p diff -uNr 10_virtual_mem_part1_identity_mapping/src/main.rs 11_exceptions_part1_groundwork/src/main.rs --- 10_virtual_mem_part1_identity_mapping/src/main.rs +++ 11_exceptions_part1_groundwork/src/main.rs -@@ -139,6 +139,8 @@ +@@ -138,6 +138,8 @@ use driver::interface::DriverManager; use memory::mmu::interface::MMU; @@ -1022,7 +1022,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/main.rs 11_exceptions_part1_ if let Err(string) = memory::mmu::mmu().enable_mmu_and_caching() { panic!("MMU: {}", string); } -@@ -196,13 +198,28 @@ +@@ -195,13 +197,28 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/11_exceptions_part1_groundwork/src/_arch/aarch64/cpu/boot.rs b/11_exceptions_part1_groundwork/src/_arch/aarch64/cpu/boot.rs index 4f006862..f54ae739 100644 --- a/11_exceptions_part1_groundwork/src/_arch/aarch64/cpu/boot.rs +++ b/11_exceptions_part1_groundwork/src/_arch/aarch64/cpu/boot.rs @@ -11,6 +11,7 @@ //! //! crate::cpu::boot::arch_boot +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs b/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs index 2db1741c..1454145e 100644 --- a/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs +++ b/11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs @@ -11,7 +11,7 @@ //! //! crate::exception::arch_exception -use core::{cell::UnsafeCell, fmt}; +use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ interfaces::{Readable, Writeable}, diff --git a/11_exceptions_part1_groundwork/src/main.rs b/11_exceptions_part1_groundwork/src/main.rs index 637684b0..12deeb2c 100644 --- a/11_exceptions_part1_groundwork/src/main.rs +++ b/11_exceptions_part1_groundwork/src/main.rs @@ -109,7 +109,6 @@ #![feature(const_fn_fn_ptr_basics)] #![feature(core_intrinsics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/12_integrated_testing/Cargo.lock b/12_integrated_testing/Cargo.lock index c4d231f9..7294834d 100644 --- a/12_integrated_testing/Cargo.lock +++ b/12_integrated_testing/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "qemu-exit" -version = "2.0.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389" +checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543" [[package]] name = "quote" diff --git a/12_integrated_testing/Cargo.toml b/12_integrated_testing/Cargo.toml index 40f28b18..80a3a0bc 100644 --- a/12_integrated_testing/Cargo.toml +++ b/12_integrated_testing/Cargo.toml @@ -22,11 +22,11 @@ test-types = { path = "test-types" } # Optional dependencies tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "2.x.x", optional = true } +qemu-exit = { version = "3.x.x", optional = true } # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } +cortex-a = { version = "7.x.x" } ##-------------------------------------------------------------------------------------------------- ## Testing diff --git a/12_integrated_testing/README.md b/12_integrated_testing/README.md index 607c5b5d..ac37d541 100644 --- a/12_integrated_testing/README.md +++ b/12_integrated_testing/README.md @@ -883,7 +883,7 @@ diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo. authors = ["Andre Richter "] edition = "2021" -@@ -11,21 +11,46 @@ +@@ -11,20 +11,46 @@ default = [] bsp_rpi3 = ["tock-registers"] bsp_rpi4 = ["tock-registers"] @@ -902,12 +902,12 @@ diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo. # Optional dependencies tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -+qemu-exit = { version = "2.x.x", optional = true } ++qemu-exit = { version = "3.x.x", optional = true } # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] - cortex-a = { version = "6.x.x" } - + cortex-a = { version = "7.x.x" } ++ +##-------------------------------------------------------------------------------------------------- +## Testing +##-------------------------------------------------------------------------------------------------- @@ -1274,7 +1274,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/exception.rs 12_integrated_testing/ diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/lib.rs --- 11_exceptions_part1_groundwork/src/lib.rs +++ 12_integrated_testing/src/lib.rs -@@ -0,0 +1,185 @@ +@@ -0,0 +1,184 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2021 Andre Richter @@ -1388,7 +1388,6 @@ diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/li +#![feature(const_fn_fn_ptr_basics)] +#![feature(core_intrinsics)] +#![feature(format_args_nl)] -+#![feature(global_asm)] +#![feature(linkage)] +#![feature(panic_info_message)] +#![feature(trait_alias)] @@ -1464,7 +1463,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/li diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/main.rs --- 11_exceptions_part1_groundwork/src/main.rs +++ 12_integrated_testing/src/main.rs -@@ -6,125 +6,12 @@ +@@ -6,124 +6,12 @@ #![doc(html_logo_url = "https://git.io/JeGIp")] //! The `kernel` binary. @@ -1572,7 +1571,6 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m -#![feature(core_intrinsics)] + #![feature(format_args_nl)] --#![feature(global_asm)] -#![feature(panic_info_message)] -#![feature(trait_alias)] #![no_main] @@ -1592,7 +1590,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m /// Early init code. /// -@@ -135,6 +22,7 @@ +@@ -134,6 +22,7 @@ /// - MMU + Data caching must be activated at the earliest. Without it, any atomic operations, /// e.g. the yet-to-be-introduced spinlocks in the device drivers (which currently employ /// NullLocks instead of spinlocks), will fail to work (properly) on the RPi SoCs. @@ -1600,7 +1598,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m unsafe fn kernel_init() -> ! { use driver::interface::DriverManager; use memory::mmu::interface::MMU; -@@ -161,15 +49,9 @@ +@@ -160,15 +49,9 @@ fn kernel_main() -> ! { use bsp::console::console; use console::interface::All; @@ -1617,7 +1615,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m info!("Booting on: {}", bsp::board_name()); info!("MMU online. Special regions:"); -@@ -195,31 +77,6 @@ +@@ -194,31 +77,6 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/12_integrated_testing/src/_arch/aarch64/cpu/boot.rs b/12_integrated_testing/src/_arch/aarch64/cpu/boot.rs index 4f006862..f54ae739 100644 --- a/12_integrated_testing/src/_arch/aarch64/cpu/boot.rs +++ b/12_integrated_testing/src/_arch/aarch64/cpu/boot.rs @@ -11,6 +11,7 @@ //! //! crate::cpu::boot::arch_boot +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/12_integrated_testing/src/_arch/aarch64/exception.rs b/12_integrated_testing/src/_arch/aarch64/exception.rs index 6e8485b7..05b729e2 100644 --- a/12_integrated_testing/src/_arch/aarch64/exception.rs +++ b/12_integrated_testing/src/_arch/aarch64/exception.rs @@ -11,7 +11,7 @@ //! //! crate::exception::arch_exception -use core::{cell::UnsafeCell, fmt}; +use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ interfaces::{Readable, Writeable}, diff --git a/12_integrated_testing/src/lib.rs b/12_integrated_testing/src/lib.rs index 723b2a80..39eea925 100644 --- a/12_integrated_testing/src/lib.rs +++ b/12_integrated_testing/src/lib.rs @@ -111,7 +111,6 @@ #![feature(const_fn_fn_ptr_basics)] #![feature(core_intrinsics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(linkage)] #![feature(panic_info_message)] #![feature(trait_alias)] diff --git a/13_exceptions_part2_peripheral_IRQs/Cargo.lock b/13_exceptions_part2_peripheral_IRQs/Cargo.lock index db1cd2db..b3514b23 100644 --- a/13_exceptions_part2_peripheral_IRQs/Cargo.lock +++ b/13_exceptions_part2_peripheral_IRQs/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "qemu-exit" -version = "2.0.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389" +checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543" [[package]] name = "quote" diff --git a/13_exceptions_part2_peripheral_IRQs/Cargo.toml b/13_exceptions_part2_peripheral_IRQs/Cargo.toml index c81105a5..b4572cb2 100644 --- a/13_exceptions_part2_peripheral_IRQs/Cargo.toml +++ b/13_exceptions_part2_peripheral_IRQs/Cargo.toml @@ -22,11 +22,11 @@ test-types = { path = "test-types" } # Optional dependencies tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "2.x.x", optional = true } +qemu-exit = { version = "3.x.x", optional = true } # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } +cortex-a = { version = "7.x.x" } ##-------------------------------------------------------------------------------------------------- ## Testing diff --git a/13_exceptions_part2_peripheral_IRQs/README.md b/13_exceptions_part2_peripheral_IRQs/README.md index efb83e64..18de9ac6 100644 --- a/13_exceptions_part2_peripheral_IRQs/README.md +++ b/13_exceptions_part2_peripheral_IRQs/README.md @@ -809,9 +809,11 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/cpu/smp.rs 13_exceptions_part2 diff -uNr 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs --- 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs +++ 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs -@@ -12,12 +12,16 @@ +@@ -11,13 +11,18 @@ + //! //! crate::exception::asynchronous::arch_asynchronous ++use core::arch::asm; use cortex_a::registers::*; -use tock_registers::interfaces::Readable; +use tock_registers::interfaces::{Readable, Writeable}; @@ -827,7 +829,7 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 13_e trait DaifField { fn daif_field() -> tock_registers::fields::Field; } -@@ -66,6 +70,71 @@ +@@ -66,6 +71,71 @@ // Public Code //-------------------------------------------------------------------------------------------------- @@ -908,7 +910,7 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/exception.rs 13_exceptions_par //! crate::exception::arch_exception +use crate::{bsp, exception}; - use core::{cell::UnsafeCell, fmt}; + use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ @@ -91,8 +92,11 @@ @@ -2413,13 +2415,13 @@ diff -uNr 12_integrated_testing/src/lib.rs 13_exceptions_part2_peripheral_IRQs/s #![allow(clippy::upper_case_acronyms)] #![allow(incomplete_features)] -+#![feature(asm)] ++#![feature(asm_const)] #![feature(const_fn_fn_ptr_basics)] +#![feature(const_fn_trait_bound)] #![feature(core_intrinsics)] #![feature(format_args_nl)] - #![feature(global_asm)] -@@ -132,6 +134,7 @@ + #![feature(linkage)] +@@ -131,6 +133,7 @@ pub mod exception; pub mod memory; pub mod print; diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.rs b/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.rs index 4f006862..f54ae739 100644 --- a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.rs +++ b/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/cpu/boot.rs @@ -11,6 +11,7 @@ //! //! crate::cpu::boot::arch_boot +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs b/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs index 880cc92b..708f63dd 100644 --- a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs +++ b/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs @@ -12,7 +12,7 @@ //! crate::exception::arch_exception use crate::{bsp, exception}; -use core::{cell::UnsafeCell, fmt}; +use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ interfaces::{Readable, Writeable}, diff --git a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs b/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs index 4e79cc8a..799ab4e8 100644 --- a/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs +++ b/13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs @@ -11,6 +11,7 @@ //! //! crate::exception::asynchronous::arch_asynchronous +use core::arch::asm; use cortex_a::registers::*; use tock_registers::interfaces::{Readable, Writeable}; diff --git a/13_exceptions_part2_peripheral_IRQs/src/lib.rs b/13_exceptions_part2_peripheral_IRQs/src/lib.rs index af4f6240..5b1eb3e1 100644 --- a/13_exceptions_part2_peripheral_IRQs/src/lib.rs +++ b/13_exceptions_part2_peripheral_IRQs/src/lib.rs @@ -108,12 +108,11 @@ #![allow(clippy::upper_case_acronyms)] #![allow(incomplete_features)] -#![feature(asm)] +#![feature(asm_const)] #![feature(const_fn_fn_ptr_basics)] #![feature(const_fn_trait_bound)] #![feature(core_intrinsics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(linkage)] #![feature(panic_info_message)] #![feature(trait_alias)] diff --git a/14_virtual_mem_part2_mmio_remap/Cargo.lock b/14_virtual_mem_part2_mmio_remap/Cargo.lock index 41426eba..38d026fd 100644 --- a/14_virtual_mem_part2_mmio_remap/Cargo.lock +++ b/14_virtual_mem_part2_mmio_remap/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "qemu-exit" -version = "2.0.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389" +checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543" [[package]] name = "quote" diff --git a/14_virtual_mem_part2_mmio_remap/Cargo.toml b/14_virtual_mem_part2_mmio_remap/Cargo.toml index d3b17db1..760dbce2 100644 --- a/14_virtual_mem_part2_mmio_remap/Cargo.toml +++ b/14_virtual_mem_part2_mmio_remap/Cargo.toml @@ -22,11 +22,11 @@ test-types = { path = "test-types" } # Optional dependencies tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "2.x.x", optional = true } +qemu-exit = { version = "3.x.x", optional = true } # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } +cortex-a = { version = "7.x.x" } ##-------------------------------------------------------------------------------------------------- ## Testing diff --git a/14_virtual_mem_part2_mmio_remap/README.md b/14_virtual_mem_part2_mmio_remap/README.md index 8fac022a..a068bc7a 100644 --- a/14_virtual_mem_part2_mmio_remap/README.md +++ b/14_virtual_mem_part2_mmio_remap/README.md @@ -1021,16 +1021,14 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs handler_table: InitStateLock::new([None; Self::NUM_IRQS]), } } -@@ -139,6 +152,22 @@ +@@ -139,6 +152,20 @@ } unsafe fn init(&self) -> Result<(), &'static str> { + let remapped = self.is_mmio_remapped.load(Ordering::Relaxed); + if !remapped { -+ let mut virt_addr; -+ + // GICD -+ virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; ++ let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; + self.gicd.set_mmio(virt_addr.as_usize()); + + // GICC @@ -2137,19 +2135,18 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/driver.rs 14_virtual_mem_part2 diff -uNr 13_exceptions_part2_peripheral_IRQs/src/lib.rs 14_virtual_mem_part2_mmio_remap/src/lib.rs --- 13_exceptions_part2_peripheral_IRQs/src/lib.rs +++ 14_virtual_mem_part2_mmio_remap/src/lib.rs -@@ -113,9 +113,11 @@ +@@ -113,8 +113,10 @@ #![feature(const_fn_trait_bound)] #![feature(core_intrinsics)] #![feature(format_args_nl)] +#![feature(generic_const_exprs)] - #![feature(global_asm)] #![feature(linkage)] #![feature(panic_info_message)] +#![feature(step_trait)] #![feature(trait_alias)] #![no_std] // Testing -@@ -128,6 +130,7 @@ +@@ -127,6 +129,7 @@ mod synchronization; pub mod bsp; @@ -2157,7 +2154,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/lib.rs 14_virtual_mem_part2_mm pub mod console; pub mod cpu; pub mod driver; -@@ -180,6 +183,7 @@ +@@ -179,6 +182,7 @@ #[no_mangle] unsafe fn kernel_init() -> ! { exception::handling_init(); @@ -3430,7 +3427,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu.rs 14_virtual_mem_p diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2_mmio_remap/src/memory.rs --- 13_exceptions_part2_peripheral_IRQs/src/memory.rs +++ 14_virtual_mem_part2_mmio_remap/src/memory.rs -@@ -5,3 +5,161 @@ +@@ -5,3 +5,163 @@ //! Memory Management. pub mod mmu; @@ -3486,6 +3483,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2 + } + + /// Align down to page size. ++ #[must_use] + pub const fn align_down_page(self) -> Self { + let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE); + @@ -3493,6 +3491,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2 + } + + /// Align up to page size. ++ #[must_use] + pub const fn align_up_page(self) -> Self { + let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE); + diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs b/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs index 4f006862..f54ae739 100644 --- a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs +++ b/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs @@ -11,6 +11,7 @@ //! //! crate::cpu::boot::arch_boot +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs b/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs index 880cc92b..708f63dd 100644 --- a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs +++ b/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs @@ -12,7 +12,7 @@ //! crate::exception::arch_exception use crate::{bsp, exception}; -use core::{cell::UnsafeCell, fmt}; +use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ interfaces::{Readable, Writeable}, diff --git a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs b/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs index 4e79cc8a..799ab4e8 100644 --- a/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs +++ b/14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs @@ -11,6 +11,7 @@ //! //! crate::exception::asynchronous::arch_asynchronous +use core::arch::asm; use cortex_a::registers::*; use tock_registers::interfaces::{Readable, Writeable}; diff --git a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs b/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs index 3f69bd11..bbafa5fe 100644 --- a/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs +++ b/14_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2.rs @@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 { unsafe fn init(&self) -> Result<(), &'static str> { let remapped = self.is_mmio_remapped.load(Ordering::Relaxed); if !remapped { - let mut virt_addr; - // GICD - virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; + let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; self.gicd.set_mmio(virt_addr.as_usize()); // GICC diff --git a/14_virtual_mem_part2_mmio_remap/src/lib.rs b/14_virtual_mem_part2_mmio_remap/src/lib.rs index 6b944627..d36e5448 100644 --- a/14_virtual_mem_part2_mmio_remap/src/lib.rs +++ b/14_virtual_mem_part2_mmio_remap/src/lib.rs @@ -108,13 +108,12 @@ #![allow(clippy::upper_case_acronyms)] #![allow(incomplete_features)] -#![feature(asm)] +#![feature(asm_const)] #![feature(const_fn_fn_ptr_basics)] #![feature(const_fn_trait_bound)] #![feature(core_intrinsics)] #![feature(format_args_nl)] #![feature(generic_const_exprs)] -#![feature(global_asm)] #![feature(linkage)] #![feature(panic_info_message)] #![feature(step_trait)] diff --git a/14_virtual_mem_part2_mmio_remap/src/memory.rs b/14_virtual_mem_part2_mmio_remap/src/memory.rs index 36054173..f33ca323 100644 --- a/14_virtual_mem_part2_mmio_remap/src/memory.rs +++ b/14_virtual_mem_part2_mmio_remap/src/memory.rs @@ -57,6 +57,7 @@ impl Address { } /// Align down to page size. + #[must_use] pub const fn align_down_page(self) -> Self { let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE); @@ -64,6 +65,7 @@ impl Address { } /// Align up to page size. + #[must_use] pub const fn align_up_page(self) -> Self { let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE); diff --git a/15_virtual_mem_part3_precomputed_tables/Cargo.lock b/15_virtual_mem_part3_precomputed_tables/Cargo.lock index 6cb12baa..6c03310c 100644 --- a/15_virtual_mem_part3_precomputed_tables/Cargo.lock +++ b/15_virtual_mem_part3_precomputed_tables/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "qemu-exit" -version = "2.0.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389" +checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543" [[package]] name = "quote" diff --git a/15_virtual_mem_part3_precomputed_tables/Cargo.toml b/15_virtual_mem_part3_precomputed_tables/Cargo.toml index 91a69bf3..ea20f0db 100644 --- a/15_virtual_mem_part3_precomputed_tables/Cargo.toml +++ b/15_virtual_mem_part3_precomputed_tables/Cargo.toml @@ -22,11 +22,11 @@ test-types = { path = "test-types" } # Optional dependencies tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "2.x.x", optional = true } +qemu-exit = { version = "3.x.x", optional = true } # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } +cortex-a = { version = "7.x.x" } ##-------------------------------------------------------------------------------------------------- ## Testing diff --git a/15_virtual_mem_part3_precomputed_tables/README.md b/15_virtual_mem_part3_precomputed_tables/README.md index f0067cda..f87d297a 100644 --- a/15_virtual_mem_part3_precomputed_tables/README.md +++ b/15_virtual_mem_part3_precomputed_tables/README.md @@ -821,10 +821,10 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs 15_virtu //! crate::cpu::boot::arch_boot +use crate::{memory, memory::Address}; + use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; - -@@ -70,9 +71,16 @@ +@@ -71,9 +72,16 @@ /// /// - Exception return from EL2 must must continue execution in EL1 with `kernel_init()`. #[no_mangle] @@ -1167,7 +1167,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v //-------------------------------------------------------------------------------------------------- // Global instances -@@ -43,13 +43,34 @@ +@@ -43,13 +43,35 @@ /// /// That is, `size_of(InitStateLock) == size_of(KernelTranslationTable)`. /// There is a unit tests that checks this porperty. @@ -1192,6 +1192,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v +/// This is a hack for retrieving the value for the kernel's virtual address space size as a +/// constant from a common place, since it is needed as a compile-time/link-time constant in both, +/// the linker script and the Rust sources. ++#[allow(clippy::needless_late_init)] +const fn kernel_virt_addr_space_size() -> usize { + let __kernel_virt_addr_space_size; + @@ -1203,7 +1204,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v /// Helper function for calculating the number of pages the given parameter spans. const fn size_to_num_pages(size: usize) -> usize { assert!(size > 0); -@@ -88,18 +109,22 @@ +@@ -88,18 +110,22 @@ MemoryRegion::new(start_page_addr, end_exclusive_page_addr) } @@ -1237,7 +1238,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v } //-------------------------------------------------------------------------------------------------- -@@ -121,109 +146,33 @@ +@@ -121,109 +147,33 @@ MemoryRegion::new(start_page_addr, end_exclusive_page_addr) } diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs b/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs index 52195d8f..e604e112 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs @@ -12,6 +12,7 @@ //! crate::cpu::boot::arch_boot use crate::{memory, memory::Address}; +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.rs b/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.rs index 880cc92b..708f63dd 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception.rs @@ -12,7 +12,7 @@ //! crate::exception::arch_exception use crate::{bsp, exception}; -use core::{cell::UnsafeCell, fmt}; +use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ interfaces::{Readable, Writeable}, diff --git a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception/asynchronous.rs b/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception/asynchronous.rs index 4e79cc8a..799ab4e8 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception/asynchronous.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/exception/asynchronous.rs @@ -11,6 +11,7 @@ //! //! crate::exception::asynchronous::arch_asynchronous +use core::arch::asm; use cortex_a::registers::*; use tock_registers::interfaces::{Readable, Writeable}; diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2.rs b/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2.rs index 3f69bd11..bbafa5fe 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/bsp/device_driver/arm/gicv2.rs @@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 { unsafe fn init(&self) -> Result<(), &'static str> { let remapped = self.is_mmio_remapped.load(Ordering::Relaxed); if !remapped { - let mut virt_addr; - // GICD - virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; + let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; self.gicd.set_mmio(virt_addr.as_usize()); // GICC diff --git a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs b/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs index 2881ab11..441000db 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu.rs @@ -63,6 +63,7 @@ static PHYS_KERNEL_TABLES_BASE_ADDR: u64 = 0xCCCCAAAAFFFFEEEE; /// This is a hack for retrieving the value for the kernel's virtual address space size as a /// constant from a common place, since it is needed as a compile-time/link-time constant in both, /// the linker script and the Rust sources. +#[allow(clippy::needless_late_init)] const fn kernel_virt_addr_space_size() -> usize { let __kernel_virt_addr_space_size; diff --git a/15_virtual_mem_part3_precomputed_tables/src/lib.rs b/15_virtual_mem_part3_precomputed_tables/src/lib.rs index 6b944627..d36e5448 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/lib.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/lib.rs @@ -108,13 +108,12 @@ #![allow(clippy::upper_case_acronyms)] #![allow(incomplete_features)] -#![feature(asm)] +#![feature(asm_const)] #![feature(const_fn_fn_ptr_basics)] #![feature(const_fn_trait_bound)] #![feature(core_intrinsics)] #![feature(format_args_nl)] #![feature(generic_const_exprs)] -#![feature(global_asm)] #![feature(linkage)] #![feature(panic_info_message)] #![feature(step_trait)] diff --git a/15_virtual_mem_part3_precomputed_tables/src/memory.rs b/15_virtual_mem_part3_precomputed_tables/src/memory.rs index 36054173..f33ca323 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/memory.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/memory.rs @@ -57,6 +57,7 @@ impl Address { } /// Align down to page size. + #[must_use] pub const fn align_down_page(self) -> Self { let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE); @@ -64,6 +65,7 @@ impl Address { } /// Align up to page size. + #[must_use] pub const fn align_up_page(self) -> Self { let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE); diff --git a/16_virtual_mem_part4_higher_half_kernel/Cargo.lock b/16_virtual_mem_part4_higher_half_kernel/Cargo.lock index d2e5b0d6..13d1d928 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Cargo.lock +++ b/16_virtual_mem_part4_higher_half_kernel/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "qemu-exit" -version = "2.0.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389" +checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543" [[package]] name = "quote" diff --git a/16_virtual_mem_part4_higher_half_kernel/Cargo.toml b/16_virtual_mem_part4_higher_half_kernel/Cargo.toml index 9bf6df42..07a1c57e 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Cargo.toml +++ b/16_virtual_mem_part4_higher_half_kernel/Cargo.toml @@ -22,11 +22,11 @@ test-types = { path = "test-types" } # Optional dependencies tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } -qemu-exit = { version = "2.x.x", optional = true } +qemu-exit = { version = "3.x.x", optional = true } # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } +cortex-a = { version = "7.x.x" } ##-------------------------------------------------------------------------------------------------- ## Testing diff --git a/16_virtual_mem_part4_higher_half_kernel/README.md b/16_virtual_mem_part4_higher_half_kernel/README.md index 86276cde..bde23439 100644 --- a/16_virtual_mem_part4_higher_half_kernel/README.md +++ b/16_virtual_mem_part4_higher_half_kernel/README.md @@ -340,7 +340,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/Cargo.toml 16_virtual_mem_part diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs --- 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs +++ 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs -@@ -29,7 +29,10 @@ +@@ -30,7 +30,10 @@ /// - The `bss` section is not initialized yet. The code must not use or reference it in any way. /// - The HW state of EL1 must be prepared in a sound way. #[inline(always)] @@ -352,7 +352,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs // Enable timer counter registers for EL1. CNTHCTL_EL2.write(CNTHCTL_EL2::EL1PCEN::SET + CNTHCTL_EL2::EL1PCTEN::SET); -@@ -52,11 +55,11 @@ +@@ -53,11 +56,11 @@ ); // Second, let the link register point to kernel_init(). @@ -366,7 +366,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs } //-------------------------------------------------------------------------------------------------- -@@ -73,14 +76,19 @@ +@@ -74,14 +77,19 @@ #[no_mangle] pub unsafe extern "C" fn _start_rust( phys_kernel_tables_base_addr: u64, @@ -731,7 +731,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu //-------------------------------------------------------------------------------------------------- // Public Definitions -@@ -152,14 +152,6 @@ +@@ -153,14 +153,6 @@ /// `translation table tool` and patched into the kernel binary. This function just adds the mapping /// record entries. pub fn kernel_add_mapping_records_for_precomputed() { @@ -746,7 +746,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu let virt_code_region = virt_code_region(); generic_mmu::kernel_add_mapping_record( "Kernel code and RO data", -@@ -175,4 +167,12 @@ +@@ -176,4 +168,12 @@ &kernel_virt_to_phys_region(virt_data_region), &kernel_page_attributes(virt_data_region.start_page_addr()), ); @@ -799,7 +799,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory.rs diff -uNr 15_virtual_mem_part3_precomputed_tables/src/lib.rs 16_virtual_mem_part4_higher_half_kernel/src/lib.rs --- 15_virtual_mem_part3_precomputed_tables/src/lib.rs +++ 16_virtual_mem_part4_higher_half_kernel/src/lib.rs -@@ -153,11 +153,6 @@ +@@ -152,11 +152,6 @@ ) } diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs b/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs index 96a5bbb3..87f120d2 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs @@ -12,6 +12,7 @@ //! crate::cpu::boot::arch_boot use crate::{memory, memory::Address}; +use core::arch::global_asm; use cortex_a::{asm, registers::*}; use tock_registers::interfaces::Writeable; diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.rs b/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.rs index 880cc92b..708f63dd 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception.rs @@ -12,7 +12,7 @@ //! crate::exception::arch_exception use crate::{bsp, exception}; -use core::{cell::UnsafeCell, fmt}; +use core::{arch::global_asm, cell::UnsafeCell, fmt}; use cortex_a::{asm::barrier, registers::*}; use tock_registers::{ interfaces::{Readable, Writeable}, diff --git a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception/asynchronous.rs b/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception/asynchronous.rs index 4e79cc8a..799ab4e8 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception/asynchronous.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/exception/asynchronous.rs @@ -11,6 +11,7 @@ //! //! crate::exception::asynchronous::arch_asynchronous +use core::arch::asm; use cortex_a::registers::*; use tock_registers::interfaces::{Readable, Writeable}; diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2.rs b/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2.rs index 3f69bd11..bbafa5fe 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/bsp/device_driver/arm/gicv2.rs @@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 { unsafe fn init(&self) -> Result<(), &'static str> { let remapped = self.is_mmio_remapped.load(Ordering::Relaxed); if !remapped { - let mut virt_addr; - // GICD - virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; + let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?; self.gicd.set_mmio(virt_addr.as_usize()); // GICC diff --git a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs b/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs index 07df4483..86e09c01 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/bsp/raspberrypi/memory/mmu.rs @@ -63,6 +63,7 @@ static PHYS_KERNEL_TABLES_BASE_ADDR: u64 = 0xCCCCAAAAFFFFEEEE; /// This is a hack for retrieving the value for the kernel's virtual address space size as a /// constant from a common place, since it is needed as a compile-time/link-time constant in both, /// the linker script and the Rust sources. +#[allow(clippy::needless_late_init)] const fn kernel_virt_addr_space_size() -> usize { let __kernel_virt_addr_space_size; diff --git a/16_virtual_mem_part4_higher_half_kernel/src/lib.rs b/16_virtual_mem_part4_higher_half_kernel/src/lib.rs index f768643a..7fd5a761 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/lib.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/lib.rs @@ -108,13 +108,12 @@ #![allow(clippy::upper_case_acronyms)] #![allow(incomplete_features)] -#![feature(asm)] +#![feature(asm_const)] #![feature(const_fn_fn_ptr_basics)] #![feature(const_fn_trait_bound)] #![feature(core_intrinsics)] #![feature(format_args_nl)] #![feature(generic_const_exprs)] -#![feature(global_asm)] #![feature(linkage)] #![feature(panic_info_message)] #![feature(step_trait)] diff --git a/16_virtual_mem_part4_higher_half_kernel/src/memory.rs b/16_virtual_mem_part4_higher_half_kernel/src/memory.rs index 36054173..f33ca323 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/memory.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/memory.rs @@ -57,6 +57,7 @@ impl Address { } /// Align down to page size. + #[must_use] pub const fn align_down_page(self) -> Self { let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE); @@ -64,6 +65,7 @@ impl Address { } /// Align up to page size. + #[must_use] pub const fn align_up_page(self) -> Self { let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE); diff --git a/X1_JTAG_boot/Cargo.lock b/X1_JTAG_boot/Cargo.lock index 884ec5f0..2abe1c74 100644 --- a/X1_JTAG_boot/Cargo.lock +++ b/X1_JTAG_boot/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "cortex-a" -version = "6.1.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733" +checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f" dependencies = [ "tock-registers", ] diff --git a/X1_JTAG_boot/Cargo.toml b/X1_JTAG_boot/Cargo.toml index b6d42173..638d4de1 100644 --- a/X1_JTAG_boot/Cargo.toml +++ b/X1_JTAG_boot/Cargo.toml @@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] -cortex-a = { version = "6.x.x" } - +cortex-a = { version = "7.x.x" } diff --git a/X1_JTAG_boot/jtag_boot_rpi3.img b/X1_JTAG_boot/jtag_boot_rpi3.img index be80f810..76a5d4c6 100755 Binary files a/X1_JTAG_boot/jtag_boot_rpi3.img and b/X1_JTAG_boot/jtag_boot_rpi3.img differ diff --git a/X1_JTAG_boot/jtag_boot_rpi4.img b/X1_JTAG_boot/jtag_boot_rpi4.img index f09f82c3..ec6a26ea 100755 Binary files a/X1_JTAG_boot/jtag_boot_rpi4.img and b/X1_JTAG_boot/jtag_boot_rpi4.img differ diff --git a/X1_JTAG_boot/src/_arch/aarch64/cpu/boot.rs b/X1_JTAG_boot/src/_arch/aarch64/cpu/boot.rs index 7513df07..a8defcda 100644 --- a/X1_JTAG_boot/src/_arch/aarch64/cpu/boot.rs +++ b/X1_JTAG_boot/src/_arch/aarch64/cpu/boot.rs @@ -12,7 +12,7 @@ //! crate::cpu::boot::arch_boot // Assembly counterpart to this file. -global_asm!(include_str!("boot.s")); +core::arch::global_asm!(include_str!("boot.s")); //-------------------------------------------------------------------------------------------------- // Public Code diff --git a/X1_JTAG_boot/src/main.rs b/X1_JTAG_boot/src/main.rs index 23221621..4f0a6ffc 100644 --- a/X1_JTAG_boot/src/main.rs +++ b/X1_JTAG_boot/src/main.rs @@ -107,7 +107,6 @@ #![allow(clippy::upper_case_acronyms)] #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] -#![feature(global_asm)] #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6051e9b6..19f8449a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2021-10-10" +channel = "nightly-2021-12-18" components = ["llvm-tools-preview"] targets = ["aarch64-unknown-none-softfloat"]