diff --git a/04_zero_overhead_abstraction/Cargo.lock b/04_zero_overhead_abstraction/Cargo.lock index ce6da734..9f7767f8 100644 --- a/04_zero_overhead_abstraction/Cargo.lock +++ b/04_zero_overhead_abstraction/Cargo.lock @@ -2,33 +2,31 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/04_zero_overhead_abstraction/Cargo.toml b/04_zero_overhead_abstraction/Cargo.toml index 781328f2..850ca5b0 100644 --- a/04_zero_overhead_abstraction/Cargo.toml +++ b/04_zero_overhead_abstraction/Cargo.toml @@ -13,4 +13,4 @@ bsp_rpi4 = ["cortex-a"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } diff --git a/04_zero_overhead_abstraction/README.md b/04_zero_overhead_abstraction/README.md index 06f1b4f8..40271ab1 100644 --- a/04_zero_overhead_abstraction/README.md +++ b/04_zero_overhead_abstraction/README.md @@ -25,7 +25,7 @@ diff -uNr 03_hacky_hello_world/Cargo.toml 04_zero_overhead_abstraction/Cargo.tom [dependencies] + +# Optional dependencies -+cortex-a = { version = "3.0.x", optional = true } ++cortex-a = { version = "4.x.x", optional = true } diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu/smp.rs 04_zero_overhead_abstraction/src/_arch/aarch64/cpu/smp.rs --- 03_hacky_hello_world/src/_arch/aarch64/cpu/smp.rs diff --git a/05_safe_globals/Cargo.lock b/05_safe_globals/Cargo.lock index ce6da734..9f7767f8 100644 --- a/05_safe_globals/Cargo.lock +++ b/05_safe_globals/Cargo.lock @@ -2,33 +2,31 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/05_safe_globals/Cargo.toml b/05_safe_globals/Cargo.toml index 781328f2..850ca5b0 100644 --- a/05_safe_globals/Cargo.toml +++ b/05_safe_globals/Cargo.toml @@ -13,4 +13,4 @@ bsp_rpi4 = ["cortex-a"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } diff --git a/06_drivers_gpio_uart/Cargo.lock b/06_drivers_gpio_uart/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/06_drivers_gpio_uart/Cargo.lock +++ b/06_drivers_gpio_uart/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/06_drivers_gpio_uart/Cargo.toml b/06_drivers_gpio_uart/Cargo.toml index d5956e2b..82941512 100644 --- a/06_drivers_gpio_uart/Cargo.toml +++ b/06_drivers_gpio_uart/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/06_drivers_gpio_uart/README.md b/06_drivers_gpio_uart/README.md index 6481a31f..96ba5474 100644 --- a/06_drivers_gpio_uart/README.md +++ b/06_drivers_gpio_uart/README.md @@ -106,7 +106,7 @@ diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml [dependencies] # Optional dependencies - cortex-a = { version = "3.0.x", optional = true } + cortex-a = { version = "4.x.x", optional = true } +register = { version = "0.5.x", optional = true } diff -uNr 05_safe_globals/src/_arch/aarch64/cpu.rs 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs diff --git a/07_uart_chainloader/Cargo.lock b/07_uart_chainloader/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/07_uart_chainloader/Cargo.lock +++ b/07_uart_chainloader/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/07_uart_chainloader/Cargo.toml b/07_uart_chainloader/Cargo.toml index d5956e2b..82941512 100644 --- a/07_uart_chainloader/Cargo.toml +++ b/07_uart_chainloader/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/08_timestamps/Cargo.lock b/08_timestamps/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/08_timestamps/Cargo.lock +++ b/08_timestamps/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/08_timestamps/Cargo.toml b/08_timestamps/Cargo.toml index d5956e2b..82941512 100644 --- a/08_timestamps/Cargo.toml +++ b/08_timestamps/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/08_timestamps/README.md b/08_timestamps/README.md index a5bc09c9..655ea304 100644 --- a/08_timestamps/README.md +++ b/08_timestamps/README.md @@ -122,7 +122,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/cpu.rs 08_timestamps/src/_arch/a diff -uNr 07_uart_chainloader/src/_arch/aarch64/time.rs 08_timestamps/src/_arch/aarch64/time.rs --- 07_uart_chainloader/src/_arch/aarch64/time.rs +++ 08_timestamps/src/_arch/aarch64/time.rs -@@ -0,0 +1,97 @@ +@@ -0,0 +1,98 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2020 Andre Richter @@ -193,6 +193,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/time.rs 08_timestamps/src/_arch/ + // Check if it is within supported bounds. + let warn: Option<&str> = if tval == 0 { + Some("smaller") ++ // The upper 32 bits of CNTP_TVAL_EL0 are reserved. + } else if tval > u32::max_value().into() { + Some("bigger") + } else { @@ -208,7 +209,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/time.rs 08_timestamps/src/_arch/ + } + + // Set the compare value register. -+ CNTP_TVAL_EL0.set(tval as u32); ++ CNTP_TVAL_EL0.set(tval); + + // Kick off the counting. // Disable timer interrupt. + CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/08_timestamps/src/_arch/aarch64/time.rs b/08_timestamps/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/08_timestamps/src/_arch/aarch64/time.rs +++ b/08_timestamps/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/09_hw_debug_JTAG/Cargo.lock b/09_hw_debug_JTAG/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/09_hw_debug_JTAG/Cargo.lock +++ b/09_hw_debug_JTAG/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/09_hw_debug_JTAG/Cargo.toml b/09_hw_debug_JTAG/Cargo.toml index d5956e2b..82941512 100644 --- a/09_hw_debug_JTAG/Cargo.toml +++ b/09_hw_debug_JTAG/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/09_hw_debug_JTAG/src/_arch/aarch64/time.rs b/09_hw_debug_JTAG/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/09_hw_debug_JTAG/src/_arch/aarch64/time.rs +++ b/09_hw_debug_JTAG/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/10_privilege_level/Cargo.lock b/10_privilege_level/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/10_privilege_level/Cargo.lock +++ b/10_privilege_level/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/10_privilege_level/Cargo.toml b/10_privilege_level/Cargo.toml index d5956e2b..82941512 100644 --- a/10_privilege_level/Cargo.toml +++ b/10_privilege_level/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/10_privilege_level/README.md b/10_privilege_level/README.md index 68046efe..8765505b 100644 --- a/10_privilege_level/README.md +++ b/10_privilege_level/README.md @@ -308,7 +308,7 @@ diff -uNr 09_hw_debug_JTAG/src/_arch/aarch64/exception/asynchronous.rs 10_privil +//-------------------------------------------------------------------------------------------------- + +trait DaifField { -+ fn daif_field() -> register::Field; ++ fn daif_field() -> register::Field; +} + +struct Debug; @@ -321,25 +321,25 @@ diff -uNr 09_hw_debug_JTAG/src/_arch/aarch64/exception/asynchronous.rs 10_privil +//-------------------------------------------------------------------------------------------------- + +impl DaifField for Debug { -+ fn daif_field() -> register::Field { ++ fn daif_field() -> register::Field { + DAIF::D + } +} + +impl DaifField for SError { -+ fn daif_field() -> register::Field { ++ fn daif_field() -> register::Field { + DAIF::A + } +} + +impl DaifField for IRQ { -+ fn daif_field() -> register::Field { ++ fn daif_field() -> register::Field { + DAIF::I + } +} + +impl DaifField for FIQ { -+ fn daif_field() -> register::Field { ++ fn daif_field() -> register::Field { + DAIF::F + } +} diff --git a/10_privilege_level/src/_arch/aarch64/exception/asynchronous.rs b/10_privilege_level/src/_arch/aarch64/exception/asynchronous.rs index 1cc2fba8..b57ce029 100644 --- a/10_privilege_level/src/_arch/aarch64/exception/asynchronous.rs +++ b/10_privilege_level/src/_arch/aarch64/exception/asynchronous.rs @@ -11,7 +11,7 @@ use cortex_a::regs::*; //-------------------------------------------------------------------------------------------------- trait DaifField { - fn daif_field() -> register::Field; + fn daif_field() -> register::Field; } struct Debug; @@ -24,25 +24,25 @@ struct FIQ; //-------------------------------------------------------------------------------------------------- impl DaifField for Debug { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::D } } impl DaifField for SError { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::A } } impl DaifField for IRQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::I } } impl DaifField for FIQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::F } } diff --git a/10_privilege_level/src/_arch/aarch64/time.rs b/10_privilege_level/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/10_privilege_level/src/_arch/aarch64/time.rs +++ b/10_privilege_level/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/11_virtual_mem_part1_identity_mapping/Cargo.lock b/11_virtual_mem_part1_identity_mapping/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/11_virtual_mem_part1_identity_mapping/Cargo.lock +++ b/11_virtual_mem_part1_identity_mapping/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/11_virtual_mem_part1_identity_mapping/Cargo.toml b/11_virtual_mem_part1_identity_mapping/Cargo.toml index d5956e2b..82941512 100644 --- a/11_virtual_mem_part1_identity_mapping/Cargo.toml +++ b/11_virtual_mem_part1_identity_mapping/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception/asynchronous.rs b/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception/asynchronous.rs index 1cc2fba8..b57ce029 100644 --- a/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception/asynchronous.rs +++ b/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception/asynchronous.rs @@ -11,7 +11,7 @@ use cortex_a::regs::*; //-------------------------------------------------------------------------------------------------- trait DaifField { - fn daif_field() -> register::Field; + fn daif_field() -> register::Field; } struct Debug; @@ -24,25 +24,25 @@ struct FIQ; //-------------------------------------------------------------------------------------------------- impl DaifField for Debug { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::D } } impl DaifField for SError { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::A } } impl DaifField for IRQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::I } } impl DaifField for FIQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::F } } diff --git a/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/time.rs b/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/time.rs +++ b/11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/12_exceptions_part1_groundwork/Cargo.lock b/12_exceptions_part1_groundwork/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/12_exceptions_part1_groundwork/Cargo.lock +++ b/12_exceptions_part1_groundwork/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/12_exceptions_part1_groundwork/Cargo.toml b/12_exceptions_part1_groundwork/Cargo.toml index d5956e2b..82941512 100644 --- a/12_exceptions_part1_groundwork/Cargo.toml +++ b/12_exceptions_part1_groundwork/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/12_exceptions_part1_groundwork/README.md b/12_exceptions_part1_groundwork/README.md index 7b9c15c4..e99ba7a2 100644 --- a/12_exceptions_part1_groundwork/README.md +++ b/12_exceptions_part1_groundwork/README.md @@ -499,7 +499,7 @@ diff -uNr 11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs 1 + +/// Wrapper struct for memory copy of SPSR_EL1. +#[repr(transparent)] -+struct SpsrEL1(InMemoryRegister); ++struct SpsrEL1(InMemoryRegister); + +/// The exception context as it is stored on the stack on exception entry. +#[repr(C)] @@ -774,7 +774,7 @@ diff -uNr 11_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.S 12 + mrs x2, SPSR_EL1 + + stp lr, x1, [sp, #16 * 15] -+ str w2, [sp, #16 * 16] ++ str x2, [sp, #16 * 16] + + // x0 is the first argument for the function called through `\handler`. + mov x0, sp diff --git a/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.S b/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.S index 70817be4..ee3b5497 100644 --- a/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.S +++ b/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.S @@ -30,7 +30,7 @@ mrs x2, SPSR_EL1 stp lr, x1, [sp, #16 * 15] - str w2, [sp, #16 * 16] + str x2, [sp, #16 * 16] // x0 is the first argument for the function called through `\handler`. mov x0, sp diff --git a/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs b/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs index 91287bf6..d932445c 100644 --- a/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs +++ b/12_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs @@ -17,7 +17,7 @@ global_asm!(include_str!("exception.S")); /// Wrapper struct for memory copy of SPSR_EL1. #[repr(transparent)] -struct SpsrEL1(InMemoryRegister); +struct SpsrEL1(InMemoryRegister); /// The exception context as it is stored on the stack on exception entry. #[repr(C)] diff --git a/12_exceptions_part1_groundwork/src/_arch/aarch64/exception/asynchronous.rs b/12_exceptions_part1_groundwork/src/_arch/aarch64/exception/asynchronous.rs index 1cc2fba8..b57ce029 100644 --- a/12_exceptions_part1_groundwork/src/_arch/aarch64/exception/asynchronous.rs +++ b/12_exceptions_part1_groundwork/src/_arch/aarch64/exception/asynchronous.rs @@ -11,7 +11,7 @@ use cortex_a::regs::*; //-------------------------------------------------------------------------------------------------- trait DaifField { - fn daif_field() -> register::Field; + fn daif_field() -> register::Field; } struct Debug; @@ -24,25 +24,25 @@ struct FIQ; //-------------------------------------------------------------------------------------------------- impl DaifField for Debug { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::D } } impl DaifField for SError { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::A } } impl DaifField for IRQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::I } } impl DaifField for FIQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::F } } diff --git a/12_exceptions_part1_groundwork/src/_arch/aarch64/time.rs b/12_exceptions_part1_groundwork/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/12_exceptions_part1_groundwork/src/_arch/aarch64/time.rs +++ b/12_exceptions_part1_groundwork/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/13_integrated_testing/Cargo.lock b/13_integrated_testing/Cargo.lock index c0df2028..b7cf3d96 100644 --- a/13_integrated_testing/Cargo.lock +++ b/13_integrated_testing/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ "register", ] @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid", ] @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.42" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" dependencies = [ "proc-macro2", "quote", diff --git a/13_integrated_testing/Cargo.toml b/13_integrated_testing/Cargo.toml index 07292a2e..4a4ca49b 100644 --- a/13_integrated_testing/Cargo.toml +++ b/13_integrated_testing/Cargo.toml @@ -15,7 +15,7 @@ qemu-exit = "1.0.x" test-types = { path = "test-types" } # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } ##-------------------------------------------------------------------------------------------------- diff --git a/13_integrated_testing/README.md b/13_integrated_testing/README.md index f4829121..e4f87078 100644 --- a/13_integrated_testing/README.md +++ b/13_integrated_testing/README.md @@ -805,7 +805,7 @@ diff -uNr 12_exceptions_part1_groundwork/Cargo.toml 13_integrated_testing/Cargo. +test-types = { path = "test-types" } # Optional dependencies - cortex-a = { version = "3.0.x", optional = true } + cortex-a = { version = "4.x.x", optional = true } -register = { version = "0.5.x", optional = true } +register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } + diff --git a/13_integrated_testing/src/_arch/aarch64/exception.S b/13_integrated_testing/src/_arch/aarch64/exception.S index 70817be4..ee3b5497 100644 --- a/13_integrated_testing/src/_arch/aarch64/exception.S +++ b/13_integrated_testing/src/_arch/aarch64/exception.S @@ -30,7 +30,7 @@ mrs x2, SPSR_EL1 stp lr, x1, [sp, #16 * 15] - str w2, [sp, #16 * 16] + str x2, [sp, #16 * 16] // x0 is the first argument for the function called through `\handler`. mov x0, sp diff --git a/13_integrated_testing/src/_arch/aarch64/exception.rs b/13_integrated_testing/src/_arch/aarch64/exception.rs index bbb09b79..56f3e607 100644 --- a/13_integrated_testing/src/_arch/aarch64/exception.rs +++ b/13_integrated_testing/src/_arch/aarch64/exception.rs @@ -17,7 +17,7 @@ global_asm!(include_str!("exception.S")); /// Wrapper struct for memory copy of SPSR_EL1. #[repr(transparent)] -struct SpsrEL1(InMemoryRegister); +struct SpsrEL1(InMemoryRegister); /// The exception context as it is stored on the stack on exception entry. #[repr(C)] diff --git a/13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs b/13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs index 1cc2fba8..b57ce029 100644 --- a/13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs +++ b/13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs @@ -11,7 +11,7 @@ use cortex_a::regs::*; //-------------------------------------------------------------------------------------------------- trait DaifField { - fn daif_field() -> register::Field; + fn daif_field() -> register::Field; } struct Debug; @@ -24,25 +24,25 @@ struct FIQ; //-------------------------------------------------------------------------------------------------- impl DaifField for Debug { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::D } } impl DaifField for SError { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::A } } impl DaifField for IRQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::I } } impl DaifField for FIQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::F } } diff --git a/13_integrated_testing/src/_arch/aarch64/time.rs b/13_integrated_testing/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/13_integrated_testing/src/_arch/aarch64/time.rs +++ b/13_integrated_testing/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/14_exceptions_part2_peripheral_IRQs/Cargo.lock b/14_exceptions_part2_peripheral_IRQs/Cargo.lock index c0df2028..b7cf3d96 100644 --- a/14_exceptions_part2_peripheral_IRQs/Cargo.lock +++ b/14_exceptions_part2_peripheral_IRQs/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ "register", ] @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid", ] @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.42" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" dependencies = [ "proc-macro2", "quote", diff --git a/14_exceptions_part2_peripheral_IRQs/Cargo.toml b/14_exceptions_part2_peripheral_IRQs/Cargo.toml index 07292a2e..4a4ca49b 100644 --- a/14_exceptions_part2_peripheral_IRQs/Cargo.toml +++ b/14_exceptions_part2_peripheral_IRQs/Cargo.toml @@ -15,7 +15,7 @@ qemu-exit = "1.0.x" test-types = { path = "test-types" } # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } ##-------------------------------------------------------------------------------------------------- diff --git a/14_exceptions_part2_peripheral_IRQs/README.md b/14_exceptions_part2_peripheral_IRQs/README.md index 3e6a4f5b..fa54ab95 100644 --- a/14_exceptions_part2_peripheral_IRQs/README.md +++ b/14_exceptions_part2_peripheral_IRQs/README.md @@ -770,7 +770,7 @@ diff -uNr 13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 14_e +} + trait DaifField { - fn daif_field() -> register::Field; + fn daif_field() -> register::Field; } @@ -55,6 +59,71 @@ // Public Code @@ -823,7 +823,7 @@ diff -uNr 13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 14_e +/// +/// - Changes the HW state of the executing core. +#[inline(always)] -+pub unsafe fn local_irq_mask_save() -> u32 { ++pub unsafe fn local_irq_mask_save() -> u64 { + let saved = DAIF.get(); + local_irq_mask(); + @@ -837,7 +837,7 @@ diff -uNr 13_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 14_e +/// - Changes the HW state of the executing core. +/// - No sanity checks on the input. +#[inline(always)] -+pub unsafe fn local_irq_restore(saved: u32) { ++pub unsafe fn local_irq_restore(saved: u64) { + DAIF.set(saved); +} + diff --git a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.S b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.S index 70817be4..ee3b5497 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.S +++ b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.S @@ -30,7 +30,7 @@ mrs x2, SPSR_EL1 stp lr, x1, [sp, #16 * 15] - str w2, [sp, #16 * 16] + str x2, [sp, #16 * 16] // x0 is the first argument for the function called through `\handler`. mov x0, sp diff --git a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs index 047a2195..a4451cde 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs @@ -18,7 +18,7 @@ global_asm!(include_str!("exception.S")); /// Wrapper struct for memory copy of SPSR_EL1. #[repr(transparent)] -struct SpsrEL1(InMemoryRegister); +struct SpsrEL1(InMemoryRegister); /// The exception context as it is stored on the stack on exception entry. #[repr(C)] diff --git a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs index f09a92e6..63789a8e 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs @@ -15,7 +15,7 @@ mod daif_bits { } trait DaifField { - fn daif_field() -> register::Field; + fn daif_field() -> register::Field; } struct Debug; @@ -28,25 +28,25 @@ struct FIQ; //-------------------------------------------------------------------------------------------------- impl DaifField for Debug { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::D } } impl DaifField for SError { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::A } } impl DaifField for IRQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::I } } impl DaifField for FIQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::F } } @@ -106,7 +106,7 @@ pub unsafe fn local_irq_mask() { /// /// - Changes the HW state of the executing core. #[inline(always)] -pub unsafe fn local_irq_mask_save() -> u32 { +pub unsafe fn local_irq_mask_save() -> u64 { let saved = DAIF.get(); local_irq_mask(); @@ -120,7 +120,7 @@ pub unsafe fn local_irq_mask_save() -> u32 { /// - Changes the HW state of the executing core. /// - No sanity checks on the input. #[inline(always)] -pub unsafe fn local_irq_restore(saved: u32) { +pub unsafe fn local_irq_restore(saved: u64) { DAIF.set(saved); } diff --git a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/15_virtual_mem_part2_mmio_remap/Cargo.lock b/15_virtual_mem_part2_mmio_remap/Cargo.lock index c0df2028..b7cf3d96 100644 --- a/15_virtual_mem_part2_mmio_remap/Cargo.lock +++ b/15_virtual_mem_part2_mmio_remap/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ "register", ] @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid", ] @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.42" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" +checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" dependencies = [ "proc-macro2", "quote", diff --git a/15_virtual_mem_part2_mmio_remap/Cargo.toml b/15_virtual_mem_part2_mmio_remap/Cargo.toml index 07292a2e..4a4ca49b 100644 --- a/15_virtual_mem_part2_mmio_remap/Cargo.toml +++ b/15_virtual_mem_part2_mmio_remap/Cargo.toml @@ -15,7 +15,7 @@ qemu-exit = "1.0.x" test-types = { path = "test-types" } # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } ##-------------------------------------------------------------------------------------------------- diff --git a/15_virtual_mem_part2_mmio_remap/README.md b/15_virtual_mem_part2_mmio_remap/README.md index f15bc444..7421cc9b 100644 --- a/15_virtual_mem_part2_mmio_remap/README.md +++ b/15_virtual_mem_part2_mmio_remap/README.md @@ -782,6 +782,19 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15 assert!(bss_range.contains(&kernel_tables_addr)); } +diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs 15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs +--- 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/time.rs ++++ 15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs +@@ -55,7 +55,7 @@ + } + + // Calculate the register compare value. +- let frq = CNTFRQ_EL0.get() as u64; ++ let frq = CNTFRQ_EL0.get(); + let x = match frq.checked_mul(duration.as_nanos() as u64) { + None => { + warn!("Spin duration too long, skipping"); + diff -uNr 14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs 15_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicc.rs --- 14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs +++ 15_virtual_mem_part2_mmio_remap/src/bsp/device_driver/arm/gicv2/gicc.rs diff --git a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.S b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.S index 70817be4..ee3b5497 100644 --- a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.S +++ b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.S @@ -30,7 +30,7 @@ mrs x2, SPSR_EL1 stp lr, x1, [sp, #16 * 15] - str w2, [sp, #16 * 16] + str x2, [sp, #16 * 16] // x0 is the first argument for the function called through `\handler`. mov x0, sp diff --git a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs index 047a2195..a4451cde 100644 --- a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs +++ b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs @@ -18,7 +18,7 @@ global_asm!(include_str!("exception.S")); /// Wrapper struct for memory copy of SPSR_EL1. #[repr(transparent)] -struct SpsrEL1(InMemoryRegister); +struct SpsrEL1(InMemoryRegister); /// The exception context as it is stored on the stack on exception entry. #[repr(C)] diff --git a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs index f09a92e6..63789a8e 100644 --- a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs +++ b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception/asynchronous.rs @@ -15,7 +15,7 @@ mod daif_bits { } trait DaifField { - fn daif_field() -> register::Field; + fn daif_field() -> register::Field; } struct Debug; @@ -28,25 +28,25 @@ struct FIQ; //-------------------------------------------------------------------------------------------------- impl DaifField for Debug { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::D } } impl DaifField for SError { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::A } } impl DaifField for IRQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::I } } impl DaifField for FIQ { - fn daif_field() -> register::Field { + fn daif_field() -> register::Field { DAIF::F } } @@ -106,7 +106,7 @@ pub unsafe fn local_irq_mask() { /// /// - Changes the HW state of the executing core. #[inline(always)] -pub unsafe fn local_irq_mask_save() -> u32 { +pub unsafe fn local_irq_mask_save() -> u64 { let saved = DAIF.get(); local_irq_mask(); @@ -120,7 +120,7 @@ pub unsafe fn local_irq_mask_save() -> u32 { /// - Changes the HW state of the executing core. /// - No sanity checks on the input. #[inline(always)] -pub unsafe fn local_irq_restore(saved: u32) { +pub unsafe fn local_irq_restore(saved: u64) { DAIF.set(saved); } diff --git a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs index d23864f3..e9b0234d 100644 --- a/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs +++ b/15_virtual_mem_part2_mmio_remap/src/_arch/aarch64/time.rs @@ -55,7 +55,7 @@ impl time::interface::TimeManager for GenericTimer { } // Calculate the register compare value. - let frq = CNTFRQ_EL0.get() as u64; + let frq = CNTFRQ_EL0.get(); let x = match frq.checked_mul(duration.as_nanos() as u64) { None => { warn!("Spin duration too long, skipping"); @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET); diff --git a/X1_JTAG_boot/Cargo.lock b/X1_JTAG_boot/Cargo.lock index ac1a3bad..ab29d823 100644 --- a/X1_JTAG_boot/Cargo.lock +++ b/X1_JTAG_boot/Cargo.lock @@ -2,34 +2,32 @@ # It is not intended for manual editing. [[package]] name = "cortex-a" -version = "3.0.4" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" dependencies = [ - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register", ] [[package]] name = "kernel" version = "0.1.0" dependencies = [ - "cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-a", + "register", ] [[package]] name = "register" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" dependencies = [ - "tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tock-registers", ] [[package]] name = "tock-registers" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum cortex-a 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6922a40af4d1a2deac8c963b9f3e57311b8912490740234f1ad182425c547f80" -"checksum register 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" -"checksum tock-registers 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" +checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" diff --git a/X1_JTAG_boot/Cargo.toml b/X1_JTAG_boot/Cargo.toml index d5956e2b..82941512 100644 --- a/X1_JTAG_boot/Cargo.toml +++ b/X1_JTAG_boot/Cargo.toml @@ -13,5 +13,5 @@ bsp_rpi4 = ["cortex-a", "register"] [dependencies] # Optional dependencies -cortex-a = { version = "3.0.x", optional = true } +cortex-a = { version = "4.x.x", optional = true } register = { version = "0.5.x", optional = true } diff --git a/X1_JTAG_boot/jtag_boot_rpi3.img b/X1_JTAG_boot/jtag_boot_rpi3.img index 41c4110b..64da0156 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 ce930fa1..318a4924 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/time.rs b/X1_JTAG_boot/src/_arch/aarch64/time.rs index d23864f3..af98ddd0 100644 --- a/X1_JTAG_boot/src/_arch/aarch64/time.rs +++ b/X1_JTAG_boot/src/_arch/aarch64/time.rs @@ -68,6 +68,7 @@ impl time::interface::TimeManager for GenericTimer { // Check if it is within supported bounds. let warn: Option<&str> = if tval == 0 { Some("smaller") + // The upper 32 bits of CNTP_TVAL_EL0 are reserved. } else if tval > u32::max_value().into() { Some("bigger") } else { @@ -83,7 +84,7 @@ impl time::interface::TimeManager for GenericTimer { } // Set the compare value register. - CNTP_TVAL_EL0.set(tval as u32); + CNTP_TVAL_EL0.set(tval); // Kick off the counting. // Disable timer interrupt. CNTP_CTL_EL0.modify(CNTP_CTL_EL0::ENABLE::SET + CNTP_CTL_EL0::IMASK::SET);