Fix explanation

pull/110/head
Andre Richter 3 years ago
parent 223989adb9
commit 5887503f8a
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -1018,16 +1018,15 @@ 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)]
@@ -132,9 +136,18 @@
@@ -132,9 +136,17 @@
/// # Safety
///
/// - Only a single core must be active and running this function.
-/// - The init calls in this function must appear in the correct order.
+/// - The init calls in this function must appear in the correct order:
+/// - Caching must be activated before the device drivers.
+/// - 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.
+/// - MMU + Data caching must be activated at the earliest. 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 (properly) on the RPi SoCs.
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;
+ use memory::mmu::interface::MMU;
@ -1038,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() {
@@ -158,6 +171,9 @@
@@ -158,6 +170,9 @@
info!("Booting on: {}", bsp::board_name());
@ -1048,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);
@@ -181,6 +197,13 @@
@@ -181,6 +196,13 @@
info!("Timer test, spinning for 1 second");
time::time_manager().spin_for(Duration::from_secs(1));

@ -137,10 +137,9 @@ mod time;
///
/// - Only a single core must be active and running this function.
/// - The init calls in this function must appear in the correct order:
/// - Caching must be activated before the device drivers.
/// - 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.
/// - MMU + Data caching must be activated at the earliest. 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 (properly) on the RPi SoCs.
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;
use memory::mmu::interface::MMU;

@ -953,7 +953,7 @@ diff -uNr 11_virtual_mem_part1_identity_mapping/src/main.rs 12_exceptions_part1_
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]
@@ -145,6 +146,8 @@
@@ -144,6 +145,8 @@
use driver::interface::DriverManager;
use memory::mmu::interface::MMU;
@ -962,7 +962,7 @@ diff -uNr 11_virtual_mem_part1_identity_mapping/src/main.rs 12_exceptions_part1_
if let Err(string) = memory::mmu::mmu().enable_mmu_and_caching() {
panic!("MMU: {}", string);
}
@@ -197,13 +200,28 @@
@@ -196,13 +199,28 @@
info!("Timer test, spinning for 1 second");
time::time_manager().spin_for(Duration::from_secs(1));

@ -138,10 +138,9 @@ mod time;
///
/// - Only a single core must be active and running this function.
/// - The init calls in this function must appear in the correct order:
/// - Caching must be activated before the device drivers.
/// - 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.
/// - MMU + Data caching must be activated at the earliest. 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 (properly) on the RPi SoCs.
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;
use memory::mmu::interface::MMU;

@ -1505,15 +1505,15 @@ diff -uNr 12_exceptions_part1_groundwork/src/main.rs 13_integrated_testing/src/m
/// Early init code.
///
@@ -142,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.
@@ -141,6 +22,7 @@
/// - MMU + Data caching must be activated at the earliest. 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 (properly) on the RPi SoCs.
+#[no_mangle]
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;
use memory::mmu::interface::MMU;
@@ -168,9 +50,7 @@
@@ -167,9 +49,7 @@
fn kernel_main() -> ! {
use bsp::console::console;
use console::interface::All;
@ -1523,7 +1523,7 @@ diff -uNr 12_exceptions_part1_groundwork/src/main.rs 13_integrated_testing/src/m
info!("Booting on: {}", bsp::board_name());
@@ -197,31 +77,6 @@
@@ -196,31 +76,6 @@
info!(" {}. {}", i + 1, driver.compatible());
}

@ -19,10 +19,9 @@ use libkernel::{bsp, console, driver, exception, info, memory, time};
///
/// - Only a single core must be active and running this function.
/// - The init calls in this function must appear in the correct order:
/// - Caching must be activated before the device drivers.
/// - 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.
/// - MMU + Data caching must be activated at the earliest. 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 (properly) on the RPi SoCs.
#[no_mangle]
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;

@ -857,6 +857,19 @@ diff -uNr 13_integrated_testing/src/_arch/aarch64/exception.rs 14_exceptions_par
#[no_mangle]
diff -uNr 13_integrated_testing/src/_arch/aarch64/memory/mmu.rs 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs
--- 13_integrated_testing/src/_arch/aarch64/memory/mmu.rs
+++ 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs
@@ -149,7 +149,7 @@
barrier::isb(barrier::SY);
// Enable the MMU and turn on data and instruction caching.
- SCTLR_EL1.modify(SCTLR_EL1::M::Enable + SCTLR_EL1::C::Cacheable + SCTLR_EL1::I::Cacheable);
+ SCTLR_EL1.modify(SCTLR_EL1::M::Enable);
// Force MMU init to complete before next instruction.
barrier::isb(barrier::SY);
diff -uNr 13_integrated_testing/src/bsp/device_driver/arm/gicv2/gicc.rs 14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs
--- 13_integrated_testing/src/bsp/device_driver/arm/gicv2/gicc.rs
+++ 14_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2/gicc.rs
@ -2325,18 +2338,16 @@ diff -uNr 13_integrated_testing/src/main.rs 14_exceptions_part2_peripheral_IRQs/
/// Early init code.
///
@@ -21,8 +21,8 @@
@@ -21,7 +21,7 @@
/// - The init calls in this function must appear in the correct order:
/// - Caching must be activated before the device drivers.
/// - 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.
+/// drivers (which currently employ IRQSafeNullLocks instead of spinlocks), will fail to
+/// work on the RPi SoCs.
/// - MMU + Data caching must be activated at the earliest. 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 (properly) on the RPi SoCs.
+/// IRQSafeNullLocks instead of spinlocks), will fail to work (properly) on the RPi SoCs.
#[no_mangle]
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;
@@ -42,15 +42,27 @@
@@ -41,15 +41,27 @@
bsp::driver::driver_manager().post_device_driver_init();
// println! is usable from here on.
@ -2366,7 +2377,7 @@ diff -uNr 13_integrated_testing/src/main.rs 14_exceptions_part2_peripheral_IRQs/
info!("Booting on: {}", bsp::board_name());
@@ -77,12 +89,9 @@
@@ -76,12 +88,9 @@
info!(" {}. {}", i + 1, driver.compatible());
}

