Bump toolchain

pull/143/head
Andre Richter 2 years ago
parent ea8ef5a7f1
commit 7d02537515
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -12,4 +12,4 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));

@ -103,8 +103,6 @@
//! 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`.
#![feature(asm)]
#![feature(global_asm)]
#![no_main]
#![no_std]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -24,5 +24,4 @@ path = "src/main.rs"
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -40,15 +40,14 @@ diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml
authors = ["Andre Richter <andre.o.richter@gmail.com>"]
edition = "2021"
@@ -21,3 +21,8 @@
@@ -21,3 +21,7 @@
##--------------------------------------------------------------------------------------------------
[dependencies]
+
+# Platform specific dependencies
+[target.'cfg(target_arch = "aarch64")'.dependencies]
+cortex-a = { version = "6.x.x" }
+
+cortex-a = { version = "7.x.x" }
diff -uNr 01_wait_forever/Makefile 02_runtime_init/Makefile
--- 01_wait_forever/Makefile
@ -69,7 +68,7 @@ diff -uNr 01_wait_forever/src/_arch/aarch64/cpu/boot.rs 02_runtime_init/src/_arc
@@ -13,3 +13,15 @@
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
+
+//--------------------------------------------------------------------------------------------------
+// Public Code
@ -303,17 +302,15 @@ 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,8 +102,8 @@
@@ -102,6 +102,7 @@
//!
//! 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 `kernel_init()`.
-#![feature(asm)]
#![feature(global_asm)]
#![no_main]
#![no_std]
@@ -112,4 +112,11 @@
@@ -110,4 +111,11 @@
mod cpu;
mod panic_wait;

@ -12,7 +12,7 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
// Public Code

@ -104,7 +104,6 @@
//! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`.
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
#![feature(global_asm)]
#![no_main]
#![no_std]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -24,5 +24,4 @@ path = "src/main.rs"
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -208,12 +208,11 @@ 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
@@ -104,13 +104,17 @@
@@ -104,12 +104,16 @@
//! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`.
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
+#![feature(format_args_nl)]
#![feature(global_asm)]
+#![feature(panic_info_message)]
#![no_main]
#![no_std]
@ -226,7 +225,7 @@ diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs
/// Early init code.
///
@@ -118,5 +122,7 @@
@@ -117,5 +121,7 @@
///
/// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! {

@ -12,7 +12,7 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
// Public Code

@ -105,7 +105,6 @@
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![no_main]
#![no_std]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -24,5 +24,4 @@ path = "src/main.rs"
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -224,15 +224,15 @@ diff -uNr 03_hacky_hello_world/src/console.rs 04_safe_globals/src/console.rs
diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs
--- 03_hacky_hello_world/src/main.rs
+++ 04_safe_globals/src/main.rs
@@ -107,6 +107,7 @@
@@ -106,6 +106,7 @@
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
+#![feature(trait_alias)]
#![no_main]
#![no_std]
@@ -115,6 +116,7 @@
@@ -114,6 +115,7 @@
mod cpu;
mod panic_wait;
mod print;
@ -240,7 +240,7 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs
/// Early init code.
///
@@ -122,7 +124,15 @@
@@ -121,7 +123,15 @@
///
/// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! {

@ -12,7 +12,7 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
// Public Code

@ -105,7 +105,6 @@
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -140,7 +140,7 @@ diff -uNr 04_safe_globals/Cargo.toml 05_drivers_gpio_uart/Cargo.toml
+
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }
diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile
--- 04_safe_globals/Makefile
@ -1340,9 +1340,9 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs
+#![allow(clippy::upper_case_acronyms)]
+#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
@@ -114,6 +116,7 @@
#![feature(trait_alias)]
@@ -113,6 +115,7 @@
mod bsp;
mod console;
mod cpu;
@ -1350,7 +1350,7 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs
mod panic_wait;
mod print;
mod synchronization;
@@ -123,16 +126,54 @@
@@ -122,16 +125,54 @@
/// # Safety
///
/// - Only a single core must be active and running this function.

@ -12,7 +12,7 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
// Public Code

