diff --git a/06_drivers_gpio_uart/README.md b/06_drivers_gpio_uart/README.md index 7f794b9e..d2b17e6f 100644 --- a/06_drivers_gpio_uart/README.md +++ b/06_drivers_gpio_uart/README.md @@ -658,8 +658,8 @@ diff -uNr 05_safe_globals/src/bsp/raspberrypi/console.rs 06_drivers_gpio_uart/sr //! BSP console facilities. -use crate::{console, synchronization, synchronization::NullLock}; -+use super::{super::device_driver, memory::map}; -+use crate::console; ++use super::memory; ++use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -748,7 +748,7 @@ diff -uNr 05_safe_globals/src/bsp/raspberrypi/console.rs 06_drivers_gpio_uart/sr - } +/// - Use only for printing during a panic. +pub unsafe fn panic_console_out() -> impl fmt::Write { -+ let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); ++ let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); + uart.init(); + uart } diff --git a/06_drivers_gpio_uart/src/bsp/raspberrypi/console.rs b/06_drivers_gpio_uart/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/06_drivers_gpio_uart/src/bsp/raspberrypi/console.rs +++ b/06_drivers_gpio_uart/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/07_uart_chainloader/src/bsp/raspberrypi/console.rs b/07_uart_chainloader/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/07_uart_chainloader/src/bsp/raspberrypi/console.rs +++ b/07_uart_chainloader/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/08_timestamps/src/bsp/raspberrypi/console.rs b/08_timestamps/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/08_timestamps/src/bsp/raspberrypi/console.rs +++ b/08_timestamps/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/09_hw_debug_JTAG/src/bsp/raspberrypi/console.rs b/09_hw_debug_JTAG/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/09_hw_debug_JTAG/src/bsp/raspberrypi/console.rs +++ b/09_hw_debug_JTAG/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/10_privilege_level/src/bsp/raspberrypi/console.rs b/10_privilege_level/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/10_privilege_level/src/bsp/raspberrypi/console.rs +++ b/10_privilege_level/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/11_virtual_memory/README.md b/11_virtual_memory/README.md index 18c1d066..f3d79659 100644 --- a/11_virtual_memory/README.md +++ b/11_virtual_memory/README.md @@ -673,7 +673,7 @@ diff -uNr 10_privilege_level/src/bsp/raspberrypi/memory/mmu.rs 11_virtual_memory + +//! BSP Memory Management Unit. + -+use super::super::memory; ++use super::map as memory_map; +use crate::memory::mmu::*; +use core::ops::RangeInclusive; + @@ -688,7 +688,7 @@ diff -uNr 10_privilege_level/src/bsp/raspberrypi/memory/mmu.rs 11_virtual_memory +/// The layout must contain only special ranges, aka anything that is _not_ normal cacheable DRAM. +/// It is agnostic of the paging granularity that the architecture's MMU will use. +pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( -+ memory::map::END_INCLUSIVE, ++ memory_map::END_INCLUSIVE, + [ + RangeDescriptor { + name: "Kernel code and RO data", @@ -729,7 +729,7 @@ diff -uNr 10_privilege_level/src/bsp/raspberrypi/memory/mmu.rs 11_virtual_memory + // The last 64 KiB slot in the first 512 MiB + RangeInclusive::new(0x1FFF_0000, 0x1FFF_FFFF) + }, -+ translation: Translation::Offset(memory::map::mmio::BASE + 0x20_0000), ++ translation: Translation::Offset(memory_map::mmio::BASE + 0x20_0000), + attribute_fields: AttributeFields { + mem_attributes: MemAttributes::Device, + acc_perms: AccessPermissions::ReadWrite, @@ -739,7 +739,7 @@ diff -uNr 10_privilege_level/src/bsp/raspberrypi/memory/mmu.rs 11_virtual_memory + RangeDescriptor { + name: "Device MMIO", + virtual_range: || { -+ RangeInclusive::new(memory::map::mmio::BASE, memory::map::mmio::END_INCLUSIVE) ++ RangeInclusive::new(memory_map::mmio::BASE, memory_map::mmio::END_INCLUSIVE) + }, + translation: Translation::Identity, + attribute_fields: AttributeFields { @@ -757,7 +757,7 @@ diff -uNr 10_privilege_level/src/bsp/raspberrypi/memory/mmu.rs 11_virtual_memory + +/// Return the address space size in bytes. +pub const fn addr_space_size() -> usize { -+ memory::map::END_INCLUSIVE + 1 ++ memory_map::END_INCLUSIVE + 1 +} + +/// Return a reference to the virtual memory layout. diff --git a/11_virtual_memory/src/bsp/raspberrypi/console.rs b/11_virtual_memory/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/11_virtual_memory/src/bsp/raspberrypi/console.rs +++ b/11_virtual_memory/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/11_virtual_memory/src/bsp/raspberrypi/memory/mmu.rs b/11_virtual_memory/src/bsp/raspberrypi/memory/mmu.rs index a6ca52a1..56b06716 100644 --- a/11_virtual_memory/src/bsp/raspberrypi/memory/mmu.rs +++ b/11_virtual_memory/src/bsp/raspberrypi/memory/mmu.rs @@ -4,7 +4,7 @@ //! BSP Memory Management Unit. -use super::super::memory; +use super::map as memory_map; use crate::memory::mmu::*; use core::ops::RangeInclusive; @@ -19,7 +19,7 @@ const NUM_MEM_RANGES: usize = 3; /// The layout must contain only special ranges, aka anything that is _not_ normal cacheable DRAM. /// It is agnostic of the paging granularity that the architecture's MMU will use. pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( - memory::map::END_INCLUSIVE, + memory_map::END_INCLUSIVE, [ RangeDescriptor { name: "Kernel code and RO data", @@ -60,7 +60,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout // The last 64 KiB slot in the first 512 MiB RangeInclusive::new(0x1FFF_0000, 0x1FFF_FFFF) }, - translation: Translation::Offset(memory::map::mmio::BASE + 0x20_0000), + translation: Translation::Offset(memory_map::mmio::BASE + 0x20_0000), attribute_fields: AttributeFields { mem_attributes: MemAttributes::Device, acc_perms: AccessPermissions::ReadWrite, @@ -70,7 +70,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout RangeDescriptor { name: "Device MMIO", virtual_range: || { - RangeInclusive::new(memory::map::mmio::BASE, memory::map::mmio::END_INCLUSIVE) + RangeInclusive::new(memory_map::mmio::BASE, memory_map::mmio::END_INCLUSIVE) }, translation: Translation::Identity, attribute_fields: AttributeFields { @@ -88,7 +88,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout /// Return the address space size in bytes. pub const fn addr_space_size() -> usize { - memory::map::END_INCLUSIVE + 1 + memory_map::END_INCLUSIVE + 1 } /// Return a reference to the virtual memory layout. diff --git a/12_exceptions_part1_groundwork/README.md b/12_exceptions_part1_groundwork/README.md index a390c97f..7f4ebdcb 100644 --- a/12_exceptions_part1_groundwork/README.md +++ b/12_exceptions_part1_groundwork/README.md @@ -924,7 +924,7 @@ diff -uNr 11_virtual_memory/src/bsp/raspberrypi/memory/mmu.rs 12_exceptions_part - // The last 64 KiB slot in the first 512 MiB - RangeInclusive::new(0x1FFF_0000, 0x1FFF_FFFF) - }, -- translation: Translation::Offset(memory::map::mmio::BASE + 0x20_0000), +- translation: Translation::Offset(memory_map::mmio::BASE + 0x20_0000), - attribute_fields: AttributeFields { - mem_attributes: MemAttributes::Device, - acc_perms: AccessPermissions::ReadWrite, @@ -934,7 +934,7 @@ diff -uNr 11_virtual_memory/src/bsp/raspberrypi/memory/mmu.rs 12_exceptions_part - RangeDescriptor { name: "Device MMIO", virtual_range: || { - RangeInclusive::new(memory::map::mmio::BASE, memory::map::mmio::END_INCLUSIVE) + RangeInclusive::new(memory_map::mmio::BASE, memory_map::mmio::END_INCLUSIVE) diff -uNr 11_virtual_memory/src/bsp.rs 12_exceptions_part1_groundwork/src/bsp.rs --- 11_virtual_memory/src/bsp.rs diff --git a/12_exceptions_part1_groundwork/src/bsp/raspberrypi/console.rs b/12_exceptions_part1_groundwork/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/12_exceptions_part1_groundwork/src/bsp/raspberrypi/console.rs +++ b/12_exceptions_part1_groundwork/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/12_exceptions_part1_groundwork/src/bsp/raspberrypi/memory/mmu.rs b/12_exceptions_part1_groundwork/src/bsp/raspberrypi/memory/mmu.rs index 1dc1fdd7..dea366d3 100644 --- a/12_exceptions_part1_groundwork/src/bsp/raspberrypi/memory/mmu.rs +++ b/12_exceptions_part1_groundwork/src/bsp/raspberrypi/memory/mmu.rs @@ -4,7 +4,7 @@ //! BSP Memory Management Unit. -use super::super::memory; +use super::map as memory_map; use crate::memory::mmu::*; use core::ops::RangeInclusive; @@ -19,7 +19,7 @@ const NUM_MEM_RANGES: usize = 2; /// The layout must contain only special ranges, aka anything that is _not_ normal cacheable DRAM. /// It is agnostic of the paging granularity that the architecture's MMU will use. pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( - memory::map::END_INCLUSIVE, + memory_map::END_INCLUSIVE, [ RangeDescriptor { name: "Kernel code and RO data", @@ -57,7 +57,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout RangeDescriptor { name: "Device MMIO", virtual_range: || { - RangeInclusive::new(memory::map::mmio::BASE, memory::map::mmio::END_INCLUSIVE) + RangeInclusive::new(memory_map::mmio::BASE, memory_map::mmio::END_INCLUSIVE) }, translation: Translation::Identity, attribute_fields: AttributeFields { @@ -75,7 +75,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout /// Return the address space size in bytes. pub const fn addr_space_size() -> usize { - memory::map::END_INCLUSIVE + 1 + memory_map::END_INCLUSIVE + 1 } /// Return a reference to the virtual memory layout. diff --git a/13_integrated_testing/README.md b/13_integrated_testing/README.md index 2a628647..d630eea5 100644 --- a/13_integrated_testing/README.md +++ b/13_integrated_testing/README.md @@ -1629,13 +1629,11 @@ diff -uNr 12_exceptions_part1_groundwork/test-macros/Cargo.toml 13_integrated_te diff -uNr 12_exceptions_part1_groundwork/test-macros/src/lib.rs 13_integrated_testing/test-macros/src/lib.rs --- 12_exceptions_part1_groundwork/test-macros/src/lib.rs +++ 13_integrated_testing/test-macros/src/lib.rs -@@ -0,0 +1,31 @@ +@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2019-2020 Andre Richter + -+extern crate proc_macro; -+ +use proc_macro::TokenStream; +use proc_macro2::Span; +use quote::quote; diff --git a/13_integrated_testing/src/bsp/raspberrypi/console.rs b/13_integrated_testing/src/bsp/raspberrypi/console.rs index beaaee3b..90011da6 100644 --- a/13_integrated_testing/src/bsp/raspberrypi/console.rs +++ b/13_integrated_testing/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart } diff --git a/13_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs b/13_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs index 0ceaaf6b..31c6f9a6 100644 --- a/13_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs +++ b/13_integrated_testing/src/bsp/raspberrypi/memory/mmu.rs @@ -4,7 +4,7 @@ //! BSP Memory Management Unit. -use super::super::memory; +use super::map as memory_map; use crate::memory::mmu::*; use core::ops::RangeInclusive; @@ -19,7 +19,7 @@ const NUM_MEM_RANGES: usize = 2; /// The layout must contain only special ranges, aka anything that is _not_ normal cacheable DRAM. /// It is agnostic of the paging granularity that the architecture's MMU will use. pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( - memory::map::END_INCLUSIVE, + memory_map::END_INCLUSIVE, [ RangeDescriptor { name: "Kernel code and RO data", @@ -57,7 +57,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout RangeDescriptor { name: "Device MMIO", virtual_range: || { - RangeInclusive::new(memory::map::mmio::BASE, memory::map::mmio::END_INCLUSIVE) + RangeInclusive::new(memory_map::mmio::BASE, memory_map::mmio::END_INCLUSIVE) }, translation: Translation::Identity, attribute_fields: AttributeFields { @@ -75,7 +75,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout /// Return the address space size in bytes. pub const fn addr_space_size() -> usize { - memory::map::END_INCLUSIVE + 1 + memory_map::END_INCLUSIVE + 1 } /// Return a reference to the virtual memory layout. diff --git a/X1_JTAG_boot/src/bsp/raspberrypi/console.rs b/X1_JTAG_boot/src/bsp/raspberrypi/console.rs index 061f9c1c..73dd8916 100644 --- a/X1_JTAG_boot/src/bsp/raspberrypi/console.rs +++ b/X1_JTAG_boot/src/bsp/raspberrypi/console.rs @@ -4,8 +4,8 @@ //! BSP console facilities. -use super::{super::device_driver, memory::map}; -use crate::console; +use super::memory; +use crate::{bsp::device_driver, console}; use core::fmt; //-------------------------------------------------------------------------------------------------- @@ -19,7 +19,7 @@ use core::fmt; /// /// - Use only for printing during a panic. pub unsafe fn panic_console_out() -> impl fmt::Write { - let mut uart = device_driver::PanicUart::new(map::mmio::PL011_UART_BASE); + let mut uart = device_driver::PanicUart::new(memory::map::mmio::PL011_UART_BASE); uart.init(); uart }