@ -149,7 +149,7 @@ impl memory::mmu::interface::MMU for MemoryManagementUnit {
barrier::isb(barrier::SY);
// Enable the MMU and turn on data and instruction caching.
SCTLR_EL1.modify(SCTLR_EL1::M::Enable + SCTLR_EL1::C::Cacheable + SCTLR_EL1::I::Cacheable);
SCTLR_EL1.modify(SCTLR_EL1::M::Enable);
// Force MMU init to complete before next instruction.
barrier::isb(barrier::SY);

@ -19,10 +19,9 @@ use libkernel::{bsp, cpu, driver, exception, info, memory, state, time, warn};
///
/// - Only a single core must be active and running this function.
/// - The init calls in this function must appear in the correct order:
/// - Caching must be activated before the device drivers.
/// - Without it, any atomic operations, e.g. the yet-to-be-introduced spinlocks in the device
/// drivers (which currently employ IRQSafeNullLocks instead of spinlocks), will fail to
/// work on the RPi SoCs.
/// - MMU + Data caching must be activated at the earliest. Without it, any atomic operations,
/// e.g. the yet-to-be-introduced spinlocks in the device drivers (which currently employ
/// IRQSafeNullLocks instead of spinlocks), will fail to work (properly) on the RPi SoCs.
#[no_mangle]
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;

@ -805,6 +805,15 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
self.configure_translation_control();
@@ -149,7 +140,7 @@
barrier::isb(barrier::SY);
// Enable the MMU and turn on data and instruction caching.
- SCTLR_EL1.modify(SCTLR_EL1::M::Enable);
+ SCTLR_EL1.modify(SCTLR_EL1::M::Enable + SCTLR_EL1::C::Cacheable + SCTLR_EL1::I::Cacheable);
// Force MMU init to complete before next instruction.
barrier::isb(barrier::SY);
@@ -162,22 +153,3 @@
SCTLR_EL1.matches_all(SCTLR_EL1::M::Enable)
}
@ -1800,7 +1809,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/bsp/raspberrypi/memory.rs 15_v
+//! | .got |
+//! | | rx_end_inclusive
+//! +---------------------------------------------+
+//! | | rw_start == ro_end
+//! | | rw_start == rx_end
+//! | .data |
+//! | .bss |
+//! | | rw_end_inclusive
@ -2150,7 +2159,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/lib.rs 15_virtual_mem_part2_mm
diff -uNr 14_exceptions_part2_peripheral_IRQs/src/main.rs 15_virtual_mem_part2_mmio_remap/src/main.rs
--- 14_exceptions_part2_peripheral_IRQs/src/main.rs
+++ 15_virtual_mem_part2_mmio_remap/src/main.rs
@@ -26,21 +26,39 @@
@@ -25,21 +25,39 @@
#[no_mangle]
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;
@ -2196,7 +2205,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/main.rs 15_virtual_mem_part2_m
// Let device drivers register and enable their handlers with the interrupt controller.
for i in bsp::driver::driver_manager().all_device_drivers() {
@@ -66,8 +84,8 @@
@@ -65,8 +83,8 @@
info!("Booting on: {}", bsp::board_name());

@ -19,10 +19,9 @@ use libkernel::{bsp, cpu, driver, exception, info, memory, state, time, warn};
///
/// - Only a single core must be active and running this function.
/// - The init calls in this function must appear in the correct order:
/// - Caching must be activated before the device drivers.
/// - Without it, any atomic operations, e.g. the yet-to-be-introduced spinlocks in the device
/// drivers (which currently employ IRQSafeNullLocks instead of spinlocks), will fail to
/// work on the RPi SoCs.
/// - MMU + Data caching must be activated at the earliest. Without it, any atomic operations,
/// e.g. the yet-to-be-introduced spinlocks in the device drivers (which currently employ
/// IRQSafeNullLocks instead of spinlocks), will fail to work (properly) on the RPi SoCs.
#[no_mangle]
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;

Loading…
Cancel
Save