@ -107,7 +107,6 @@
#![allow(clippy::upper_case_acronyms)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -456,15 +456,7 @@ diff -uNr 05_drivers_gpio_uart/src/bsp/raspberrypi/memory.rs 06_uart_chainloader
diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs
--- 05_drivers_gpio_uart/src/main.rs
+++ 06_uart_chainloader/src/main.rs
@@ -105,6 +105,7 @@
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
#![allow(clippy::upper_case_acronyms)]
+#![feature(asm)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
@@ -142,38 +143,56 @@
@@ -141,38 +141,56 @@
kernel_main()
}
@ -480,7 +472,7 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs
use bsp::console::console;
use console::interface::All;
- use driver::interface::DriverManager;
-
- println!(
- "[0] {} version {}",
- env!("CARGO_PKG_NAME"),
@ -495,37 +487,36 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs
- .enumerate()
- {
- println!(" {}. {}", i + 1, driver.compatible());
- }
- println!(
- "[3] Chars written: {}",
- bsp::console::console().chars_written()
- );
- println!("[4] Echoing input now");
+ println!("{}", MINILOAD_LOGO);
+ println!("{:^37}", bsp::board_name());
+ println!();
+ println!("[ML] Requesting binary");
+ console().flush();
- // Discard any spurious received characters before going into echo mode.
+
+ // Discard any spurious received characters before starting with the loader protocol.
console().clear_rx();
- loop {
- let c = bsp::console::console().read_char();
- bsp::console::console().write_char(c);
+ console().clear_rx();
+
+ // Notify `Minipush` to send the binary.
+ for _ in 0..3 {
+ console().write_char(3 as char);
}
+
- println!(
- "[3] Chars written: {}",
- bsp::console::console().chars_written()
- );
- println!("[4] Echoing input now");
+ // Read the binary's size.
+ let mut size: u32 = u32::from(console().read_char() as u8);
+ size |= u32::from(console().read_char() as u8) << 8;
+ size |= u32::from(console().read_char() as u8) << 16;
+ size |= u32::from(console().read_char() as u8) << 24;
+
- // Discard any spurious received characters before going into echo mode.
- console().clear_rx();
- loop {
- let c = bsp::console::console().read_char();
- bsp::console::console().write_char(c);
+ // Trust it's not too big.
+ console().write_char('O');
+ console().write_char('K');
@ -536,7 +527,7 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs
+ for i in 0..size {
+ core::ptr::write_volatile(kernel_addr.offset(i as isize), console().read_char() as u8)
+ }
+ }
}
+
+ println!("[ML] Loaded! Executing the payload now\n");
+ console().flush();

@ -12,7 +12,7 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
// Public Code

@ -105,10 +105,8 @@
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
#![allow(clippy::upper_case_acronyms)]
#![feature(asm)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -536,15 +536,7 @@ diff -uNr 06_uart_chainloader/src/cpu.rs 07_timestamps/src/cpu.rs
diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs
--- 06_uart_chainloader/src/main.rs
+++ 07_timestamps/src/main.rs
@@ -105,7 +105,6 @@
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
#![allow(clippy::upper_case_acronyms)]
-#![feature(asm)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
@@ -121,6 +120,7 @@
@@ -119,6 +119,7 @@
mod panic_wait;
mod print;
mod synchronization;
@ -552,7 +544,7 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs
/// Early init code.
///
@@ -143,56 +143,38 @@
@@ -141,56 +142,38 @@
kernel_main()
}

@ -12,7 +12,7 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
// Public Code

@ -107,7 +107,6 @@
#![allow(clippy::upper_case_acronyms)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -12,7 +12,7 @@
//! crate::cpu::boot::arch_boot
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
core::arch::global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
// Public Code

