Minor namespace adaptions

pull/54/head
Andre Richter 5 years ago
parent e9ff018c92
commit 1cba21bda1
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -658,8 +658,8 @@ diff -uNr 05_safe_globals/src/bsp/raspberrypi/console.rs 06_drivers_gpio_uart/sr
//! BSP console facilities. //! BSP console facilities.
-use crate::{console, synchronization, synchronization::NullLock}; -use crate::{console, synchronization, synchronization::NullLock};
+use super::{super::device_driver, memory::map}; +use super::memory;
+use crate::console; +use crate::{bsp::device_driver, console};
use core::fmt; 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. +/// - Use only for printing during a panic.
+pub unsafe fn panic_console_out() -> impl fmt::Write { +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.init();
+ uart + uart
} }

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -673,7 +673,7 @@ diff -uNr 10_privilege_level/src/bsp/raspberrypi/memory/mmu.rs 11_virtual_memory
+ +
+//! BSP Memory Management Unit. +//! BSP Memory Management Unit.
+ +
+use super::super::memory; +use super::map as memory_map;
+use crate::memory::mmu::*; +use crate::memory::mmu::*;
+use core::ops::RangeInclusive; +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. +/// 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. +/// It is agnostic of the paging granularity that the architecture's MMU will use.
+pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( +pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new(
+ memory::map::END_INCLUSIVE, + memory_map::END_INCLUSIVE,
+ [ + [
+ RangeDescriptor { + RangeDescriptor {
+ name: "Kernel code and RO data", + 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 + // The last 64 KiB slot in the first 512 MiB
+ RangeInclusive::new(0x1FFF_0000, 0x1FFF_FFFF) + 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 { + attribute_fields: AttributeFields {
+ mem_attributes: MemAttributes::Device, + mem_attributes: MemAttributes::Device,
+ acc_perms: AccessPermissions::ReadWrite, + acc_perms: AccessPermissions::ReadWrite,
@ -739,7 +739,7 @@ diff -uNr 10_privilege_level/src/bsp/raspberrypi/memory/mmu.rs 11_virtual_memory
+ RangeDescriptor { + RangeDescriptor {
+ name: "Device MMIO", + name: "Device MMIO",
+ virtual_range: || { + 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, + translation: Translation::Identity,
+ attribute_fields: AttributeFields { + 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. +/// Return the address space size in bytes.
+pub const fn addr_space_size() -> usize { +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. +/// Return a reference to the virtual memory layout.

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -4,7 +4,7 @@
//! BSP Memory Management Unit. //! BSP Memory Management Unit.
use super::super::memory; use super::map as memory_map;
use crate::memory::mmu::*; use crate::memory::mmu::*;
use core::ops::RangeInclusive; 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. /// 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. /// It is agnostic of the paging granularity that the architecture's MMU will use.
pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new(
memory::map::END_INCLUSIVE, memory_map::END_INCLUSIVE,
[ [
RangeDescriptor { RangeDescriptor {
name: "Kernel code and RO data", 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 // The last 64 KiB slot in the first 512 MiB
RangeInclusive::new(0x1FFF_0000, 0x1FFF_FFFF) 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 { attribute_fields: AttributeFields {
mem_attributes: MemAttributes::Device, mem_attributes: MemAttributes::Device,
acc_perms: AccessPermissions::ReadWrite, acc_perms: AccessPermissions::ReadWrite,
@ -70,7 +70,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout
RangeDescriptor { RangeDescriptor {
name: "Device MMIO", name: "Device MMIO",
virtual_range: || { 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, translation: Translation::Identity,
attribute_fields: AttributeFields { attribute_fields: AttributeFields {
@ -88,7 +88,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout
/// Return the address space size in bytes. /// Return the address space size in bytes.
pub const fn addr_space_size() -> usize { 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. /// Return a reference to the virtual memory layout.

@ -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 - // The last 64 KiB slot in the first 512 MiB
- RangeInclusive::new(0x1FFF_0000, 0x1FFF_FFFF) - 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 { - attribute_fields: AttributeFields {
- mem_attributes: MemAttributes::Device, - mem_attributes: MemAttributes::Device,
- acc_perms: AccessPermissions::ReadWrite, - acc_perms: AccessPermissions::ReadWrite,
@ -934,7 +934,7 @@ diff -uNr 11_virtual_memory/src/bsp/raspberrypi/memory/mmu.rs 12_exceptions_part
- RangeDescriptor { - RangeDescriptor {
name: "Device MMIO", name: "Device MMIO",
virtual_range: || { 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 diff -uNr 11_virtual_memory/src/bsp.rs 12_exceptions_part1_groundwork/src/bsp.rs
--- 11_virtual_memory/src/bsp.rs --- 11_virtual_memory/src/bsp.rs

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -4,7 +4,7 @@
//! BSP Memory Management Unit. //! BSP Memory Management Unit.
use super::super::memory; use super::map as memory_map;
use crate::memory::mmu::*; use crate::memory::mmu::*;
use core::ops::RangeInclusive; 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. /// 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. /// It is agnostic of the paging granularity that the architecture's MMU will use.
pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new(
memory::map::END_INCLUSIVE, memory_map::END_INCLUSIVE,
[ [
RangeDescriptor { RangeDescriptor {
name: "Kernel code and RO data", name: "Kernel code and RO data",
@ -57,7 +57,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout
RangeDescriptor { RangeDescriptor {
name: "Device MMIO", name: "Device MMIO",
virtual_range: || { 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, translation: Translation::Identity,
attribute_fields: AttributeFields { attribute_fields: AttributeFields {
@ -75,7 +75,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout
/// Return the address space size in bytes. /// Return the address space size in bytes.
pub const fn addr_space_size() -> usize { 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. /// Return a reference to the virtual memory layout.

@ -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 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 --- 12_exceptions_part1_groundwork/test-macros/src/lib.rs
+++ 13_integrated_testing/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 +// SPDX-License-Identifier: MIT OR Apache-2.0
+// +//
+// Copyright (c) 2019-2020 Andre Richter <andre.o.richter@gmail.com> +// Copyright (c) 2019-2020 Andre Richter <andre.o.richter@gmail.com>
+ +
+extern crate proc_macro;
+
+use proc_macro::TokenStream; +use proc_macro::TokenStream;
+use proc_macro2::Span; +use proc_macro2::Span;
+use quote::quote; +use quote::quote;

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

@ -4,7 +4,7 @@
//! BSP Memory Management Unit. //! BSP Memory Management Unit.
use super::super::memory; use super::map as memory_map;
use crate::memory::mmu::*; use crate::memory::mmu::*;
use core::ops::RangeInclusive; 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. /// 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. /// It is agnostic of the paging granularity that the architecture's MMU will use.
pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new( pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout::new(
memory::map::END_INCLUSIVE, memory_map::END_INCLUSIVE,
[ [
RangeDescriptor { RangeDescriptor {
name: "Kernel code and RO data", name: "Kernel code and RO data",
@ -57,7 +57,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout
RangeDescriptor { RangeDescriptor {
name: "Device MMIO", name: "Device MMIO",
virtual_range: || { 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, translation: Translation::Identity,
attribute_fields: AttributeFields { attribute_fields: AttributeFields {
@ -75,7 +75,7 @@ pub static LAYOUT: KernelVirtualLayout<{ NUM_MEM_RANGES }> = KernelVirtualLayout
/// Return the address space size in bytes. /// Return the address space size in bytes.
pub const fn addr_space_size() -> usize { 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. /// Return a reference to the virtual memory layout.

@ -4,8 +4,8 @@
//! BSP console facilities. //! BSP console facilities.
use super::{super::device_driver, memory::map}; use super::memory;
use crate::console; use crate::{bsp::device_driver, console};
use core::fmt; use core::fmt;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -19,7 +19,7 @@ use core::fmt;
/// ///
/// - Use only for printing during a panic. /// - Use only for printing during a panic.
pub unsafe fn panic_console_out() -> impl fmt::Write { 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.init();
uart uart
} }

Loading…
Cancel
Save