diff --git a/01_wait_forever/src/main.rs b/01_wait_forever/src/main.rs index 10cf6bb4..8cd4b144 100644 --- a/01_wait_forever/src/main.rs +++ b/01_wait_forever/src/main.rs @@ -100,8 +100,10 @@ //! //! # Boot flow //! -//! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. +//! 1. The kernel's entry point is the function [`cpu::boot::arch_boot::_start()`]. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.S`. +//! +//! [`cpu::boot::arch_boot::_start()`]: ../src/kernel/cpu/up/_arch/aarch64/cpu/boot.rs.html #![feature(asm)] #![feature(global_asm)] diff --git a/02_runtime_init/README.md b/02_runtime_init/README.md index 7948aae4..50cce879 100644 --- a/02_runtime_init/README.md +++ b/02_runtime_init/README.md @@ -199,15 +199,18 @@ diff -uNr 01_wait_forever/src/cpu.rs 02_runtime_init/src/cpu.rs diff -uNr 01_wait_forever/src/main.rs 02_runtime_init/src/main.rs --- 01_wait_forever/src/main.rs +++ 02_runtime_init/src/main.rs -@@ -102,6 +102,7 @@ +@@ -102,8 +102,10 @@ //! - //! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. + //! 1. The kernel's entry point is the function [`cpu::boot::arch_boot::_start()`]. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.S`. +//! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. + //! + //! [`cpu::boot::arch_boot::_start()`]: ../src/kernel/cpu/up/_arch/aarch64/cpu/boot.rs.html ++//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(asm)] #![feature(global_asm)] -@@ -110,6 +111,15 @@ +@@ -112,6 +114,15 @@ mod bsp; mod cpu; diff --git a/02_runtime_init/src/main.rs b/02_runtime_init/src/main.rs index ba5a877c..fd9c36bc 100644 --- a/02_runtime_init/src/main.rs +++ b/02_runtime_init/src/main.rs @@ -100,9 +100,12 @@ //! //! # Boot flow //! -//! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. +//! 1. The kernel's entry point is the function [`cpu::boot::arch_boot::_start()`]. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.S`. //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. +//! +//! [`cpu::boot::arch_boot::_start()`]: ../src/kernel/cpu/up/_arch/aarch64/cpu/boot.rs.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(asm)] #![feature(global_asm)] diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index 11c804bf..c8dc66cc 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -139,17 +139,17 @@ diff -uNr 02_runtime_init/src/console.rs 03_hacky_hello_world/src/console.rs diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs --- 02_runtime_init/src/main.rs +++ 03_hacky_hello_world/src/main.rs -@@ -100,19 +100,25 @@ - //! +@@ -101,21 +101,25 @@ //! # Boot flow //! --//! 1. The kernel's entry point is the function `cpu::boot::arch_boot::_start()`. + //! 1. The kernel's entry point is the function [`cpu::boot::arch_boot::_start()`]. -//! - It is implemented in `src/_arch/__arch_name__/cpu/boot.S`. -+//! 1. The kernel's entry point is the function [`cpu::boot::arch_boot::_start()`]. +//! - It is implemented in `src/_arch/__arch_name__/cpu/boot.rs`. //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. -+//! + //! +-//! [`cpu::boot::arch_boot::_start()`]: ../src/kernel/cpu/up/_arch/aarch64/cpu/boot.rs.html +//! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html + //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(asm)] +#![feature(format_args_nl)] @@ -167,7 +167,7 @@ diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs mod runtime_init; /// Early init code. -@@ -121,5 +127,7 @@ +@@ -124,5 +128,7 @@ /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { @@ -226,7 +226,7 @@ diff -uNr 02_runtime_init/src/print.rs 03_hacky_hello_world/src/print.rs + +/// Prints without a newline. +/// -+/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html ++/// Carbon copy from +#[macro_export] +macro_rules! print { + ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -234,7 +234,7 @@ diff -uNr 02_runtime_init/src/print.rs 03_hacky_hello_world/src/print.rs + +/// Prints with a newline. +/// -+/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html ++/// Carbon copy from +#[macro_export] +macro_rules! println { + () => ($crate::print!("\n")); diff --git a/03_hacky_hello_world/src/main.rs b/03_hacky_hello_world/src/main.rs index 378e0baf..0815d5e2 100644 --- a/03_hacky_hello_world/src/main.rs +++ b/03_hacky_hello_world/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(asm)] #![feature(format_args_nl)] diff --git a/03_hacky_hello_world/src/print.rs b/03_hacky_hello_world/src/print.rs index fa6451c7..8ea5db24 100644 --- a/03_hacky_hello_world/src/print.rs +++ b/03_hacky_hello_world/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/04_zero_overhead_abstraction/README.md b/04_zero_overhead_abstraction/README.md index 6c9ad70c..d20758d1 100644 --- a/04_zero_overhead_abstraction/README.md +++ b/04_zero_overhead_abstraction/README.md @@ -242,9 +242,9 @@ diff -uNr 03_hacky_hello_world/src/cpu.rs 04_zero_overhead_abstraction/src/cpu.r diff -uNr 03_hacky_hello_world/src/main.rs 04_zero_overhead_abstraction/src/main.rs --- 03_hacky_hello_world/src/main.rs +++ 04_zero_overhead_abstraction/src/main.rs -@@ -106,9 +106,7 @@ - //! +@@ -107,9 +107,7 @@ //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html + //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html -#![feature(asm)] #![feature(format_args_nl)] @@ -252,7 +252,7 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_zero_overhead_abstraction/src/main #![feature(panic_info_message)] #![no_main] #![no_std] -@@ -127,7 +125,8 @@ +@@ -128,7 +126,8 @@ /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { diff --git a/04_zero_overhead_abstraction/src/main.rs b/04_zero_overhead_abstraction/src/main.rs index 7de836fe..9dfc7d00 100644 --- a/04_zero_overhead_abstraction/src/main.rs +++ b/04_zero_overhead_abstraction/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(format_args_nl)] #![feature(panic_info_message)] diff --git a/04_zero_overhead_abstraction/src/print.rs b/04_zero_overhead_abstraction/src/print.rs index fa6451c7..8ea5db24 100644 --- a/04_zero_overhead_abstraction/src/print.rs +++ b/04_zero_overhead_abstraction/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/05_safe_globals/README.md b/05_safe_globals/README.md index 3db54d6b..ea61489e 100644 --- a/05_safe_globals/README.md +++ b/05_safe_globals/README.md @@ -211,7 +211,7 @@ diff -uNr 04_zero_overhead_abstraction/src/console.rs 05_safe_globals/src/consol diff -uNr 04_zero_overhead_abstraction/src/main.rs 05_safe_globals/src/main.rs --- 04_zero_overhead_abstraction/src/main.rs +++ 05_safe_globals/src/main.rs -@@ -108,6 +108,7 @@ +@@ -109,6 +109,7 @@ #![feature(format_args_nl)] #![feature(panic_info_message)] @@ -219,7 +219,7 @@ diff -uNr 04_zero_overhead_abstraction/src/main.rs 05_safe_globals/src/main.rs #![no_main] #![no_std] -@@ -118,6 +119,7 @@ +@@ -119,6 +120,7 @@ mod panic_wait; mod print; mod runtime_init; @@ -227,7 +227,7 @@ diff -uNr 04_zero_overhead_abstraction/src/main.rs 05_safe_globals/src/main.rs /// Early init code. /// -@@ -125,8 +127,15 @@ +@@ -126,8 +128,15 @@ /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { @@ -248,17 +248,18 @@ diff -uNr 04_zero_overhead_abstraction/src/main.rs 05_safe_globals/src/main.rs diff -uNr 04_zero_overhead_abstraction/src/synchronization.rs 05_safe_globals/src/synchronization.rs --- 04_zero_overhead_abstraction/src/synchronization.rs +++ 05_safe_globals/src/synchronization.rs -@@ -0,0 +1,76 @@ +@@ -0,0 +1,77 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2020-2021 Andre Richter + +//! Synchronization primitives. +//! -+//! Suggested literature: -+//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -+//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -+//! - https://doc.rust-lang.org/std/cell/index.html ++//! # Resources ++//! ++//! - ++//! - ++//! - + +use core::cell::UnsafeCell; + diff --git a/05_safe_globals/src/main.rs b/05_safe_globals/src/main.rs index bb6abcb8..83955815 100644 --- a/05_safe_globals/src/main.rs +++ b/05_safe_globals/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(format_args_nl)] #![feature(panic_info_message)] diff --git a/05_safe_globals/src/print.rs b/05_safe_globals/src/print.rs index fa6451c7..8ea5db24 100644 --- a/05_safe_globals/src/print.rs +++ b/05_safe_globals/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/05_safe_globals/src/synchronization.rs b/05_safe_globals/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/05_safe_globals/src/synchronization.rs +++ b/05_safe_globals/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/06_drivers_gpio_uart/README.md b/06_drivers_gpio_uart/README.md index 9b526c33..9bb29be5 100644 --- a/06_drivers_gpio_uart/README.md +++ b/06_drivers_gpio_uart/README.md @@ -445,8 +445,8 @@ diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 06_dri +//! +//! # Resources +//! -+//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -+//! - https://developer.arm.com/documentation/ddi0183/latest ++//! - ++//! - + +use crate::{ + bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, @@ -1302,15 +1302,15 @@ diff -uNr 05_safe_globals/src/driver.rs 06_drivers_gpio_uart/src/driver.rs diff -uNr 05_safe_globals/src/main.rs 06_drivers_gpio_uart/src/main.rs --- 05_safe_globals/src/main.rs +++ 06_drivers_gpio_uart/src/main.rs -@@ -106,6 +106,7 @@ - //! +@@ -107,6 +107,7 @@ //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html + //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html +#![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] #![feature(panic_info_message)] #![feature(trait_alias)] -@@ -115,6 +116,7 @@ +@@ -116,6 +117,7 @@ mod bsp; mod console; mod cpu; @@ -1318,7 +1318,7 @@ diff -uNr 05_safe_globals/src/main.rs 06_drivers_gpio_uart/src/main.rs mod memory; mod panic_wait; mod print; -@@ -126,16 +128,49 @@ +@@ -127,16 +129,49 @@ /// # Safety /// /// - Only a single core must be active and running this function. @@ -1398,7 +1398,7 @@ diff -uNr 05_safe_globals/src/panic_wait.rs 06_drivers_gpio_uart/src/panic_wait. + +/// Prints with a newline - only use from the panic handler. +/// -+/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html ++/// Carbon copy from +#[macro_export] +macro_rules! panic_println { + ($($arg:tt)*) => ({ diff --git a/06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/06_drivers_gpio_uart/src/main.rs b/06_drivers_gpio_uart/src/main.rs index a16c0de7..46a89031 100644 --- a/06_drivers_gpio_uart/src/main.rs +++ b/06_drivers_gpio_uart/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] diff --git a/06_drivers_gpio_uart/src/panic_wait.rs b/06_drivers_gpio_uart/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/06_drivers_gpio_uart/src/panic_wait.rs +++ b/06_drivers_gpio_uart/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/06_drivers_gpio_uart/src/print.rs b/06_drivers_gpio_uart/src/print.rs index fa6451c7..8ea5db24 100644 --- a/06_drivers_gpio_uart/src/print.rs +++ b/06_drivers_gpio_uart/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/06_drivers_gpio_uart/src/synchronization.rs b/06_drivers_gpio_uart/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/06_drivers_gpio_uart/src/synchronization.rs +++ b/06_drivers_gpio_uart/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/07_uart_chainloader/README.md b/07_uart_chainloader/README.md index 1cca2b12..4cf6d918 100644 --- a/07_uart_chainloader/README.md +++ b/07_uart_chainloader/README.md @@ -406,7 +406,7 @@ diff -uNr 06_drivers_gpio_uart/src/cpu.rs 07_uart_chainloader/src/cpu.rs diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs --- 06_drivers_gpio_uart/src/main.rs +++ 07_uart_chainloader/src/main.rs -@@ -102,11 +102,14 @@ +@@ -102,12 +102,16 @@ //! //! 1. The kernel's entry point is the function [`cpu::boot::arch_boot::_start()`]. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.rs`. @@ -415,6 +415,8 @@ diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs +//! 3. Finally, [`runtime_init::runtime_init()`] is called. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html ++//! [`relocate::relocate_self()`]: relocate/fn.relocate_self.html + //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html +#![feature(asm)] #![feature(const_fn_fn_ptr_basics)] @@ -422,7 +424,7 @@ diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs #![feature(format_args_nl)] #![feature(panic_info_message)] #![feature(trait_alias)] -@@ -120,6 +123,7 @@ +@@ -121,6 +125,7 @@ mod memory; mod panic_wait; mod print; @@ -430,7 +432,7 @@ diff -uNr 06_drivers_gpio_uart/src/main.rs 07_uart_chainloader/src/main.rs mod runtime_init; mod synchronization; -@@ -148,29 +152,49 @@ +@@ -149,29 +154,49 @@ fn kernel_main() -> ! { use bsp::console::console; use console::interface::All; diff --git a/07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index f21395d3..17ca3543 100644 --- a/07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/07_uart_chainloader/src/main.rs b/07_uart_chainloader/src/main.rs index fdb787b5..82a6ec58 100644 --- a/07_uart_chainloader/src/main.rs +++ b/07_uart_chainloader/src/main.rs @@ -106,6 +106,8 @@ //! 3. Finally, [`runtime_init::runtime_init()`] is called. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`relocate::relocate_self()`]: relocate/fn.relocate_self.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(asm)] #![feature(const_fn_fn_ptr_basics)] diff --git a/07_uart_chainloader/src/panic_wait.rs b/07_uart_chainloader/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/07_uart_chainloader/src/panic_wait.rs +++ b/07_uart_chainloader/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/07_uart_chainloader/src/print.rs b/07_uart_chainloader/src/print.rs index fa6451c7..8ea5db24 100644 --- a/07_uart_chainloader/src/print.rs +++ b/07_uart_chainloader/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/07_uart_chainloader/src/synchronization.rs b/07_uart_chainloader/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/07_uart_chainloader/src/synchronization.rs +++ b/07_uart_chainloader/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/08_timestamps/README.md b/08_timestamps/README.md index 0f8ec5d2..af4b8055 100644 --- a/08_timestamps/README.md +++ b/08_timestamps/README.md @@ -499,7 +499,7 @@ diff -uNr 07_uart_chainloader/src/cpu.rs 08_timestamps/src/cpu.rs diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs --- 07_uart_chainloader/src/main.rs +++ 08_timestamps/src/main.rs -@@ -102,14 +102,11 @@ +@@ -102,16 +102,12 @@ //! //! 1. The kernel's entry point is the function [`cpu::boot::arch_boot::_start()`]. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.rs`. @@ -508,6 +508,8 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs +//! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +-//! [`relocate::relocate_self()`]: relocate/fn.relocate_self.html + //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html -#![feature(asm)] #![feature(const_fn_fn_ptr_basics)] @@ -515,7 +517,7 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs #![feature(format_args_nl)] #![feature(panic_info_message)] #![feature(trait_alias)] -@@ -123,9 +120,9 @@ +@@ -125,9 +121,9 @@ mod memory; mod panic_wait; mod print; @@ -526,7 +528,7 @@ diff -uNr 07_uart_chainloader/src/main.rs 08_timestamps/src/main.rs /// Early init code. /// -@@ -150,51 +147,31 @@ +@@ -152,51 +148,31 @@ /// The main function running after the early init. fn kernel_main() -> ! { diff --git a/08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/08_timestamps/src/main.rs b/08_timestamps/src/main.rs index 5a7b9f55..efcd9880 100644 --- a/08_timestamps/src/main.rs +++ b/08_timestamps/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] diff --git a/08_timestamps/src/panic_wait.rs b/08_timestamps/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/08_timestamps/src/panic_wait.rs +++ b/08_timestamps/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/08_timestamps/src/print.rs b/08_timestamps/src/print.rs index 5a563811..89fa6694 100644 --- a/08_timestamps/src/print.rs +++ b/08_timestamps/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/08_timestamps/src/synchronization.rs b/08_timestamps/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/08_timestamps/src/synchronization.rs +++ b/08_timestamps/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/09_hw_debug_JTAG/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/09_hw_debug_JTAG/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/09_hw_debug_JTAG/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/09_hw_debug_JTAG/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/09_hw_debug_JTAG/src/main.rs b/09_hw_debug_JTAG/src/main.rs index 5a7b9f55..efcd9880 100644 --- a/09_hw_debug_JTAG/src/main.rs +++ b/09_hw_debug_JTAG/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] diff --git a/09_hw_debug_JTAG/src/panic_wait.rs b/09_hw_debug_JTAG/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/09_hw_debug_JTAG/src/panic_wait.rs +++ b/09_hw_debug_JTAG/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/09_hw_debug_JTAG/src/print.rs b/09_hw_debug_JTAG/src/print.rs index 5a563811..89fa6694 100644 --- a/09_hw_debug_JTAG/src/print.rs +++ b/09_hw_debug_JTAG/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/09_hw_debug_JTAG/src/synchronization.rs b/09_hw_debug_JTAG/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/09_hw_debug_JTAG/src/synchronization.rs +++ b/09_hw_debug_JTAG/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/10_privilege_level/README.md b/10_privilege_level/README.md index 2556ec99..2e88c083 100644 --- a/10_privilege_level/README.md +++ b/10_privilege_level/README.md @@ -484,7 +484,7 @@ diff -uNr 09_hw_debug_JTAG/src/exception.rs 10_privilege_level/src/exception.rs diff -uNr 09_hw_debug_JTAG/src/main.rs 10_privilege_level/src/main.rs --- 09_hw_debug_JTAG/src/main.rs +++ 10_privilege_level/src/main.rs -@@ -117,6 +117,7 @@ +@@ -118,6 +118,7 @@ mod console; mod cpu; mod driver; @@ -492,7 +492,7 @@ diff -uNr 09_hw_debug_JTAG/src/main.rs 10_privilege_level/src/main.rs mod memory; mod panic_wait; mod print; -@@ -147,12 +148,20 @@ +@@ -148,12 +149,20 @@ /// The main function running after the early init. fn kernel_main() -> ! { @@ -513,7 +513,7 @@ diff -uNr 09_hw_debug_JTAG/src/main.rs 10_privilege_level/src/main.rs info!( "Architectural timer resolution: {} ns", time::time_manager().resolution().as_nanos() -@@ -167,11 +176,15 @@ +@@ -168,11 +177,15 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/10_privilege_level/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/10_privilege_level/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/10_privilege_level/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/10_privilege_level/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/10_privilege_level/src/main.rs b/10_privilege_level/src/main.rs index 74188343..193ff7a6 100644 --- a/10_privilege_level/src/main.rs +++ b/10_privilege_level/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] diff --git a/10_privilege_level/src/panic_wait.rs b/10_privilege_level/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/10_privilege_level/src/panic_wait.rs +++ b/10_privilege_level/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/10_privilege_level/src/print.rs b/10_privilege_level/src/print.rs index 5a563811..89fa6694 100644 --- a/10_privilege_level/src/print.rs +++ b/10_privilege_level/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/10_privilege_level/src/synchronization.rs b/10_privilege_level/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/10_privilege_level/src/synchronization.rs +++ b/10_privilege_level/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/11_virtual_mem_part1_identity_mapping/README.md b/11_virtual_mem_part1_identity_mapping/README.md index 0d24f17f..726012e1 100644 --- a/11_virtual_mem_part1_identity_mapping/README.md +++ b/11_virtual_mem_part1_identity_mapping/README.md @@ -1006,9 +1006,9 @@ diff -uNr 10_privilege_level/src/bsp.rs 11_virtual_mem_part1_identity_mapping/sr diff -uNr 10_privilege_level/src/main.rs 11_virtual_mem_part1_identity_mapping/src/main.rs --- 10_privilege_level/src/main.rs +++ 11_virtual_mem_part1_identity_mapping/src/main.rs -@@ -106,7 +106,10 @@ - //! +@@ -107,7 +107,10 @@ //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html + //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html +#![allow(incomplete_features)] #![feature(const_fn_fn_ptr_basics)] @@ -1017,7 +1017,7 @@ diff -uNr 10_privilege_level/src/main.rs 11_virtual_mem_part1_identity_mapping/s #![feature(format_args_nl)] #![feature(panic_info_message)] #![feature(trait_alias)] -@@ -130,9 +133,18 @@ +@@ -131,9 +134,18 @@ /// # Safety /// /// - Only a single core must be active and running this function. @@ -1037,7 +1037,7 @@ diff -uNr 10_privilege_level/src/main.rs 11_virtual_mem_part1_identity_mapping/s for i in bsp::driver::driver_manager().all_device_drivers().iter() { if let Err(x) = i.init() { -@@ -156,6 +168,9 @@ +@@ -157,6 +169,9 @@ info!("Booting on: {}", bsp::board_name()); @@ -1047,7 +1047,7 @@ diff -uNr 10_privilege_level/src/main.rs 11_virtual_mem_part1_identity_mapping/s let (_, privilege_level) = exception::current_privilege_level(); info!("Current privilege level: {}", privilege_level); -@@ -179,6 +194,13 @@ +@@ -180,6 +195,13 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/11_virtual_mem_part1_identity_mapping/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/11_virtual_mem_part1_identity_mapping/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/11_virtual_mem_part1_identity_mapping/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/11_virtual_mem_part1_identity_mapping/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/11_virtual_mem_part1_identity_mapping/src/main.rs b/11_virtual_mem_part1_identity_mapping/src/main.rs index 83ee1de5..bfc7d5e4 100644 --- a/11_virtual_mem_part1_identity_mapping/src/main.rs +++ b/11_virtual_mem_part1_identity_mapping/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![allow(incomplete_features)] #![feature(const_fn_fn_ptr_basics)] diff --git a/11_virtual_mem_part1_identity_mapping/src/panic_wait.rs b/11_virtual_mem_part1_identity_mapping/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/11_virtual_mem_part1_identity_mapping/src/panic_wait.rs +++ b/11_virtual_mem_part1_identity_mapping/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/11_virtual_mem_part1_identity_mapping/src/print.rs b/11_virtual_mem_part1_identity_mapping/src/print.rs index 5a563811..89fa6694 100644 --- a/11_virtual_mem_part1_identity_mapping/src/print.rs +++ b/11_virtual_mem_part1_identity_mapping/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/11_virtual_mem_part1_identity_mapping/src/synchronization.rs b/11_virtual_mem_part1_identity_mapping/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/11_virtual_mem_part1_identity_mapping/src/synchronization.rs +++ b/11_virtual_mem_part1_identity_mapping/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/12_exceptions_part1_groundwork/README.md b/12_exceptions_part1_groundwork/README.md index 829ed092..c5d0f9f1 100644 --- a/12_exceptions_part1_groundwork/README.md +++ b/12_exceptions_part1_groundwork/README.md @@ -967,7 +967,7 @@ diff -uNr 11_virtual_mem_part1_identity_mapping/src/exception.rs 12_exceptions_p diff -uNr 11_virtual_mem_part1_identity_mapping/src/main.rs 12_exceptions_part1_groundwork/src/main.rs --- 11_virtual_mem_part1_identity_mapping/src/main.rs +++ 12_exceptions_part1_groundwork/src/main.rs -@@ -111,6 +111,7 @@ +@@ -112,6 +112,7 @@ #![feature(const_generics)] #![feature(const_panic)] #![feature(format_args_nl)] @@ -975,7 +975,7 @@ diff -uNr 11_virtual_mem_part1_identity_mapping/src/main.rs 12_exceptions_part1_ #![feature(panic_info_message)] #![feature(trait_alias)] #![no_main] -@@ -142,6 +143,8 @@ +@@ -143,6 +144,8 @@ use driver::interface::DriverManager; use memory::mmu::interface::MMU; @@ -984,7 +984,7 @@ diff -uNr 11_virtual_mem_part1_identity_mapping/src/main.rs 12_exceptions_part1_ if let Err(string) = memory::mmu::mmu().init() { panic!("MMU: {}", string); } -@@ -194,13 +197,28 @@ +@@ -195,13 +198,28 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/12_exceptions_part1_groundwork/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/12_exceptions_part1_groundwork/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/12_exceptions_part1_groundwork/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/12_exceptions_part1_groundwork/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/12_exceptions_part1_groundwork/src/main.rs b/12_exceptions_part1_groundwork/src/main.rs index 80706a24..4aa47c6e 100644 --- a/12_exceptions_part1_groundwork/src/main.rs +++ b/12_exceptions_part1_groundwork/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![allow(incomplete_features)] #![feature(const_fn_fn_ptr_basics)] diff --git a/12_exceptions_part1_groundwork/src/panic_wait.rs b/12_exceptions_part1_groundwork/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/12_exceptions_part1_groundwork/src/panic_wait.rs +++ b/12_exceptions_part1_groundwork/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/12_exceptions_part1_groundwork/src/print.rs b/12_exceptions_part1_groundwork/src/print.rs index 5a563811..89fa6694 100644 --- a/12_exceptions_part1_groundwork/src/print.rs +++ b/12_exceptions_part1_groundwork/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/12_exceptions_part1_groundwork/src/synchronization.rs b/12_exceptions_part1_groundwork/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/12_exceptions_part1_groundwork/src/synchronization.rs +++ b/12_exceptions_part1_groundwork/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/13_integrated_testing/README.md b/13_integrated_testing/README.md index 9a99cbdf..cd03c27e 100644 --- a/13_integrated_testing/README.md +++ b/13_integrated_testing/README.md @@ -1157,7 +1157,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/exception.rs 13_integrated_testing/ diff -uNr 12_exceptions_part1_groundwork/src/lib.rs 13_integrated_testing/src/lib.rs --- 12_exceptions_part1_groundwork/src/lib.rs +++ 13_integrated_testing/src/lib.rs -@@ -0,0 +1,168 @@ +@@ -0,0 +1,169 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2021 Andre Richter @@ -1267,6 +1267,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/lib.rs 13_integrated_testing/src/li +//! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. +//! +//! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html ++//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html + +#![allow(incomplete_features)] +#![feature(const_fn_fn_ptr_basics)] @@ -1330,7 +1331,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/lib.rs 13_integrated_testing/src/li diff -uNr 12_exceptions_part1_groundwork/src/main.rs 13_integrated_testing/src/main.rs --- 12_exceptions_part1_groundwork/src/main.rs +++ 13_integrated_testing/src/main.rs -@@ -6,128 +6,12 @@ +@@ -6,129 +6,12 @@ #![doc(html_logo_url = "https://git.io/JeGIp")] //! The `kernel` binary. @@ -1433,6 +1434,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/main.rs 13_integrated_testing/src/m -//! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. -//! -//! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +-//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html - -#![allow(incomplete_features)] -#![feature(const_fn_fn_ptr_basics)] @@ -1461,7 +1463,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/main.rs 13_integrated_testing/src/m /// Early init code. /// -@@ -139,6 +23,7 @@ +@@ -140,6 +23,7 @@ /// - Without it, any atomic operations, e.g. the yet-to-be-introduced spinlocks in the device /// drivers (which currently employ NullLocks instead of spinlocks), will fail to work on /// the RPi SoCs. @@ -1469,7 +1471,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/main.rs 13_integrated_testing/src/m unsafe fn kernel_init() -> ! { use driver::interface::DriverManager; use memory::mmu::interface::MMU; -@@ -165,9 +50,7 @@ +@@ -166,9 +50,7 @@ fn kernel_main() -> ! { use bsp::console::console; use console::interface::All; @@ -1479,7 +1481,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/main.rs 13_integrated_testing/src/m info!("Booting on: {}", bsp::board_name()); -@@ -194,31 +77,6 @@ +@@ -195,31 +77,6 @@ info!(" {}. {}", i + 1, driver.compatible()); } @@ -1605,7 +1607,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/panic_wait.rs 13_integrated_testing + /// Prints with a newline - only use from the panic handler. /// - /// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html + /// Carbon copy from @@ -35,5 +52,16 @@ panic_println!("\nKernel panic!"); } diff --git a/13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/13_integrated_testing/src/lib.rs b/13_integrated_testing/src/lib.rs index 0bc8d329..d427375c 100644 --- a/13_integrated_testing/src/lib.rs +++ b/13_integrated_testing/src/lib.rs @@ -107,6 +107,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![allow(incomplete_features)] #![feature(const_fn_fn_ptr_basics)] diff --git a/13_integrated_testing/src/panic_wait.rs b/13_integrated_testing/src/panic_wait.rs index 76438a9b..61536ba8 100644 --- a/13_integrated_testing/src/panic_wait.rs +++ b/13_integrated_testing/src/panic_wait.rs @@ -36,7 +36,7 @@ fn _panic_exit() -> ! { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/13_integrated_testing/src/print.rs b/13_integrated_testing/src/print.rs index 5a563811..89fa6694 100644 --- a/13_integrated_testing/src/print.rs +++ b/13_integrated_testing/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/13_integrated_testing/src/synchronization.rs b/13_integrated_testing/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/13_integrated_testing/src/synchronization.rs +++ b/13_integrated_testing/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/14_exceptions_part2_peripheral_IRQs/README.md b/14_exceptions_part2_peripheral_IRQs/README.md index e6dd762e..060a58e2 100644 --- a/14_exceptions_part2_peripheral_IRQs/README.md +++ b/14_exceptions_part2_peripheral_IRQs/README.md @@ -1776,7 +1776,7 @@ diff -uNr 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs --- 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ 14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -10,8 +10,8 @@ - //! - https://developer.arm.com/documentation/ddi0183/latest + //! - use crate::{ - bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, @@ -2180,7 +2180,7 @@ diff -uNr 13_integrated_testing/src/exception/asynchronous.rs 14_exceptions_part +/// context, aka executing an interrupt vector or subcalls of it. +/// +/// Concept and implementation derived from the `CriticalSection` introduced in -+/// https://github.com/rust-embedded/bare-metal ++/// +#[derive(Clone, Copy)] +pub struct IRQContext<'irq_context> { + _0: PhantomData<&'irq_context ()>, @@ -2296,8 +2296,8 @@ diff -uNr 13_integrated_testing/src/exception/asynchronous.rs 14_exceptions_part diff -uNr 13_integrated_testing/src/lib.rs 14_exceptions_part2_peripheral_IRQs/src/lib.rs --- 13_integrated_testing/src/lib.rs +++ 14_exceptions_part2_peripheral_IRQs/src/lib.rs -@@ -109,9 +109,11 @@ - //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +@@ -110,9 +110,11 @@ + //! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![allow(incomplete_features)] +#![feature(asm)] @@ -2308,7 +2308,7 @@ diff -uNr 13_integrated_testing/src/lib.rs 14_exceptions_part2_peripheral_IRQs/s #![feature(format_args_nl)] #![feature(global_asm)] #![feature(linkage)] -@@ -135,6 +137,7 @@ +@@ -136,6 +138,7 @@ pub mod exception; pub mod memory; pub mod print; @@ -2510,7 +2510,7 @@ diff -uNr 13_integrated_testing/src/state.rs 14_exceptions_part2_peripheral_IRQs diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_peripheral_IRQs/src/synchronization.rs --- 13_integrated_testing/src/synchronization.rs +++ 14_exceptions_part2_peripheral_IRQs/src/synchronization.rs -@@ -27,6 +27,21 @@ +@@ -28,6 +28,21 @@ /// Locks the mutex and grants the closure temporary mutable access to the wrapped data. fn lock(&self, f: impl FnOnce(&mut Self::Data) -> R) -> R; } @@ -2532,7 +2532,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip } /// A pseudo-lock for teaching purposes. -@@ -35,8 +50,18 @@ +@@ -36,8 +51,18 @@ /// other cores to the contained data. This part is preserved for later lessons. /// /// The lock will only be used as long as it is safe to do so, i.e. as long as the kernel is @@ -2553,7 +2553,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip where T: ?Sized, { -@@ -47,10 +72,22 @@ +@@ -48,10 +73,22 @@ // Public Code //-------------------------------------------------------------------------------------------------- @@ -2579,7 +2579,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip /// Create an instance. pub const fn new(data: T) -> Self { Self { -@@ -62,8 +99,9 @@ +@@ -63,8 +100,9 @@ //------------------------------------------------------------------------------ // OS Interface Code //------------------------------------------------------------------------------ @@ -2590,7 +2590,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip type Data = T; fn lock(&self, f: impl FnOnce(&mut Self::Data) -> R) -> R { -@@ -71,6 +109,32 @@ +@@ -72,6 +110,32 @@ // mutable reference will ever only be given out once at a time. let data = unsafe { &mut *self.data.get() }; diff --git a/14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index 1dd0a14c..c8026dcf 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp, bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, exception, diff --git a/14_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs b/14_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs index 2b9ef05f..e9aace35 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/exception/asynchronous.rs @@ -38,7 +38,7 @@ pub struct IRQDescriptor { /// context, aka executing an interrupt vector or subcalls of it. /// /// Concept and implementation derived from the `CriticalSection` introduced in -/// https://github.com/rust-embedded/bare-metal +/// #[derive(Clone, Copy)] pub struct IRQContext<'irq_context> { _0: PhantomData<&'irq_context ()>, diff --git a/14_exceptions_part2_peripheral_IRQs/src/lib.rs b/14_exceptions_part2_peripheral_IRQs/src/lib.rs index bc50cabd..2d12290f 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/lib.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/lib.rs @@ -107,6 +107,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![allow(incomplete_features)] #![feature(asm)] diff --git a/14_exceptions_part2_peripheral_IRQs/src/panic_wait.rs b/14_exceptions_part2_peripheral_IRQs/src/panic_wait.rs index 0b724abd..8c7770b6 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/panic_wait.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/panic_wait.rs @@ -36,7 +36,7 @@ fn _panic_exit() -> ! { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/14_exceptions_part2_peripheral_IRQs/src/print.rs b/14_exceptions_part2_peripheral_IRQs/src/print.rs index 5a563811..89fa6694 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/print.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs b/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs index 6133826e..fe9d454a 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/15_virtual_mem_part2_mmio_remap/README.md b/15_virtual_mem_part2_mmio_remap/README.md index b326d589..9adbe9c2 100644 --- a/15_virtual_mem_part2_mmio_remap/README.md +++ b/15_virtual_mem_part2_mmio_remap/README.md @@ -1190,7 +1190,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_ --- 14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ 15_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -10,10 +10,13 @@ - //! - https://developer.arm.com/documentation/ddi0183/latest + //! - use crate::{ - bsp, bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, exception, @@ -1939,7 +1939,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/driver.rs 15_virtual_mem_part2 diff -uNr 14_exceptions_part2_peripheral_IRQs/src/lib.rs 15_virtual_mem_part2_mmio_remap/src/lib.rs --- 14_exceptions_part2_peripheral_IRQs/src/lib.rs +++ 15_virtual_mem_part2_mmio_remap/src/lib.rs -@@ -110,6 +110,7 @@ +@@ -111,6 +111,7 @@ #![allow(incomplete_features)] #![feature(asm)] @@ -1947,7 +1947,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/lib.rs 15_virtual_mem_part2_mm #![feature(const_fn_fn_ptr_basics)] #![feature(const_generics)] #![feature(const_panic)] -@@ -131,6 +132,7 @@ +@@ -132,6 +133,7 @@ mod synchronization; pub mod bsp; diff --git a/15_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/15_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index e279c206..4b1e9c93 100644 --- a/15_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/15_virtual_mem_part2_mmio_remap/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp, bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, exception, memory, diff --git a/15_virtual_mem_part2_mmio_remap/src/exception/asynchronous.rs b/15_virtual_mem_part2_mmio_remap/src/exception/asynchronous.rs index 2b9ef05f..e9aace35 100644 --- a/15_virtual_mem_part2_mmio_remap/src/exception/asynchronous.rs +++ b/15_virtual_mem_part2_mmio_remap/src/exception/asynchronous.rs @@ -38,7 +38,7 @@ pub struct IRQDescriptor { /// context, aka executing an interrupt vector or subcalls of it. /// /// Concept and implementation derived from the `CriticalSection` introduced in -/// https://github.com/rust-embedded/bare-metal +/// #[derive(Clone, Copy)] pub struct IRQContext<'irq_context> { _0: PhantomData<&'irq_context ()>, diff --git a/15_virtual_mem_part2_mmio_remap/src/lib.rs b/15_virtual_mem_part2_mmio_remap/src/lib.rs index 89df0dd5..a509d86f 100644 --- a/15_virtual_mem_part2_mmio_remap/src/lib.rs +++ b/15_virtual_mem_part2_mmio_remap/src/lib.rs @@ -107,6 +107,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![allow(incomplete_features)] #![feature(asm)] diff --git a/15_virtual_mem_part2_mmio_remap/src/panic_wait.rs b/15_virtual_mem_part2_mmio_remap/src/panic_wait.rs index 0b724abd..8c7770b6 100644 --- a/15_virtual_mem_part2_mmio_remap/src/panic_wait.rs +++ b/15_virtual_mem_part2_mmio_remap/src/panic_wait.rs @@ -36,7 +36,7 @@ fn _panic_exit() -> ! { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/15_virtual_mem_part2_mmio_remap/src/print.rs b/15_virtual_mem_part2_mmio_remap/src/print.rs index 5a563811..89fa6694 100644 --- a/15_virtual_mem_part2_mmio_remap/src/print.rs +++ b/15_virtual_mem_part2_mmio_remap/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/15_virtual_mem_part2_mmio_remap/src/synchronization.rs b/15_virtual_mem_part2_mmio_remap/src/synchronization.rs index 6133826e..fe9d454a 100644 --- a/15_virtual_mem_part2_mmio_remap/src/synchronization.rs +++ b/15_virtual_mem_part2_mmio_remap/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell; diff --git a/X1_JTAG_boot/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs b/X1_JTAG_boot/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs index ce39752d..d2aae4d2 100644 --- a/X1_JTAG_boot/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs +++ b/X1_JTAG_boot/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs @@ -6,8 +6,8 @@ //! //! # Resources //! -//! - https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf -//! - https://developer.arm.com/documentation/ddi0183/latest +//! - +//! - use crate::{ bsp::device_driver::common::MMIODerefWrapper, console, cpu, driver, synchronization, diff --git a/X1_JTAG_boot/src/main.rs b/X1_JTAG_boot/src/main.rs index fa5ba64a..4f45d955 100644 --- a/X1_JTAG_boot/src/main.rs +++ b/X1_JTAG_boot/src/main.rs @@ -105,6 +105,7 @@ //! 2. Once finished with architectural setup, the arch code calls [`runtime_init::runtime_init()`]. //! //! [`cpu::boot::arch_boot::_start()`]: cpu/boot/arch_boot/fn._start.html +//! [`runtime_init::runtime_init()`]: runtime_init/fn.runtime_init.html #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] diff --git a/X1_JTAG_boot/src/panic_wait.rs b/X1_JTAG_boot/src/panic_wait.rs index 7980f5de..66fbe6b4 100644 --- a/X1_JTAG_boot/src/panic_wait.rs +++ b/X1_JTAG_boot/src/panic_wait.rs @@ -19,7 +19,7 @@ fn _panic_print(args: fmt::Arguments) { /// Prints with a newline - only use from the panic handler. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! panic_println { ($($arg:tt)*) => ({ diff --git a/X1_JTAG_boot/src/print.rs b/X1_JTAG_boot/src/print.rs index 5a563811..89fa6694 100644 --- a/X1_JTAG_boot/src/print.rs +++ b/X1_JTAG_boot/src/print.rs @@ -20,7 +20,7 @@ pub fn _print(args: fmt::Arguments) { /// Prints without a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); @@ -28,7 +28,7 @@ macro_rules! print { /// Prints with a newline. /// -/// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html +/// Carbon copy from #[macro_export] macro_rules! println { () => ($crate::print!("\n")); diff --git a/X1_JTAG_boot/src/synchronization.rs b/X1_JTAG_boot/src/synchronization.rs index f956b5cd..7bb2938b 100644 --- a/X1_JTAG_boot/src/synchronization.rs +++ b/X1_JTAG_boot/src/synchronization.rs @@ -4,10 +4,11 @@ //! Synchronization primitives. //! -//! Suggested literature: -//! - https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html -//! - https://stackoverflow.com/questions/59428096/understanding-the-send-trait -//! - https://doc.rust-lang.org/std/cell/index.html +//! # Resources +//! +//! - +//! - +//! - use core::cell::UnsafeCell;