@ -107,7 +107,6 @@
#![allow(clippy::upper_case_acronyms)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -211,17 +211,19 @@ diff -uNr 08_hw_debug_JTAG/Cargo.toml 09_privilege_level/Cargo.toml
diff -uNr 08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs 09_privilege_level/src/_arch/aarch64/cpu/boot.rs
--- 08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs
+++ 09_privilege_level/src/_arch/aarch64/cpu/boot.rs
@@ -11,17 +11,68 @@
@@ -11,8 +11,53 @@
//!
//! crate::cpu::boot::arch_boot
+use core::arch::global_asm;
+use cortex_a::{asm, registers::*};
+use tock_registers::interfaces::Writeable;
+
// Assembly counterpart to this file.
global_asm!(include_str!("boot.s"));
//--------------------------------------------------------------------------------------------------
-core::arch::global_asm!(include_str!("boot.s"));
+global_asm!(include_str!("boot.s"));
+
+//--------------------------------------------------------------------------------------------------
+// Private Code
+//--------------------------------------------------------------------------------------------------
+
@ -261,11 +263,10 @@ diff -uNr 08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs 09_privilege_level/src/
+ // are no plans to ever return to EL2, just re-use the same stack.
+ SP_EL1.set(phys_boot_core_stack_end_exclusive_addr);
+}
+
+//--------------------------------------------------------------------------------------------------
// Public Code
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Public Code
@@ -21,7 +66,14 @@
/// The Rust entry of the `kernel` binary.
///
/// The function is called from the assembly `_start` function.
@ -501,7 +502,7 @@ diff -uNr 08_hw_debug_JTAG/src/exception.rs 09_privilege_level/src/exception.rs
diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs
--- 08_hw_debug_JTAG/src/main.rs
+++ 09_privilege_level/src/main.rs
@@ -117,6 +117,7 @@
@@ -116,6 +116,7 @@
mod console;
mod cpu;
mod driver;
@ -509,7 +510,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs
mod panic_wait;
mod print;
mod synchronization;
@@ -145,6 +146,8 @@
@@ -144,6 +145,8 @@
/// The main function running after the early init.
fn kernel_main() -> ! {
@ -518,7 +519,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs
use core::time::Duration;
use driver::interface::DriverManager;
use time::interface::TimeManager;
@@ -156,6 +159,12 @@
@@ -155,6 +158,12 @@
);
info!("Booting on: {}", bsp::board_name());
@ -531,7 +532,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs
info!(
"Architectural timer resolution: {} ns",
time::time_manager().resolution().as_nanos()
@@ -170,11 +179,15 @@
@@ -169,11 +178,15 @@
info!(" {}. {}", i + 1, driver.compatible());
}

