diff --git a/02_runtime_init/kernel b/02_runtime_init/kernel index 64add528..e7aea5b7 100644 Binary files a/02_runtime_init/kernel and b/02_runtime_init/kernel differ diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index e8515cc8..6ffa8232 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -92,7 +92,7 @@ diff -uNr 02_runtime_init/src/bsp/rpi.rs 03_hacky_hello_world/src/bsp/rpi.rs diff -uNr 02_runtime_init/src/interface.rs 03_hacky_hello_world/src/interface.rs --- 02_runtime_init/src/interface.rs +++ 03_hacky_hello_world/src/interface.rs -@@ -0,0 +1,36 @@ +@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2019 Andre Richter @@ -124,7 +124,8 @@ diff -uNr 02_runtime_init/src/interface.rs 03_hacky_hello_world/src/interface.rs + + /// Console read functions. + pub trait Read { -+ fn read_char(&mut self) -> char { ++ /// Read a single character. ++ fn read_char(&self) -> char { + ' ' + } + } @@ -203,7 +204,7 @@ diff -uNr 02_runtime_init/src/panic_wait.rs 03_hacky_hello_world/src/panic_wait. diff -uNr 02_runtime_init/src/print.rs 03_hacky_hello_world/src/print.rs --- 02_runtime_init/src/print.rs +++ 03_hacky_hello_world/src/print.rs -@@ -0,0 +1,33 @@ +@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2019 Andre Richter @@ -213,6 +214,7 @@ diff -uNr 02_runtime_init/src/print.rs 03_hacky_hello_world/src/print.rs +use crate::{bsp, interface}; +use core::fmt; + ++#[doc(hidden)] +pub fn _print(args: fmt::Arguments) { + use interface::console::Write; + diff --git a/03_hacky_hello_world/kernel b/03_hacky_hello_world/kernel index 3bed3f75..d21f01dd 100755 Binary files a/03_hacky_hello_world/kernel and b/03_hacky_hello_world/kernel differ diff --git a/03_hacky_hello_world/src/interface.rs b/03_hacky_hello_world/src/interface.rs index 28b17379..b7c96aad 100644 --- a/03_hacky_hello_world/src/interface.rs +++ b/03_hacky_hello_world/src/interface.rs @@ -29,7 +29,8 @@ pub mod console { /// Console read functions. pub trait Read { - fn read_char(&mut self) -> char { + /// Read a single character. + fn read_char(&self) -> char { ' ' } } diff --git a/03_hacky_hello_world/src/print.rs b/03_hacky_hello_world/src/print.rs index 86e5da83..3a7bed6c 100644 --- a/03_hacky_hello_world/src/print.rs +++ b/03_hacky_hello_world/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; diff --git a/04_zero_overhead_abstraction/Cargo.lock b/04_zero_overhead_abstraction/Cargo.lock index 10ccb746..b90ca892 100644 --- a/04_zero_overhead_abstraction/Cargo.lock +++ b/04_zero_overhead_abstraction/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -23,7 +23,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -37,5 +37,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/04_zero_overhead_abstraction/README.md b/04_zero_overhead_abstraction/README.md index 10c7d27f..446d8806 100644 --- a/04_zero_overhead_abstraction/README.md +++ b/04_zero_overhead_abstraction/README.md @@ -103,11 +103,14 @@ diff -uNr 03_hacky_hello_world/src/arch/aarch64.rs 04_zero_overhead_abstraction/ diff -uNr 03_hacky_hello_world/src/bsp/rpi.rs 04_zero_overhead_abstraction/src/bsp/rpi.rs --- 03_hacky_hello_world/src/bsp/rpi.rs +++ 04_zero_overhead_abstraction/src/bsp/rpi.rs -@@ -7,6 +7,9 @@ +@@ -7,6 +7,12 @@ use crate::interface; use core::fmt; ++/// Used by `arch` code to find the early boot core. +pub const BOOT_CORE_ID: u64 = 0; ++ ++/// The early boot core's stack address. +pub const BOOT_CORE_STACK_START: u64 = 0x80_000; + /// A mystical, magical device for generating QEMU output out of the void. diff --git a/04_zero_overhead_abstraction/kernel b/04_zero_overhead_abstraction/kernel index 06269ad0..5f204deb 100755 Binary files a/04_zero_overhead_abstraction/kernel and b/04_zero_overhead_abstraction/kernel differ diff --git a/04_zero_overhead_abstraction/kernel8.img b/04_zero_overhead_abstraction/kernel8.img index 4b009eea..65fbc00f 100755 Binary files a/04_zero_overhead_abstraction/kernel8.img and b/04_zero_overhead_abstraction/kernel8.img differ diff --git a/04_zero_overhead_abstraction/src/bsp/rpi.rs b/04_zero_overhead_abstraction/src/bsp/rpi.rs index 7c9a6e36..e42a4779 100644 --- a/04_zero_overhead_abstraction/src/bsp/rpi.rs +++ b/04_zero_overhead_abstraction/src/bsp/rpi.rs @@ -7,7 +7,10 @@ use crate::interface; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; /// A mystical, magical device for generating QEMU output out of the void. diff --git a/04_zero_overhead_abstraction/src/interface.rs b/04_zero_overhead_abstraction/src/interface.rs index 28b17379..b7c96aad 100644 --- a/04_zero_overhead_abstraction/src/interface.rs +++ b/04_zero_overhead_abstraction/src/interface.rs @@ -29,7 +29,8 @@ pub mod console { /// Console read functions. pub trait Read { - fn read_char(&mut self) -> char { + /// Read a single character. + fn read_char(&self) -> char { ' ' } } diff --git a/04_zero_overhead_abstraction/src/print.rs b/04_zero_overhead_abstraction/src/print.rs index 86e5da83..3a7bed6c 100644 --- a/04_zero_overhead_abstraction/src/print.rs +++ b/04_zero_overhead_abstraction/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; diff --git a/05_safe_globals/Cargo.lock b/05_safe_globals/Cargo.lock index 10ccb746..b90ca892 100644 --- a/05_safe_globals/Cargo.lock +++ b/05_safe_globals/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -23,7 +23,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -37,5 +37,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/05_safe_globals/README.md b/05_safe_globals/README.md index 9b97f0f3..95d4a672 100644 --- a/05_safe_globals/README.md +++ b/05_safe_globals/README.md @@ -55,7 +55,7 @@ make qemu diff -uNr 04_zero_overhead_abstraction/src/arch/aarch64/sync.rs 05_safe_globals/src/arch/aarch64/sync.rs --- 04_zero_overhead_abstraction/src/arch/aarch64/sync.rs +++ 05_safe_globals/src/arch/aarch64/sync.rs -@@ -0,0 +1,52 @@ +@@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2019 Andre Richter @@ -88,6 +88,7 @@ diff -uNr 04_zero_overhead_abstraction/src/arch/aarch64/sync.rs 05_safe_globals/ +unsafe impl Sync for NullLock {} + +impl NullLock { ++ /// Wraps `data` into a new `NullLock`. + pub const fn new(data: T) -> NullLock { + NullLock { + data: UnsafeCell::new(data), @@ -125,7 +126,7 @@ diff -uNr 04_zero_overhead_abstraction/src/arch/aarch64.rs 05_safe_globals/src/a diff -uNr 04_zero_overhead_abstraction/src/bsp/rpi.rs 05_safe_globals/src/bsp/rpi.rs --- 04_zero_overhead_abstraction/src/bsp/rpi.rs +++ 05_safe_globals/src/bsp/rpi.rs -@@ -4,38 +4,114 @@ +@@ -4,7 +4,7 @@ //! Board Support Package for the Raspberry Pi. @@ -133,7 +134,8 @@ diff -uNr 04_zero_overhead_abstraction/src/bsp/rpi.rs 05_safe_globals/src/bsp/rp +use crate::{arch::sync::NullLock, interface}; use core::fmt; - pub const BOOT_CORE_ID: u64 = 0; + /// Used by `arch` code to find the early boot core. +@@ -14,31 +14,107 @@ pub const BOOT_CORE_STACK_START: u64 = 0x80_000; /// A mystical, magical device for generating QEMU output out of the void. @@ -254,7 +256,7 @@ diff -uNr 04_zero_overhead_abstraction/src/bsp/rpi.rs 05_safe_globals/src/bsp/rp diff -uNr 04_zero_overhead_abstraction/src/interface.rs 05_safe_globals/src/interface.rs --- 04_zero_overhead_abstraction/src/interface.rs +++ 05_safe_globals/src/interface.rs -@@ -20,17 +20,66 @@ +@@ -20,12 +20,13 @@ /// System console operations. pub mod console { @@ -267,13 +269,13 @@ diff -uNr 04_zero_overhead_abstraction/src/interface.rs 05_safe_globals/src/inte - /// intention. - pub use core::fmt::Write; + pub trait Write { ++ /// Write a Rust format string. + fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; + } /// Console read functions. pub trait Read { -- fn read_char(&mut self) -> char { -+ fn read_char(&self) -> char { +@@ -34,4 +35,53 @@ ' ' } } diff --git a/05_safe_globals/kernel b/05_safe_globals/kernel index 96ed10e5..ca52d607 100755 Binary files a/05_safe_globals/kernel and b/05_safe_globals/kernel differ diff --git a/05_safe_globals/kernel8.img b/05_safe_globals/kernel8.img index e07c2390..94851bfe 100755 Binary files a/05_safe_globals/kernel8.img and b/05_safe_globals/kernel8.img differ diff --git a/05_safe_globals/src/arch/aarch64/sync.rs b/05_safe_globals/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/05_safe_globals/src/arch/aarch64/sync.rs +++ b/05_safe_globals/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/05_safe_globals/src/bsp/rpi.rs b/05_safe_globals/src/bsp/rpi.rs index ce467ee4..bf962b82 100644 --- a/05_safe_globals/src/bsp/rpi.rs +++ b/05_safe_globals/src/bsp/rpi.rs @@ -7,7 +7,10 @@ use crate::{arch::sync::NullLock, interface}; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; /// A mystical, magical device for generating QEMU output out of the void. diff --git a/05_safe_globals/src/interface.rs b/05_safe_globals/src/interface.rs index 84c0b317..3c7ceeca 100644 --- a/05_safe_globals/src/interface.rs +++ b/05_safe_globals/src/interface.rs @@ -24,11 +24,13 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; } /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } diff --git a/05_safe_globals/src/print.rs b/05_safe_globals/src/print.rs index 86e5da83..3a7bed6c 100644 --- a/05_safe_globals/src/print.rs +++ b/05_safe_globals/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; diff --git a/06_drivers_gpio_uart/Cargo.lock b/06_drivers_gpio_uart/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/06_drivers_gpio_uart/Cargo.lock +++ b/06_drivers_gpio_uart/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/06_drivers_gpio_uart/README.md b/06_drivers_gpio_uart/README.md index e85d5f15..1e392920 100644 --- a/06_drivers_gpio_uart/README.md +++ b/06_drivers_gpio_uart/README.md @@ -642,7 +642,7 @@ diff -uNr 05_safe_globals/src/bsp/rpi/memory_map.rs 06_drivers_gpio_uart/src/bsp diff -uNr 05_safe_globals/src/bsp/rpi.rs 06_drivers_gpio_uart/src/bsp/rpi.rs --- 05_safe_globals/src/bsp/rpi.rs +++ 06_drivers_gpio_uart/src/bsp/rpi.rs -@@ -4,114 +4,68 @@ +@@ -4,7 +4,10 @@ //! Board Support Package for the Raspberry Pi. @@ -653,7 +653,9 @@ diff -uNr 05_safe_globals/src/bsp/rpi.rs 06_drivers_gpio_uart/src/bsp/rpi.rs +use crate::interface; use core::fmt; - pub const BOOT_CORE_ID: u64 = 0; + /// Used by `arch` code to find the early boot core. +@@ -13,108 +16,59 @@ + /// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; -/// A mystical, magical device for generating QEMU output out of the void. @@ -818,15 +820,17 @@ diff -uNr 05_safe_globals/src/bsp.rs 06_drivers_gpio_uart/src/bsp.rs diff -uNr 05_safe_globals/src/interface.rs 06_drivers_gpio_uart/src/interface.rs --- 05_safe_globals/src/interface.rs +++ 06_drivers_gpio_uart/src/interface.rs -@@ -24,6 +24,7 @@ +@@ -24,6 +24,9 @@ /// Console write functions. pub trait Write { ++ /// Write a single character. + fn write_char(&self, c: char); ++ + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; } - -@@ -83,3 +84,20 @@ +@@ -85,3 +88,20 @@ fn lock(&mut self, f: impl FnOnce(&mut Self::Data) -> R) -> R; } } diff --git a/06_drivers_gpio_uart/kernel b/06_drivers_gpio_uart/kernel index dd911cf3..c909017d 100755 Binary files a/06_drivers_gpio_uart/kernel and b/06_drivers_gpio_uart/kernel differ diff --git a/06_drivers_gpio_uart/kernel8.img b/06_drivers_gpio_uart/kernel8.img index 860a4f06..41d1e853 100755 Binary files a/06_drivers_gpio_uart/kernel8.img and b/06_drivers_gpio_uart/kernel8.img differ diff --git a/06_drivers_gpio_uart/src/arch/aarch64/sync.rs b/06_drivers_gpio_uart/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/06_drivers_gpio_uart/src/arch/aarch64/sync.rs +++ b/06_drivers_gpio_uart/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/06_drivers_gpio_uart/src/bsp/rpi.rs b/06_drivers_gpio_uart/src/bsp/rpi.rs index 197258c1..0acb693c 100644 --- a/06_drivers_gpio_uart/src/bsp/rpi.rs +++ b/06_drivers_gpio_uart/src/bsp/rpi.rs @@ -10,7 +10,10 @@ use super::driver; use crate::interface; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; //-------------------------------------------------------------------------------------------------- diff --git a/06_drivers_gpio_uart/src/interface.rs b/06_drivers_gpio_uart/src/interface.rs index 9178eb60..66c22f1a 100644 --- a/06_drivers_gpio_uart/src/interface.rs +++ b/06_drivers_gpio_uart/src/interface.rs @@ -24,12 +24,16 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; } /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } diff --git a/06_drivers_gpio_uart/src/print.rs b/06_drivers_gpio_uart/src/print.rs index 86e5da83..3a7bed6c 100644 --- a/06_drivers_gpio_uart/src/print.rs +++ b/06_drivers_gpio_uart/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; diff --git a/07_uart_chainloader/Cargo.lock b/07_uart_chainloader/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/07_uart_chainloader/Cargo.lock +++ b/07_uart_chainloader/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/07_uart_chainloader/README.md b/07_uart_chainloader/README.md index a0e56715..b90022e4 100644 --- a/07_uart_chainloader/README.md +++ b/07_uart_chainloader/README.md @@ -239,8 +239,8 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/rpi/link.ld 07_uart_chainloader/src/bsp/r diff -uNr 06_drivers_gpio_uart/src/bsp/rpi.rs 07_uart_chainloader/src/bsp/rpi.rs --- 06_drivers_gpio_uart/src/bsp/rpi.rs +++ 07_uart_chainloader/src/bsp/rpi.rs -@@ -13,6 +13,9 @@ - pub const BOOT_CORE_ID: u64 = 0; +@@ -16,6 +16,9 @@ + /// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; +/// The address on which the RPi3 firmware loads every binary by default. @@ -253,9 +253,9 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/rpi.rs 07_uart_chainloader/src/bsp/rpi.rs diff -uNr 06_drivers_gpio_uart/src/interface.rs 07_uart_chainloader/src/interface.rs --- 06_drivers_gpio_uart/src/interface.rs +++ 07_uart_chainloader/src/interface.rs -@@ -26,6 +26,10 @@ - pub trait Write { - fn write_char(&self, c: char); +@@ -29,6 +29,10 @@ + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; + + /// Block execution until the last character has been physically put on the TX wire @@ -264,7 +264,7 @@ diff -uNr 06_drivers_gpio_uart/src/interface.rs 07_uart_chainloader/src/interfac } /// Console read functions. -@@ -33,6 +37,9 @@ +@@ -37,6 +41,9 @@ fn read_char(&self) -> char { ' ' } diff --git a/07_uart_chainloader/kernel b/07_uart_chainloader/kernel index f136ea06..04602d52 100755 Binary files a/07_uart_chainloader/kernel and b/07_uart_chainloader/kernel differ diff --git a/07_uart_chainloader/kernel8.img b/07_uart_chainloader/kernel8.img index 7f74a22a..654ac5b8 100755 Binary files a/07_uart_chainloader/kernel8.img and b/07_uart_chainloader/kernel8.img differ diff --git a/07_uart_chainloader/src/arch/aarch64/sync.rs b/07_uart_chainloader/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/07_uart_chainloader/src/arch/aarch64/sync.rs +++ b/07_uart_chainloader/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/07_uart_chainloader/src/bsp/rpi.rs b/07_uart_chainloader/src/bsp/rpi.rs index 77fef475..79fbeca0 100644 --- a/07_uart_chainloader/src/bsp/rpi.rs +++ b/07_uart_chainloader/src/bsp/rpi.rs @@ -10,7 +10,10 @@ use super::driver; use crate::interface; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; /// The address on which the RPi3 firmware loads every binary by default. diff --git a/07_uart_chainloader/src/interface.rs b/07_uart_chainloader/src/interface.rs index 420aeaf3..866f2d4d 100644 --- a/07_uart_chainloader/src/interface.rs +++ b/07_uart_chainloader/src/interface.rs @@ -24,7 +24,10 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; /// Block execution until the last character has been physically put on the TX wire @@ -34,6 +37,7 @@ pub mod console { /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } diff --git a/07_uart_chainloader/src/print.rs b/07_uart_chainloader/src/print.rs index 86e5da83..3a7bed6c 100644 --- a/07_uart_chainloader/src/print.rs +++ b/07_uart_chainloader/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; diff --git a/08_timestamps/Cargo.lock b/08_timestamps/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/08_timestamps/Cargo.lock +++ b/08_timestamps/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/08_timestamps/README.md b/08_timestamps/README.md index a9903732..9f83e5d0 100644 --- a/08_timestamps/README.md +++ b/08_timestamps/README.md @@ -287,8 +287,8 @@ diff -uNr 07_uart_chainloader/src/bsp/rpi/link.ld 08_timestamps/src/bsp/rpi/link diff -uNr 07_uart_chainloader/src/bsp/rpi.rs 08_timestamps/src/bsp/rpi.rs --- 07_uart_chainloader/src/bsp/rpi.rs +++ 08_timestamps/src/bsp/rpi.rs -@@ -13,9 +13,6 @@ - pub const BOOT_CORE_ID: u64 = 0; +@@ -16,9 +16,6 @@ + /// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; -/// The address on which the RPi3 firmware loads every binary by default. @@ -301,7 +301,7 @@ diff -uNr 07_uart_chainloader/src/bsp/rpi.rs 08_timestamps/src/bsp/rpi.rs diff -uNr 07_uart_chainloader/src/interface.rs 08_timestamps/src/interface.rs --- 07_uart_chainloader/src/interface.rs +++ 08_timestamps/src/interface.rs -@@ -108,3 +108,22 @@ +@@ -112,3 +112,22 @@ } } } @@ -413,12 +413,12 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs diff -uNr 07_uart_chainloader/src/print.rs 08_timestamps/src/print.rs --- 07_uart_chainloader/src/print.rs +++ 08_timestamps/src/print.rs -@@ -31,3 +31,71 @@ +@@ -32,3 +32,71 @@ $crate::print::_print(format_args_nl!($($arg)*)); }) } + -+/// Prints am info, with newline. ++/// Prints an info, with newline. +#[macro_export] +macro_rules! info { + ($string:expr) => ({ diff --git a/08_timestamps/kernel b/08_timestamps/kernel index 1929dc8c..396f84df 100755 Binary files a/08_timestamps/kernel and b/08_timestamps/kernel differ diff --git a/08_timestamps/kernel8.img b/08_timestamps/kernel8.img index f553ef75..a30cd440 100755 Binary files a/08_timestamps/kernel8.img and b/08_timestamps/kernel8.img differ diff --git a/08_timestamps/src/arch/aarch64/sync.rs b/08_timestamps/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/08_timestamps/src/arch/aarch64/sync.rs +++ b/08_timestamps/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/08_timestamps/src/bsp/rpi.rs b/08_timestamps/src/bsp/rpi.rs index 197258c1..0acb693c 100644 --- a/08_timestamps/src/bsp/rpi.rs +++ b/08_timestamps/src/bsp/rpi.rs @@ -10,7 +10,10 @@ use super::driver; use crate::interface; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; //-------------------------------------------------------------------------------------------------- diff --git a/08_timestamps/src/interface.rs b/08_timestamps/src/interface.rs index 134dbfd5..8a547ab3 100644 --- a/08_timestamps/src/interface.rs +++ b/08_timestamps/src/interface.rs @@ -24,7 +24,10 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; /// Block execution until the last character has been physically put on the TX wire @@ -34,6 +37,7 @@ pub mod console { /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } diff --git a/08_timestamps/src/print.rs b/08_timestamps/src/print.rs index 7bd8d6ef..16f1fb21 100644 --- a/08_timestamps/src/print.rs +++ b/08_timestamps/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; @@ -32,7 +33,7 @@ macro_rules! println { }) } -/// Prints am info, with newline. +/// Prints an info, with newline. #[macro_export] macro_rules! info { ($string:expr) => ({ diff --git a/09_hw_debug_JTAG/Cargo.lock b/09_hw_debug_JTAG/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/09_hw_debug_JTAG/Cargo.lock +++ b/09_hw_debug_JTAG/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/09_hw_debug_JTAG/kernel b/09_hw_debug_JTAG/kernel index 1929dc8c..396f84df 100755 Binary files a/09_hw_debug_JTAG/kernel and b/09_hw_debug_JTAG/kernel differ diff --git a/09_hw_debug_JTAG/kernel8.img b/09_hw_debug_JTAG/kernel8.img index f553ef75..a30cd440 100755 Binary files a/09_hw_debug_JTAG/kernel8.img and b/09_hw_debug_JTAG/kernel8.img differ diff --git a/09_hw_debug_JTAG/src/arch/aarch64/sync.rs b/09_hw_debug_JTAG/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/09_hw_debug_JTAG/src/arch/aarch64/sync.rs +++ b/09_hw_debug_JTAG/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/09_hw_debug_JTAG/src/bsp/rpi.rs b/09_hw_debug_JTAG/src/bsp/rpi.rs index 197258c1..0acb693c 100644 --- a/09_hw_debug_JTAG/src/bsp/rpi.rs +++ b/09_hw_debug_JTAG/src/bsp/rpi.rs @@ -10,7 +10,10 @@ use super::driver; use crate::interface; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; //-------------------------------------------------------------------------------------------------- diff --git a/09_hw_debug_JTAG/src/interface.rs b/09_hw_debug_JTAG/src/interface.rs index 134dbfd5..8a547ab3 100644 --- a/09_hw_debug_JTAG/src/interface.rs +++ b/09_hw_debug_JTAG/src/interface.rs @@ -24,7 +24,10 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; /// Block execution until the last character has been physically put on the TX wire @@ -34,6 +37,7 @@ pub mod console { /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } diff --git a/09_hw_debug_JTAG/src/print.rs b/09_hw_debug_JTAG/src/print.rs index 7bd8d6ef..16f1fb21 100644 --- a/09_hw_debug_JTAG/src/print.rs +++ b/09_hw_debug_JTAG/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; @@ -32,7 +33,7 @@ macro_rules! println { }) } -/// Prints am info, with newline. +/// Prints an info, with newline. #[macro_export] macro_rules! info { ($string:expr) => ({ diff --git a/10_privilege_level/Cargo.lock b/10_privilege_level/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/10_privilege_level/Cargo.lock +++ b/10_privilege_level/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/10_privilege_level/README.md b/10_privilege_level/README.md index e94300a9..8b656a19 100644 --- a/10_privilege_level/README.md +++ b/10_privilege_level/README.md @@ -334,7 +334,7 @@ diff -uNr 09_hw_debug_JTAG/src/arch/aarch64.rs 10_privilege_level/src/arch/aarch //-------------------------------------------------------------------------------------------------- // Global instances //-------------------------------------------------------------------------------------------------- -@@ -61,3 +103,36 @@ +@@ -61,3 +103,37 @@ asm::wfe() } } @@ -353,6 +353,7 @@ diff -uNr 09_hw_debug_JTAG/src/arch/aarch64.rs 10_privilege_level/src/arch/aarch + } + } + ++ /// Print the AArch64 exceptions status. + #[rustfmt::skip] + pub fn print_exception_state() { + use super::{ @@ -361,7 +362,7 @@ diff -uNr 09_hw_debug_JTAG/src/arch/aarch64.rs 10_privilege_level/src/arch/aarch + }; + use crate::info; + -+ let to_mask_str = |x: bool| -> &'static str { ++ let to_mask_str = |x| -> _ { + if x { "Masked" } else { "Unmasked" } + }; + diff --git a/10_privilege_level/kernel b/10_privilege_level/kernel index 7ceb1c98..0178ddf0 100755 Binary files a/10_privilege_level/kernel and b/10_privilege_level/kernel differ diff --git a/10_privilege_level/kernel8.img b/10_privilege_level/kernel8.img index 3c08349f..6e226f70 100755 Binary files a/10_privilege_level/kernel8.img and b/10_privilege_level/kernel8.img differ diff --git a/10_privilege_level/src/arch/aarch64.rs b/10_privilege_level/src/arch/aarch64.rs index 3ba64ea6..91c80d44 100644 --- a/10_privilege_level/src/arch/aarch64.rs +++ b/10_privilege_level/src/arch/aarch64.rs @@ -118,6 +118,7 @@ pub mod state { } } + /// Print the AArch64 exceptions status. #[rustfmt::skip] pub fn print_exception_state() { use super::{ @@ -126,7 +127,7 @@ pub mod state { }; use crate::info; - let to_mask_str = |x: bool| -> &'static str { + let to_mask_str = |x| -> _ { if x { "Masked" } else { "Unmasked" } }; diff --git a/10_privilege_level/src/arch/aarch64/sync.rs b/10_privilege_level/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/10_privilege_level/src/arch/aarch64/sync.rs +++ b/10_privilege_level/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/10_privilege_level/src/bsp/rpi.rs b/10_privilege_level/src/bsp/rpi.rs index 197258c1..0acb693c 100644 --- a/10_privilege_level/src/bsp/rpi.rs +++ b/10_privilege_level/src/bsp/rpi.rs @@ -10,7 +10,10 @@ use super::driver; use crate::interface; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; //-------------------------------------------------------------------------------------------------- diff --git a/10_privilege_level/src/interface.rs b/10_privilege_level/src/interface.rs index 134dbfd5..8a547ab3 100644 --- a/10_privilege_level/src/interface.rs +++ b/10_privilege_level/src/interface.rs @@ -24,7 +24,10 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; /// Block execution until the last character has been physically put on the TX wire @@ -34,6 +37,7 @@ pub mod console { /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } diff --git a/10_privilege_level/src/print.rs b/10_privilege_level/src/print.rs index 7bd8d6ef..16f1fb21 100644 --- a/10_privilege_level/src/print.rs +++ b/10_privilege_level/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; @@ -32,7 +33,7 @@ macro_rules! println { }) } -/// Prints am info, with newline. +/// Prints an info, with newline. #[macro_export] macro_rules! info { ($string:expr) => ({ diff --git a/11_virtual_memory/Cargo.lock b/11_virtual_memory/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/11_virtual_memory/Cargo.lock +++ b/11_virtual_memory/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/11_virtual_memory/README.md b/11_virtual_memory/README.md index 00bf0497..304d4387 100644 --- a/11_virtual_memory/README.md +++ b/11_virtual_memory/README.md @@ -602,15 +602,6 @@ diff -uNr 10_privilege_level/src/arch/aarch64.rs 11_virtual_memory/src/arch/aarc /// Information about the HW state. pub mod state { use cortex_a::regs::*; -@@ -126,7 +133,7 @@ - }; - use crate::info; - -- let to_mask_str = |x: bool| -> &'static str { -+ let to_mask_str = |x| -> _ { - if x { "Masked" } else { "Unmasked" } - }; - diff -uNr 10_privilege_level/src/bsp/rpi/link.ld 11_virtual_memory/src/bsp/rpi/link.ld --- 10_privilege_level/src/bsp/rpi/link.ld @@ -759,8 +750,8 @@ diff -uNr 10_privilege_level/src/bsp/rpi.rs 11_virtual_memory/src/bsp/rpi.rs +use crate::{interface, memory::KernelVirtualLayout}; use core::fmt; - pub const BOOT_CORE_ID: u64 = 0; -@@ -69,3 +70,13 @@ + /// Used by `arch` code to find the early boot core. +@@ -72,3 +73,13 @@ // Configure PL011Uart's output pins. GPIO.map_pl011_uart(); } @@ -791,13 +782,14 @@ diff -uNr 10_privilege_level/src/bsp.rs 11_virtual_memory/src/bsp.rs diff -uNr 10_privilege_level/src/interface.rs 11_virtual_memory/src/interface.rs --- 10_privilege_level/src/interface.rs +++ 11_virtual_memory/src/interface.rs -@@ -127,3 +127,11 @@ +@@ -131,3 +131,12 @@ fn spin_for(&self, duration: Duration); } } + +/// Memory Management interfaces. +pub mod mm { ++ /// MMU functions. + pub trait MMU { + /// Called by the kernel early during init. + unsafe fn init(&self) -> Result<(), &'static str>; diff --git a/11_virtual_memory/kernel b/11_virtual_memory/kernel index 5d939853..0927bfc3 100755 Binary files a/11_virtual_memory/kernel and b/11_virtual_memory/kernel differ diff --git a/11_virtual_memory/kernel8.img b/11_virtual_memory/kernel8.img index ae26afd1..4e6eede4 100755 Binary files a/11_virtual_memory/kernel8.img and b/11_virtual_memory/kernel8.img differ diff --git a/11_virtual_memory/src/arch/aarch64.rs b/11_virtual_memory/src/arch/aarch64.rs index a77782c8..32187b04 100644 --- a/11_virtual_memory/src/arch/aarch64.rs +++ b/11_virtual_memory/src/arch/aarch64.rs @@ -125,6 +125,7 @@ pub mod state { } } + /// Print the AArch64 exceptions status. #[rustfmt::skip] pub fn print_exception_state() { use super::{ diff --git a/11_virtual_memory/src/arch/aarch64/sync.rs b/11_virtual_memory/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/11_virtual_memory/src/arch/aarch64/sync.rs +++ b/11_virtual_memory/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/11_virtual_memory/src/bsp/rpi.rs b/11_virtual_memory/src/bsp/rpi.rs index 27c6bc12..93120316 100644 --- a/11_virtual_memory/src/bsp/rpi.rs +++ b/11_virtual_memory/src/bsp/rpi.rs @@ -11,7 +11,10 @@ use super::driver; use crate::{interface, memory::KernelVirtualLayout}; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; //-------------------------------------------------------------------------------------------------- diff --git a/11_virtual_memory/src/interface.rs b/11_virtual_memory/src/interface.rs index 0d4a3a23..19dad63c 100644 --- a/11_virtual_memory/src/interface.rs +++ b/11_virtual_memory/src/interface.rs @@ -24,7 +24,10 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; /// Block execution until the last character has been physically put on the TX wire @@ -34,6 +37,7 @@ pub mod console { /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } @@ -130,6 +134,7 @@ pub mod time { /// Memory Management interfaces. pub mod mm { + /// MMU functions. pub trait MMU { /// Called by the kernel early during init. unsafe fn init(&self) -> Result<(), &'static str>; diff --git a/11_virtual_memory/src/print.rs b/11_virtual_memory/src/print.rs index 7bd8d6ef..16f1fb21 100644 --- a/11_virtual_memory/src/print.rs +++ b/11_virtual_memory/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; @@ -32,7 +33,7 @@ macro_rules! println { }) } -/// Prints am info, with newline. +/// Prints an info, with newline. #[macro_export] macro_rules! info { ($string:expr) => ({ diff --git a/12_cpu_exceptions_part1/Cargo.lock b/12_cpu_exceptions_part1/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/12_cpu_exceptions_part1/Cargo.lock +++ b/12_cpu_exceptions_part1/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/12_cpu_exceptions_part1/kernel b/12_cpu_exceptions_part1/kernel index e452eae8..f4dc62bd 100755 Binary files a/12_cpu_exceptions_part1/kernel and b/12_cpu_exceptions_part1/kernel differ diff --git a/12_cpu_exceptions_part1/kernel8.img b/12_cpu_exceptions_part1/kernel8.img index 4b51eea0..f393029b 100755 Binary files a/12_cpu_exceptions_part1/kernel8.img and b/12_cpu_exceptions_part1/kernel8.img differ diff --git a/12_cpu_exceptions_part1/src/arch/aarch64.rs b/12_cpu_exceptions_part1/src/arch/aarch64.rs index 588d87e5..0b13069c 100644 --- a/12_cpu_exceptions_part1/src/arch/aarch64.rs +++ b/12_cpu_exceptions_part1/src/arch/aarch64.rs @@ -134,6 +134,7 @@ pub mod state { } } + /// Print the AArch64 exceptions status. #[rustfmt::skip] pub fn print_exception_state() { use super::{ diff --git a/12_cpu_exceptions_part1/src/arch/aarch64/sync.rs b/12_cpu_exceptions_part1/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/12_cpu_exceptions_part1/src/arch/aarch64/sync.rs +++ b/12_cpu_exceptions_part1/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/12_cpu_exceptions_part1/src/bsp/rpi.rs b/12_cpu_exceptions_part1/src/bsp/rpi.rs index 27c6bc12..93120316 100644 --- a/12_cpu_exceptions_part1/src/bsp/rpi.rs +++ b/12_cpu_exceptions_part1/src/bsp/rpi.rs @@ -11,7 +11,10 @@ use super::driver; use crate::{interface, memory::KernelVirtualLayout}; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; //-------------------------------------------------------------------------------------------------- diff --git a/12_cpu_exceptions_part1/src/interface.rs b/12_cpu_exceptions_part1/src/interface.rs index 0d4a3a23..19dad63c 100644 --- a/12_cpu_exceptions_part1/src/interface.rs +++ b/12_cpu_exceptions_part1/src/interface.rs @@ -24,7 +24,10 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; /// Block execution until the last character has been physically put on the TX wire @@ -34,6 +37,7 @@ pub mod console { /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } @@ -130,6 +134,7 @@ pub mod time { /// Memory Management interfaces. pub mod mm { + /// MMU functions. pub trait MMU { /// Called by the kernel early during init. unsafe fn init(&self) -> Result<(), &'static str>; diff --git a/12_cpu_exceptions_part1/src/print.rs b/12_cpu_exceptions_part1/src/print.rs index 7bd8d6ef..16f1fb21 100644 --- a/12_cpu_exceptions_part1/src/print.rs +++ b/12_cpu_exceptions_part1/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; @@ -32,7 +33,7 @@ macro_rules! println { }) } -/// Prints am info, with newline. +/// Prints an info, with newline. #[macro_export] macro_rules! info { ($string:expr) => ({ diff --git a/X1_JTAG_boot/Cargo.lock b/X1_JTAG_boot/Cargo.lock index 1b2c9ac6..4f7a0366 100644 --- a/X1_JTAG_boot/Cargo.lock +++ b/X1_JTAG_boot/Cargo.lock @@ -5,7 +5,7 @@ name = "cortex-a" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,7 +14,7 @@ version = "0.1.0" dependencies = [ "cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "register" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -38,5 +38,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum cortex-a 2.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4aab2f5271d9bf17a52b34dd99993648132df3dacb79312a33332f2b6ae1d0fd" "checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum register 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c92f7cc61c67d0f283777ce3c678789788d1b48e8f5e822a257513c16194955" +"checksum register 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f149d257caa7d9aed1f870d573ba5e2429576e6fed0693341f23078c98e55" "checksum tock-registers 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50af9c49c55cfb4437dd78c1fada3be5d088cbe1bea641db8171283503606a70" diff --git a/X1_JTAG_boot/jtag_boot_rpi3.img b/X1_JTAG_boot/jtag_boot_rpi3.img index c9a8d970..68143d6f 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 142e1e38..ccb1ed02 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/sync.rs b/X1_JTAG_boot/src/arch/aarch64/sync.rs index 96ceff03..7e8781e6 100644 --- a/X1_JTAG_boot/src/arch/aarch64/sync.rs +++ b/X1_JTAG_boot/src/arch/aarch64/sync.rs @@ -30,6 +30,7 @@ unsafe impl Send for NullLock {} unsafe impl Sync for NullLock {} impl NullLock { + /// Wraps `data` into a new `NullLock`. pub const fn new(data: T) -> NullLock { NullLock { data: UnsafeCell::new(data), diff --git a/X1_JTAG_boot/src/bsp/rpi.rs b/X1_JTAG_boot/src/bsp/rpi.rs index 871c4b8b..d76314ba 100644 --- a/X1_JTAG_boot/src/bsp/rpi.rs +++ b/X1_JTAG_boot/src/bsp/rpi.rs @@ -10,7 +10,10 @@ use super::driver; use crate::interface; use core::fmt; +/// Used by `arch` code to find the early boot core. pub const BOOT_CORE_ID: u64 = 0; + +/// The early boot core's stack address. pub const BOOT_CORE_STACK_START: u64 = 0x80_000; //-------------------------------------------------------------------------------------------------- diff --git a/X1_JTAG_boot/src/interface.rs b/X1_JTAG_boot/src/interface.rs index 376be32c..84633d71 100644 --- a/X1_JTAG_boot/src/interface.rs +++ b/X1_JTAG_boot/src/interface.rs @@ -24,7 +24,10 @@ pub mod console { /// Console write functions. pub trait Write { + /// Write a single character. fn write_char(&self, c: char); + + /// Write a Rust format string. fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; /// Block execution until the last character has been physically put on the TX wire @@ -34,6 +37,7 @@ pub mod console { /// Console read functions. pub trait Read { + /// Read a single character. fn read_char(&self) -> char { ' ' } diff --git a/X1_JTAG_boot/src/print.rs b/X1_JTAG_boot/src/print.rs index 7bd8d6ef..16f1fb21 100644 --- a/X1_JTAG_boot/src/print.rs +++ b/X1_JTAG_boot/src/print.rs @@ -7,6 +7,7 @@ use crate::{bsp, interface}; use core::fmt; +#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use interface::console::Write; @@ -32,7 +33,7 @@ macro_rules! println { }) } -/// Prints am info, with newline. +/// Prints an info, with newline. #[macro_export] macro_rules! info { ($string:expr) => ({