@ -11,6 +11,7 @@
//!
//! crate::cpu::boot::arch_boot
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -107,7 +107,6 @@
#![allow(clippy::upper_case_acronyms)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -1089,9 +1089,9 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s
#![feature(const_fn_fn_ptr_basics)]
+#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
@@ -118,6 +120,7 @@
#![feature(trait_alias)]
@@ -117,6 +119,7 @@
mod cpu;
mod driver;
mod exception;
@ -1099,7 +1099,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s
mod panic_wait;
mod print;
mod synchronization;
@@ -128,9 +131,17 @@
@@ -127,9 +130,17 @@
/// # Safety
///
/// - Only a single core must be active and running this function.
@ -1118,7 +1118,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s
for i in bsp::driver::driver_manager().all_device_drivers().iter() {
if let Err(x) = i.init() {
@@ -159,6 +170,9 @@
@@ -158,6 +169,9 @@
);
info!("Booting on: {}", bsp::board_name());
@ -1128,7 +1128,7 @@ diff -uNr 09_privilege_level/src/main.rs 10_virtual_mem_part1_identity_mapping/s
let (_, privilege_level) = exception::current_privilege_level();
info!("Current privilege level: {}", privilege_level);
@@ -182,6 +196,13 @@
@@ -181,6 +195,13 @@
info!("Timer test, spinning for 1 second");
time::time_manager().spin_for(Duration::from_secs(1));

@ -11,6 +11,7 @@
//!
//! crate::cpu::boot::arch_boot
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -109,7 +109,6 @@
#![feature(const_fn_fn_ptr_basics)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

@ -502,7 +502,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs 1
-use cortex_a::registers::*;
-use tock_registers::interfaces::Readable;
+use core::{cell::UnsafeCell, fmt};
+use core::{arch::global_asm, cell::UnsafeCell, fmt};
+use cortex_a::{asm::barrier, registers::*};
+use tock_registers::{
+ interfaces::{Readable, Writeable},
@ -1013,7 +1013,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/exception.rs 11_exceptions_p
diff -uNr 10_virtual_mem_part1_identity_mapping/src/main.rs 11_exceptions_part1_groundwork/src/main.rs
--- 10_virtual_mem_part1_identity_mapping/src/main.rs
+++ 11_exceptions_part1_groundwork/src/main.rs
@@ -139,6 +139,8 @@
@@ -138,6 +138,8 @@
use driver::interface::DriverManager;
use memory::mmu::interface::MMU;
@ -1022,7 +1022,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/main.rs 11_exceptions_part1_
if let Err(string) = memory::mmu::mmu().enable_mmu_and_caching() {
panic!("MMU: {}", string);
}
@@ -196,13 +198,28 @@
@@ -195,13 +197,28 @@
info!("Timer test, spinning for 1 second");
time::time_manager().spin_for(Duration::from_secs(1));

@ -11,6 +11,7 @@
//!
//! crate::cpu::boot::arch_boot
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -11,7 +11,7 @@
//!
//! crate::exception::arch_exception
use core::{cell::UnsafeCell, fmt};
use core::{arch::global_asm, cell::UnsafeCell, fmt};
use cortex_a::{asm::barrier, registers::*};
use tock_registers::{
interfaces::{Readable, Writeable},

@ -109,7 +109,6 @@
#![feature(const_fn_fn_ptr_basics)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![no_main]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]
@ -33,9 +33,9 @@ dependencies = [
[[package]]
name = "qemu-exit"
version = "2.0.1"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389"
checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543"
[[package]]
name = "quote"

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true }
qemu-exit = { version = "2.x.x", optional = true }
qemu-exit = { version = "3.x.x", optional = true }
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }
##--------------------------------------------------------------------------------------------------
## Testing

@ -883,7 +883,7 @@ diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo.
authors = ["Andre Richter <andre.o.richter@gmail.com>"]
edition = "2021"
@@ -11,21 +11,46 @@
@@ -11,20 +11,46 @@
default = []
bsp_rpi3 = ["tock-registers"]
bsp_rpi4 = ["tock-registers"]
@ -902,12 +902,12 @@ diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo.
# Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true }
+qemu-exit = { version = "2.x.x", optional = true }
+qemu-exit = { version = "3.x.x", optional = true }
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }
+
+##--------------------------------------------------------------------------------------------------
+## Testing
+##--------------------------------------------------------------------------------------------------
@ -1274,7 +1274,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/exception.rs 12_integrated_testing/
diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/lib.rs
--- 11_exceptions_part1_groundwork/src/lib.rs
+++ 12_integrated_testing/src/lib.rs
@@ -0,0 +1,185 @@
@@ -0,0 +1,184 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0
+//
+// Copyright (c) 2018-2021 Andre Richter <andre.o.richter@gmail.com>
@ -1388,7 +1388,6 @@ diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/li
+#![feature(const_fn_fn_ptr_basics)]
+#![feature(core_intrinsics)]
+#![feature(format_args_nl)]
+#![feature(global_asm)]
+#![feature(linkage)]
+#![feature(panic_info_message)]
+#![feature(trait_alias)]
@ -1464,7 +1463,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/li
diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/main.rs
--- 11_exceptions_part1_groundwork/src/main.rs
+++ 12_integrated_testing/src/main.rs
@@ -6,125 +6,12 @@
@@ -6,124 +6,12 @@
#![doc(html_logo_url = "https://git.io/JeGIp")]
//! The `kernel` binary.
@ -1572,7 +1571,6 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m
-#![feature(core_intrinsics)]
+
#![feature(format_args_nl)]
-#![feature(global_asm)]
-#![feature(panic_info_message)]
-#![feature(trait_alias)]
#![no_main]
@ -1592,7 +1590,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m
/// Early init code.
///
@@ -135,6 +22,7 @@
@@ -134,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.
@ -1600,7 +1598,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m
unsafe fn kernel_init() -> ! {
use driver::interface::DriverManager;
use memory::mmu::interface::MMU;
@@ -161,15 +49,9 @@
@@ -160,15 +49,9 @@
fn kernel_main() -> ! {
use bsp::console::console;
use console::interface::All;
@ -1617,7 +1615,7 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m
info!("Booting on: {}", bsp::board_name());
info!("MMU online. Special regions:");
@@ -195,31 +77,6 @@
@@ -194,31 +77,6 @@
info!(" {}. {}", i + 1, driver.compatible());
}

@ -11,6 +11,7 @@
//!
//! crate::cpu::boot::arch_boot
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -11,7 +11,7 @@
//!
//! crate::exception::arch_exception
use core::{cell::UnsafeCell, fmt};
use core::{arch::global_asm, cell::UnsafeCell, fmt};
use cortex_a::{asm::barrier, registers::*};
use tock_registers::{
interfaces::{Readable, Writeable},

@ -111,7 +111,6 @@
#![feature(const_fn_fn_ptr_basics)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(linkage)]
#![feature(panic_info_message)]
#![feature(trait_alias)]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]
@ -33,9 +33,9 @@ dependencies = [
[[package]]
name = "qemu-exit"
version = "2.0.1"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389"
checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543"
[[package]]
name = "quote"

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true }
qemu-exit = { version = "2.x.x", optional = true }
qemu-exit = { version = "3.x.x", optional = true }
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }
##--------------------------------------------------------------------------------------------------
## Testing

@ -809,9 +809,11 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/cpu/smp.rs 13_exceptions_part2
diff -uNr 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs
--- 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs
+++ 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception/asynchronous.rs
@@ -12,12 +12,16 @@
@@ -11,13 +11,18 @@
//!
//! crate::exception::asynchronous::arch_asynchronous
+use core::arch::asm;
use cortex_a::registers::*;
-use tock_registers::interfaces::Readable;
+use tock_registers::interfaces::{Readable, Writeable};
@ -827,7 +829,7 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs 13_e
trait DaifField {
fn daif_field() -> tock_registers::fields::Field<u64, DAIF::Register>;
}
@@ -66,6 +70,71 @@
@@ -66,6 +71,71 @@
// Public Code
//--------------------------------------------------------------------------------------------------
@ -908,7 +910,7 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/exception.rs 13_exceptions_par
//! crate::exception::arch_exception
+use crate::{bsp, exception};
use core::{cell::UnsafeCell, fmt};
use core::{arch::global_asm, cell::UnsafeCell, fmt};
use cortex_a::{asm::barrier, registers::*};
use tock_registers::{
@@ -91,8 +92,11 @@
@ -2413,13 +2415,13 @@ diff -uNr 12_integrated_testing/src/lib.rs 13_exceptions_part2_peripheral_IRQs/s
#![allow(clippy::upper_case_acronyms)]
#![allow(incomplete_features)]
+#![feature(asm)]
+#![feature(asm_const)]
#![feature(const_fn_fn_ptr_basics)]
+#![feature(const_fn_trait_bound)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
@@ -132,6 +134,7 @@
#![feature(linkage)]
@@ -131,6 +133,7 @@
pub mod exception;
pub mod memory;
pub mod print;

@ -11,6 +11,7 @@
//!
//! crate::cpu::boot::arch_boot
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -12,7 +12,7 @@
//! crate::exception::arch_exception
use crate::{bsp, exception};
use core::{cell::UnsafeCell, fmt};
use core::{arch::global_asm, cell::UnsafeCell, fmt};
use cortex_a::{asm::barrier, registers::*};
use tock_registers::{
interfaces::{Readable, Writeable},

@ -11,6 +11,7 @@
//!
//! crate::exception::asynchronous::arch_asynchronous
use core::arch::asm;
use cortex_a::registers::*;
use tock_registers::interfaces::{Readable, Writeable};

@ -108,12 +108,11 @@
#![allow(clippy::upper_case_acronyms)]
#![allow(incomplete_features)]
#![feature(asm)]
#![feature(asm_const)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(linkage)]
#![feature(panic_info_message)]
#![feature(trait_alias)]

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]
@ -33,9 +33,9 @@ dependencies = [
[[package]]
name = "qemu-exit"
version = "2.0.1"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389"
checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543"
[[package]]
name = "quote"

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true }
qemu-exit = { version = "2.x.x", optional = true }
qemu-exit = { version = "3.x.x", optional = true }
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }
##--------------------------------------------------------------------------------------------------
## Testing

@ -1021,16 +1021,14 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/bsp/device_driver/arm/gicv2.rs
handler_table: InitStateLock::new([None; Self::NUM_IRQS]),
}
}
@@ -139,6 +152,22 @@
@@ -139,6 +152,20 @@
}
unsafe fn init(&self) -> Result<(), &'static str> {
+ let remapped = self.is_mmio_remapped.load(Ordering::Relaxed);
+ if !remapped {
+ let mut virt_addr;
+
+ // GICD
+ virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
+ let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
+ self.gicd.set_mmio(virt_addr.as_usize());
+
+ // GICC
@ -2137,19 +2135,18 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/driver.rs 14_virtual_mem_part2
diff -uNr 13_exceptions_part2_peripheral_IRQs/src/lib.rs 14_virtual_mem_part2_mmio_remap/src/lib.rs
--- 13_exceptions_part2_peripheral_IRQs/src/lib.rs
+++ 14_virtual_mem_part2_mmio_remap/src/lib.rs
@@ -113,9 +113,11 @@
@@ -113,8 +113,10 @@
#![feature(const_fn_trait_bound)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
+#![feature(generic_const_exprs)]
#![feature(global_asm)]
#![feature(linkage)]
#![feature(panic_info_message)]
+#![feature(step_trait)]
#![feature(trait_alias)]
#![no_std]
// Testing
@@ -128,6 +130,7 @@
@@ -127,6 +129,7 @@
mod synchronization;
pub mod bsp;
@ -2157,7 +2154,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/lib.rs 14_virtual_mem_part2_mm
pub mod console;
pub mod cpu;
pub mod driver;
@@ -180,6 +183,7 @@
@@ -179,6 +182,7 @@
#[no_mangle]
unsafe fn kernel_init() -> ! {
exception::handling_init();
@ -3430,7 +3427,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory/mmu.rs 14_virtual_mem_p
diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2_mmio_remap/src/memory.rs
--- 13_exceptions_part2_peripheral_IRQs/src/memory.rs
+++ 14_virtual_mem_part2_mmio_remap/src/memory.rs
@@ -5,3 +5,161 @@
@@ -5,3 +5,163 @@
//! Memory Management.
pub mod mmu;
@ -3486,6 +3483,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2
+ }
+
+ /// Align down to page size.
+ #[must_use]
+ pub const fn align_down_page(self) -> Self {
+ let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE);
+
@ -3493,6 +3491,7 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/memory.rs 14_virtual_mem_part2
+ }
+
+ /// Align up to page size.
+ #[must_use]
+ pub const fn align_up_page(self) -> Self {
+ let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE);
+

@ -11,6 +11,7 @@
//!
//! crate::cpu::boot::arch_boot
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -12,7 +12,7 @@
//! crate::exception::arch_exception
use crate::{bsp, exception};
use core::{cell::UnsafeCell, fmt};
use core::{arch::global_asm, cell::UnsafeCell, fmt};
use cortex_a::{asm::barrier, registers::*};
use tock_registers::{
interfaces::{Readable, Writeable},

@ -11,6 +11,7 @@
//!
//! crate::exception::asynchronous::arch_asynchronous
use core::arch::asm;
use cortex_a::registers::*;
use tock_registers::interfaces::{Readable, Writeable};

@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 {
unsafe fn init(&self) -> Result<(), &'static str> {
let remapped = self.is_mmio_remapped.load(Ordering::Relaxed);
if !remapped {
let mut virt_addr;
// GICD
virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
self.gicd.set_mmio(virt_addr.as_usize());
// GICC

@ -108,13 +108,12 @@
#![allow(clippy::upper_case_acronyms)]
#![allow(incomplete_features)]
#![feature(asm)]
#![feature(asm_const)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(generic_const_exprs)]
#![feature(global_asm)]
#![feature(linkage)]
#![feature(panic_info_message)]
#![feature(step_trait)]

@ -57,6 +57,7 @@ impl<ATYPE: AddressType> Address<ATYPE> {
}
/// Align down to page size.
#[must_use]
pub const fn align_down_page(self) -> Self {
let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE);
@ -64,6 +65,7 @@ impl<ATYPE: AddressType> Address<ATYPE> {
}
/// Align up to page size.
#[must_use]
pub const fn align_up_page(self) -> Self {
let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE);

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]
@ -33,9 +33,9 @@ dependencies = [
[[package]]
name = "qemu-exit"
version = "2.0.1"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389"
checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543"
[[package]]
name = "quote"

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true }
qemu-exit = { version = "2.x.x", optional = true }
qemu-exit = { version = "3.x.x", optional = true }
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }
##--------------------------------------------------------------------------------------------------
## Testing

@ -821,10 +821,10 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/cpu/boot.rs 15_virtu
//! crate::cpu::boot::arch_boot
+use crate::{memory, memory::Address};
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;
@@ -70,9 +71,16 @@
@@ -71,9 +72,16 @@
///
/// - Exception return from EL2 must must continue execution in EL1 with `kernel_init()`.
#[no_mangle]
@ -1167,7 +1167,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v
//--------------------------------------------------------------------------------------------------
// Global instances
@@ -43,13 +43,34 @@
@@ -43,13 +43,35 @@
///
/// That is, `size_of(InitStateLock<KernelTranslationTable>) == size_of(KernelTranslationTable)`.
/// There is a unit tests that checks this porperty.
@ -1192,6 +1192,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v
+/// This is a hack for retrieving the value for the kernel's virtual address space size as a
+/// constant from a common place, since it is needed as a compile-time/link-time constant in both,
+/// the linker script and the Rust sources.
+#[allow(clippy::needless_late_init)]
+const fn kernel_virt_addr_space_size() -> usize {
+ let __kernel_virt_addr_space_size;
+
@ -1203,7 +1204,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v
/// Helper function for calculating the number of pages the given parameter spans.
const fn size_to_num_pages(size: usize) -> usize {
assert!(size > 0);
@@ -88,18 +109,22 @@
@@ -88,18 +110,22 @@
MemoryRegion::new(start_page_addr, end_exclusive_page_addr)
}
@ -1237,7 +1238,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v
}
//--------------------------------------------------------------------------------------------------
@@ -121,109 +146,33 @@
@@ -121,109 +147,33 @@
MemoryRegion::new(start_page_addr, end_exclusive_page_addr)
}

@ -12,6 +12,7 @@
//! crate::cpu::boot::arch_boot
use crate::{memory, memory::Address};
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -12,7 +12,7 @@
//! crate::exception::arch_exception
use crate::{bsp, exception};
use core::{cell::UnsafeCell, fmt};
use core::{arch::global_asm, cell::UnsafeCell, fmt};
use cortex_a::{asm::barrier, registers::*};
use tock_registers::{
interfaces::{Readable, Writeable},

@ -11,6 +11,7 @@
//!
//! crate::exception::asynchronous::arch_asynchronous
use core::arch::asm;
use cortex_a::registers::*;
use tock_registers::interfaces::{Readable, Writeable};

@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 {
unsafe fn init(&self) -> Result<(), &'static str> {
let remapped = self.is_mmio_remapped.load(Ordering::Relaxed);
if !remapped {
let mut virt_addr;
// GICD
virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
self.gicd.set_mmio(virt_addr.as_usize());
// GICC

@ -63,6 +63,7 @@ static PHYS_KERNEL_TABLES_BASE_ADDR: u64 = 0xCCCCAAAAFFFFEEEE;
/// This is a hack for retrieving the value for the kernel's virtual address space size as a
/// constant from a common place, since it is needed as a compile-time/link-time constant in both,
/// the linker script and the Rust sources.
#[allow(clippy::needless_late_init)]
const fn kernel_virt_addr_space_size() -> usize {
let __kernel_virt_addr_space_size;

@ -108,13 +108,12 @@
#![allow(clippy::upper_case_acronyms)]
#![allow(incomplete_features)]
#![feature(asm)]
#![feature(asm_const)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(generic_const_exprs)]
#![feature(global_asm)]
#![feature(linkage)]
#![feature(panic_info_message)]
#![feature(step_trait)]

@ -57,6 +57,7 @@ impl<ATYPE: AddressType> Address<ATYPE> {
}
/// Align down to page size.
#[must_use]
pub const fn align_down_page(self) -> Self {
let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE);
@ -64,6 +65,7 @@ impl<ATYPE: AddressType> Address<ATYPE> {
}
/// Align up to page size.
#[must_use]
pub const fn align_up_page(self) -> Self {
let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE);

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]
@ -33,9 +33,9 @@ dependencies = [
[[package]]
name = "qemu-exit"
version = "2.0.1"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "220eb94f40665452ab6114bf8a8d86aa1fd41c6dbfaa4ab71b5912c8adb80389"
checksum = "0e0fa04276d522a40ed717bf874183a3b2a8bbb3fb4c646b03a7eb874ce5d543"
[[package]]
name = "quote"

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true }
qemu-exit = { version = "2.x.x", optional = true }
qemu-exit = { version = "3.x.x", optional = true }
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }
##--------------------------------------------------------------------------------------------------
## Testing

@ -340,7 +340,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/Cargo.toml 16_virtual_mem_part
diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs
--- 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs
+++ 16_virtual_mem_part4_higher_half_kernel/src/_arch/aarch64/cpu/boot.rs
@@ -29,7 +29,10 @@
@@ -30,7 +30,10 @@
/// - The `bss` section is not initialized yet. The code must not use or reference it in any way.
/// - The HW state of EL1 must be prepared in a sound way.
#[inline(always)]
@ -352,7 +352,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs
// Enable timer counter registers for EL1.
CNTHCTL_EL2.write(CNTHCTL_EL2::EL1PCEN::SET + CNTHCTL_EL2::EL1PCTEN::SET);
@@ -52,11 +55,11 @@
@@ -53,11 +56,11 @@
);
// Second, let the link register point to kernel_init().
@ -366,7 +366,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/_arch/aarch64/cpu/boot.rs
}
//--------------------------------------------------------------------------------------------------
@@ -73,14 +76,19 @@
@@ -74,14 +77,19 @@
#[no_mangle]
pub unsafe extern "C" fn _start_rust(
phys_kernel_tables_base_addr: u64,
@ -731,7 +731,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu
//--------------------------------------------------------------------------------------------------
// Public Definitions
@@ -152,14 +152,6 @@
@@ -153,14 +153,6 @@
/// `translation table tool` and patched into the kernel binary. This function just adds the mapping
/// record entries.
pub fn kernel_add_mapping_records_for_precomputed() {
@ -746,7 +746,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory/mmu
let virt_code_region = virt_code_region();
generic_mmu::kernel_add_mapping_record(
"Kernel code and RO data",
@@ -175,4 +167,12 @@
@@ -176,4 +168,12 @@
&kernel_virt_to_phys_region(virt_data_region),
&kernel_page_attributes(virt_data_region.start_page_addr()),
);
@ -799,7 +799,7 @@ diff -uNr 15_virtual_mem_part3_precomputed_tables/src/bsp/raspberrypi/memory.rs
diff -uNr 15_virtual_mem_part3_precomputed_tables/src/lib.rs 16_virtual_mem_part4_higher_half_kernel/src/lib.rs
--- 15_virtual_mem_part3_precomputed_tables/src/lib.rs
+++ 16_virtual_mem_part4_higher_half_kernel/src/lib.rs
@@ -153,11 +153,6 @@
@@ -152,11 +152,6 @@
)
}

@ -12,6 +12,7 @@
//! crate::cpu::boot::arch_boot
use crate::{memory, memory::Address};
use core::arch::global_asm;
use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable;

@ -12,7 +12,7 @@
//! crate::exception::arch_exception
use crate::{bsp, exception};
use core::{cell::UnsafeCell, fmt};
use core::{arch::global_asm, cell::UnsafeCell, fmt};
use cortex_a::{asm::barrier, registers::*};
use tock_registers::{
interfaces::{Readable, Writeable},

@ -11,6 +11,7 @@
//!
//! crate::exception::asynchronous::arch_asynchronous
use core::arch::asm;
use cortex_a::registers::*;
use tock_registers::interfaces::{Readable, Writeable};

@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 {
unsafe fn init(&self) -> Result<(), &'static str> {
let remapped = self.is_mmio_remapped.load(Ordering::Relaxed);
if !remapped {
let mut virt_addr;
// GICD
virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
let mut virt_addr = memory::mmu::kernel_map_mmio("GICD", &self.gicd_mmio_descriptor)?;
self.gicd.set_mmio(virt_addr.as_usize());
// GICC

@ -63,6 +63,7 @@ static PHYS_KERNEL_TABLES_BASE_ADDR: u64 = 0xCCCCAAAAFFFFEEEE;
/// This is a hack for retrieving the value for the kernel's virtual address space size as a
/// constant from a common place, since it is needed as a compile-time/link-time constant in both,
/// the linker script and the Rust sources.
#[allow(clippy::needless_late_init)]
const fn kernel_virt_addr_space_size() -> usize {
let __kernel_virt_addr_space_size;

@ -108,13 +108,12 @@
#![allow(clippy::upper_case_acronyms)]
#![allow(incomplete_features)]
#![feature(asm)]
#![feature(asm_const)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
#![feature(core_intrinsics)]
#![feature(format_args_nl)]
#![feature(generic_const_exprs)]
#![feature(global_asm)]
#![feature(linkage)]
#![feature(panic_info_message)]
#![feature(step_trait)]

@ -57,6 +57,7 @@ impl<ATYPE: AddressType> Address<ATYPE> {
}
/// Align down to page size.
#[must_use]
pub const fn align_down_page(self) -> Self {
let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE);
@ -64,6 +65,7 @@ impl<ATYPE: AddressType> Address<ATYPE> {
}
/// Align up to page size.
#[must_use]
pub const fn align_up_page(self) -> Self {
let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE);

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "cortex-a"
version = "6.1.0"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509fc35485a2b4ddbacabe0bf2212cdfff88da93658608e5cc651afcb75b7733"
checksum = "b27f5d071b671f9799dfdf0c0afcec11de65195383d36e186639c83b00705e4f"
dependencies = [
"tock-registers",
]

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" }
cortex-a = { version = "7.x.x" }

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save