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 //! crate::cpu::boot::arch_boot
// Assembly counterpart to this file. // 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()`. //! 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`. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`.
#![feature(asm)]
#![feature(global_asm)]
#![no_main] #![no_main]
#![no_std] #![no_std]

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

@ -24,5 +24,4 @@ path = "src/main.rs"
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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>"] authors = ["Andre Richter <andre.o.richter@gmail.com>"]
edition = "2021" edition = "2021"
@@ -21,3 +21,8 @@ @@ -21,3 +21,7 @@
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
[dependencies] [dependencies]
+ +
+# Platform specific dependencies +# Platform specific dependencies
+[target.'cfg(target_arch = "aarch64")'.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 diff -uNr 01_wait_forever/Makefile 02_runtime_init/Makefile
--- 01_wait_forever/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 @@ @@ -13,3 +13,15 @@
// Assembly counterpart to this file. // Assembly counterpart to this file.
global_asm!(include_str!("boot.s")); core::arch::global_asm!(include_str!("boot.s"));
+ +
+//-------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------
+// Public Code +// 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 diff -uNr 01_wait_forever/src/main.rs 02_runtime_init/src/main.rs
--- 01_wait_forever/src/main.rs --- 01_wait_forever/src/main.rs
+++ 02_runtime_init/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()`. //! 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`. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`.
+//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. +//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
-#![feature(asm)]
#![feature(global_asm)]
#![no_main] #![no_main]
#![no_std] #![no_std]
@@ -112,4 +112,11 @@ @@ -110,4 +111,11 @@
mod cpu; mod cpu;
mod panic_wait; mod panic_wait;

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

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

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

@ -24,5 +24,4 @@ path = "src/main.rs"
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs
--- 02_runtime_init/src/main.rs --- 02_runtime_init/src/main.rs
+++ 03_hacky_hello_world/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`. //! - It is implemented in `src/_arch/__arch_name__/cpu/boot.s`.
//! 2. Once finished with architectural setup, the arch code calls `kernel_init()`. //! 2. Once finished with architectural setup, the arch code calls `kernel_init()`.
+#![feature(format_args_nl)] +#![feature(format_args_nl)]
#![feature(global_asm)]
+#![feature(panic_info_message)] +#![feature(panic_info_message)]
#![no_main] #![no_main]
#![no_std] #![no_std]
@ -226,7 +225,7 @@ diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs
/// Early init code. /// Early init code.
/// ///
@@ -118,5 +122,7 @@ @@ -117,5 +121,7 @@
/// ///
/// - Only a single core must be active and running this function. /// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! { unsafe fn kernel_init() -> ! {

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

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

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

@ -24,5 +24,4 @@ path = "src/main.rs"
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs
--- 03_hacky_hello_world/src/main.rs --- 03_hacky_hello_world/src/main.rs
+++ 04_safe_globals/src/main.rs +++ 04_safe_globals/src/main.rs
@@ -107,6 +107,7 @@ @@ -106,6 +106,7 @@
#![feature(format_args_nl)] #![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
+#![feature(trait_alias)] +#![feature(trait_alias)]
#![no_main] #![no_main]
#![no_std] #![no_std]
@@ -115,6 +116,7 @@ @@ -114,6 +115,7 @@
mod cpu; mod cpu;
mod panic_wait; mod panic_wait;
mod print; mod print;
@ -240,7 +240,7 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs
/// Early init code. /// Early init code.
/// ///
@@ -122,7 +124,15 @@ @@ -121,7 +123,15 @@
/// ///
/// - Only a single core must be active and running this function. /// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! { unsafe fn kernel_init() -> ! {

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

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 diff -uNr 04_safe_globals/Makefile 05_drivers_gpio_uart/Makefile
--- 04_safe_globals/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)] +#![allow(clippy::upper_case_acronyms)]
+#![feature(const_fn_fn_ptr_basics)] +#![feature(const_fn_fn_ptr_basics)]
#![feature(format_args_nl)] #![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
@@ -114,6 +116,7 @@ #![feature(trait_alias)]
@@ -113,6 +115,7 @@
mod bsp; mod bsp;
mod console; mod console;
mod cpu; 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 panic_wait;
mod print; mod print;
mod synchronization; mod synchronization;
@@ -123,16 +126,54 @@ @@ -122,16 +125,54 @@
/// # Safety /// # Safety
/// ///
/// - Only a single core must be active and running this function. /// - Only a single core must be active and running this function.

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

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs
--- 05_drivers_gpio_uart/src/main.rs --- 05_drivers_gpio_uart/src/main.rs
+++ 06_uart_chainloader/src/main.rs +++ 06_uart_chainloader/src/main.rs
@@ -105,6 +105,7 @@ @@ -141,38 +141,56 @@
//! 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 @@
kernel_main() 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 bsp::console::console;
use console::interface::All; use console::interface::All;
- use driver::interface::DriverManager; - use driver::interface::DriverManager;
-
- println!( - println!(
- "[0] {} version {}", - "[0] {} version {}",
- env!("CARGO_PKG_NAME"), - env!("CARGO_PKG_NAME"),
@ -495,37 +487,36 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs
- .enumerate() - .enumerate()
- { - {
- println!(" {}. {}", i + 1, driver.compatible()); - println!(" {}. {}", i + 1, driver.compatible());
- }
- println!(
- "[3] Chars written: {}",
- bsp::console::console().chars_written()
- );
- println!("[4] Echoing input now");
+ println!("{}", MINILOAD_LOGO); + println!("{}", MINILOAD_LOGO);
+ println!("{:^37}", bsp::board_name()); + println!("{:^37}", bsp::board_name());
+ println!(); + println!();
+ println!("[ML] Requesting binary"); + println!("[ML] Requesting binary");
+ console().flush(); + console().flush();
+
- // Discard any spurious received characters before going into echo mode.
+ // Discard any spurious received characters before starting with the loader protocol. + // Discard any spurious received characters before starting with the loader protocol.
console().clear_rx(); + console().clear_rx();
- loop {
- let c = bsp::console::console().read_char();
- bsp::console::console().write_char(c);
+ +
+ // Notify `Minipush` to send the binary. + // Notify `Minipush` to send the binary.
+ for _ in 0..3 { + for _ in 0..3 {
+ console().write_char(3 as char); + 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. + // Read the binary's size.
+ let mut size: u32 = u32::from(console().read_char() as u8); + 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) << 8;
+ size |= u32::from(console().read_char() as u8) << 16; + size |= u32::from(console().read_char() as u8) << 16;
+ size |= u32::from(console().read_char() as u8) << 24; + 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. + // Trust it's not too big.
+ console().write_char('O'); + console().write_char('O');
+ console().write_char('K'); + 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 { + for i in 0..size {
+ core::ptr::write_volatile(kernel_addr.offset(i as isize), console().read_char() as u8) + core::ptr::write_volatile(kernel_addr.offset(i as isize), console().read_char() as u8)
+ } + }
+ } }
+ +
+ println!("[ML] Loaded! Executing the payload now\n"); + println!("[ML] Loaded! Executing the payload now\n");
+ console().flush(); + console().flush();

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

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs
--- 06_uart_chainloader/src/main.rs --- 06_uart_chainloader/src/main.rs
+++ 07_timestamps/src/main.rs +++ 07_timestamps/src/main.rs
@@ -105,7 +105,6 @@ @@ -119,6 +119,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)]
@@ -121,6 +120,7 @@
mod panic_wait; mod panic_wait;
mod print; mod print;
mod synchronization; mod synchronization;
@ -552,7 +544,7 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs
/// Early init code. /// Early init code.
/// ///
@@ -143,56 +143,38 @@ @@ -141,56 +142,38 @@
kernel_main() kernel_main()
} }

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

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 //! crate::cpu::boot::arch_boot
// Assembly counterpart to this file. // Assembly counterpart to this file.
global_asm!(include_str!("boot.s")); core::arch::global_asm!(include_str!("boot.s"));
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// Public Code // Public Code

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 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 --- 08_hw_debug_JTAG/src/_arch/aarch64/cpu/boot.rs
+++ 09_privilege_level/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 //! crate::cpu::boot::arch_boot
+use core::arch::global_asm;
+use cortex_a::{asm, registers::*}; +use cortex_a::{asm, registers::*};
+use tock_registers::interfaces::Writeable; +use tock_registers::interfaces::Writeable;
+ +
// Assembly counterpart to this file. // 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 +// 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. + // are no plans to ever return to EL2, just re-use the same stack.
+ SP_EL1.set(phys_boot_core_stack_end_exclusive_addr); + 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 Rust entry of the `kernel` binary.
/// ///
/// The function is called from the assembly `_start` function. /// 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 diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs
--- 08_hw_debug_JTAG/src/main.rs --- 08_hw_debug_JTAG/src/main.rs
+++ 09_privilege_level/src/main.rs +++ 09_privilege_level/src/main.rs
@@ -117,6 +117,7 @@ @@ -116,6 +116,7 @@
mod console; mod console;
mod cpu; mod cpu;
mod driver; 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 panic_wait;
mod print; mod print;
mod synchronization; mod synchronization;
@@ -145,6 +146,8 @@ @@ -144,6 +145,8 @@
/// The main function running after the early init. /// The main function running after the early init.
fn kernel_main() -> ! { 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 core::time::Duration;
use driver::interface::DriverManager; use driver::interface::DriverManager;
use time::interface::TimeManager; use time::interface::TimeManager;
@@ -156,6 +159,12 @@ @@ -155,6 +158,12 @@
); );
info!("Booting on: {}", bsp::board_name()); 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!( info!(
"Architectural timer resolution: {} ns", "Architectural timer resolution: {} ns",
time::time_manager().resolution().as_nanos() time::time_manager().resolution().as_nanos()
@@ -170,11 +179,15 @@ @@ -169,11 +178,15 @@
info!(" {}. {}", i + 1, driver.compatible()); info!(" {}. {}", i + 1, driver.compatible());
} }

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

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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(const_fn_fn_ptr_basics)]
+#![feature(core_intrinsics)] +#![feature(core_intrinsics)]
#![feature(format_args_nl)] #![feature(format_args_nl)]
#![feature(global_asm)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
@@ -118,6 +120,7 @@ #![feature(trait_alias)]
@@ -117,6 +119,7 @@
mod cpu; mod cpu;
mod driver; mod driver;
mod exception; 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 panic_wait;
mod print; mod print;
mod synchronization; mod synchronization;
@@ -128,9 +131,17 @@ @@ -127,9 +130,17 @@
/// # Safety /// # Safety
/// ///
/// - Only a single core must be active and running this function. /// - 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() { for i in bsp::driver::driver_manager().all_device_drivers().iter() {
if let Err(x) = i.init() { if let Err(x) = i.init() {
@@ -159,6 +170,9 @@ @@ -158,6 +169,9 @@
); );
info!("Booting on: {}", bsp::board_name()); 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(); let (_, privilege_level) = exception::current_privilege_level();
info!("Current privilege level: {}", privilege_level); info!("Current privilege level: {}", privilege_level);
@@ -182,6 +196,13 @@ @@ -181,6 +195,13 @@
info!("Timer test, spinning for 1 second"); info!("Timer test, spinning for 1 second");
time::time_manager().spin_for(Duration::from_secs(1)); time::time_manager().spin_for(Duration::from_secs(1));

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

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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 cortex_a::registers::*;
-use tock_registers::interfaces::Readable; -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 cortex_a::{asm::barrier, registers::*};
+use tock_registers::{ +use tock_registers::{
+ interfaces::{Readable, Writeable}, + 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 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 --- 10_virtual_mem_part1_identity_mapping/src/main.rs
+++ 11_exceptions_part1_groundwork/src/main.rs +++ 11_exceptions_part1_groundwork/src/main.rs
@@ -139,6 +139,8 @@ @@ -138,6 +138,8 @@
use driver::interface::DriverManager; use driver::interface::DriverManager;
use memory::mmu::interface::MMU; 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() { if let Err(string) = memory::mmu::mmu().enable_mmu_and_caching() {
panic!("MMU: {}", string); panic!("MMU: {}", string);
} }
@@ -196,13 +198,28 @@ @@ -195,13 +197,28 @@
info!("Timer test, spinning for 1 second"); info!("Timer test, spinning for 1 second");
time::time_manager().spin_for(Duration::from_secs(1)); time::time_manager().spin_for(Duration::from_secs(1));

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

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

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

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

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

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

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

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

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

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } 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 # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" } cortex-a = { version = "7.x.x" }
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
## Testing ## 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 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 --- 12_integrated_testing/src/_arch/aarch64/exception/asynchronous.rs
+++ 13_exceptions_part2_peripheral_IRQs/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 //! crate::exception::asynchronous::arch_asynchronous
+use core::arch::asm;
use cortex_a::registers::*; use cortex_a::registers::*;
-use tock_registers::interfaces::Readable; -use tock_registers::interfaces::Readable;
+use tock_registers::interfaces::{Readable, Writeable}; +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 { trait DaifField {
fn daif_field() -> tock_registers::fields::Field<u64, DAIF::Register>; fn daif_field() -> tock_registers::fields::Field<u64, DAIF::Register>;
} }
@@ -66,6 +70,71 @@ @@ -66,6 +71,71 @@
// Public Code // Public Code
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -908,7 +910,7 @@ diff -uNr 12_integrated_testing/src/_arch/aarch64/exception.rs 13_exceptions_par
//! crate::exception::arch_exception //! crate::exception::arch_exception
+use crate::{bsp, 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 cortex_a::{asm::barrier, registers::*};
use tock_registers::{ use tock_registers::{
@@ -91,8 +92,11 @@ @@ -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(clippy::upper_case_acronyms)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
+#![feature(asm)] +#![feature(asm_const)]
#![feature(const_fn_fn_ptr_basics)] #![feature(const_fn_fn_ptr_basics)]
+#![feature(const_fn_trait_bound)] +#![feature(const_fn_trait_bound)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(format_args_nl)] #![feature(format_args_nl)]
#![feature(global_asm)] #![feature(linkage)]
@@ -132,6 +134,7 @@ @@ -131,6 +133,7 @@
pub mod exception; pub mod exception;
pub mod memory; pub mod memory;
pub mod print; pub mod print;

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

@ -12,7 +12,7 @@
//! crate::exception::arch_exception //! crate::exception::arch_exception
use crate::{bsp, 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 cortex_a::{asm::barrier, registers::*};
use tock_registers::{ use tock_registers::{
interfaces::{Readable, Writeable}, interfaces::{Readable, Writeable},

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

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

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

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } 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 # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" } cortex-a = { version = "7.x.x" }
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
## Testing ## 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]), handler_table: InitStateLock::new([None; Self::NUM_IRQS]),
} }
} }
@@ -139,6 +152,22 @@ @@ -139,6 +152,20 @@
} }
unsafe fn init(&self) -> Result<(), &'static str> { unsafe fn init(&self) -> Result<(), &'static str> {
+ let remapped = self.is_mmio_remapped.load(Ordering::Relaxed); + let remapped = self.is_mmio_remapped.load(Ordering::Relaxed);
+ if !remapped { + if !remapped {
+ let mut virt_addr;
+
+ // GICD + // 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()); + self.gicd.set_mmio(virt_addr.as_usize());
+ +
+ // GICC + // 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 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 --- 13_exceptions_part2_peripheral_IRQs/src/lib.rs
+++ 14_virtual_mem_part2_mmio_remap/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(const_fn_trait_bound)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(format_args_nl)] #![feature(format_args_nl)]
+#![feature(generic_const_exprs)] +#![feature(generic_const_exprs)]
#![feature(global_asm)]
#![feature(linkage)] #![feature(linkage)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
+#![feature(step_trait)] +#![feature(step_trait)]
#![feature(trait_alias)] #![feature(trait_alias)]
#![no_std] #![no_std]
// Testing // Testing
@@ -128,6 +130,7 @@ @@ -127,6 +129,7 @@
mod synchronization; mod synchronization;
pub mod bsp; 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 console;
pub mod cpu; pub mod cpu;
pub mod driver; pub mod driver;
@@ -180,6 +183,7 @@ @@ -179,6 +182,7 @@
#[no_mangle] #[no_mangle]
unsafe fn kernel_init() -> ! { unsafe fn kernel_init() -> ! {
exception::handling_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 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 --- 13_exceptions_part2_peripheral_IRQs/src/memory.rs
+++ 14_virtual_mem_part2_mmio_remap/src/memory.rs +++ 14_virtual_mem_part2_mmio_remap/src/memory.rs
@@ -5,3 +5,161 @@ @@ -5,3 +5,163 @@
//! Memory Management. //! Memory Management.
pub mod mmu; 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. + /// Align down to page size.
+ #[must_use]
+ pub const fn align_down_page(self) -> Self { + pub const fn align_down_page(self) -> Self {
+ let aligned = common::align_down(self.value, bsp::memory::mmu::KernelGranule::SIZE); + 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. + /// Align up to page size.
+ #[must_use]
+ pub const fn align_up_page(self) -> Self { + pub const fn align_up_page(self) -> Self {
+ let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE); + let aligned = common::align_up(self.value, bsp::memory::mmu::KernelGranule::SIZE);
+ +

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

@ -12,7 +12,7 @@
//! crate::exception::arch_exception //! crate::exception::arch_exception
use crate::{bsp, 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 cortex_a::{asm::barrier, registers::*};
use tock_registers::{ use tock_registers::{
interfaces::{Readable, Writeable}, interfaces::{Readable, Writeable},

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

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

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

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

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

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } 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 # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" } cortex-a = { version = "7.x.x" }
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
## Testing ## 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 //! crate::cpu::boot::arch_boot
+use crate::{memory, memory::Address}; +use crate::{memory, memory::Address};
use core::arch::global_asm;
use cortex_a::{asm, registers::*}; use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable; use tock_registers::interfaces::Writeable;
@@ -71,9 +72,16 @@
@@ -70,9 +71,16 @@
/// ///
/// - Exception return from EL2 must must continue execution in EL1 with `kernel_init()`. /// - Exception return from EL2 must must continue execution in EL1 with `kernel_init()`.
#[no_mangle] #[no_mangle]
@ -1167,7 +1167,7 @@ diff -uNr 14_virtual_mem_part2_mmio_remap/src/bsp/raspberrypi/memory/mmu.rs 15_v
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// Global instances // Global instances
@@ -43,13 +43,34 @@ @@ -43,13 +43,35 @@
/// ///
/// That is, `size_of(InitStateLock<KernelTranslationTable>) == size_of(KernelTranslationTable)`. /// That is, `size_of(InitStateLock<KernelTranslationTable>) == size_of(KernelTranslationTable)`.
/// There is a unit tests that checks this porperty. /// 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 +/// 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, +/// 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. +/// the linker script and the Rust sources.
+#[allow(clippy::needless_late_init)]
+const fn kernel_virt_addr_space_size() -> usize { +const fn kernel_virt_addr_space_size() -> usize {
+ let __kernel_virt_addr_space_size; + 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. /// Helper function for calculating the number of pages the given parameter spans.
const fn size_to_num_pages(size: usize) -> usize { const fn size_to_num_pages(size: usize) -> usize {
assert!(size > 0); assert!(size > 0);
@@ -88,18 +109,22 @@ @@ -88,18 +110,22 @@
MemoryRegion::new(start_page_addr, end_exclusive_page_addr) 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) MemoryRegion::new(start_page_addr, end_exclusive_page_addr)
} }

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

@ -12,7 +12,7 @@
//! crate::exception::arch_exception //! crate::exception::arch_exception
use crate::{bsp, 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 cortex_a::{asm::barrier, registers::*};
use tock_registers::{ use tock_registers::{
interfaces::{Readable, Writeable}, interfaces::{Readable, Writeable},

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

@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 {
unsafe fn init(&self) -> Result<(), &'static str> { unsafe fn init(&self) -> Result<(), &'static str> {
let remapped = self.is_mmio_remapped.load(Ordering::Relaxed); let remapped = self.is_mmio_remapped.load(Ordering::Relaxed);
if !remapped { if !remapped {
let mut virt_addr;
// GICD // 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()); self.gicd.set_mmio(virt_addr.as_usize());
// GICC // 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 /// 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, /// 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. /// the linker script and the Rust sources.
#[allow(clippy::needless_late_init)]
const fn kernel_virt_addr_space_size() -> usize { const fn kernel_virt_addr_space_size() -> usize {
let __kernel_virt_addr_space_size; let __kernel_virt_addr_space_size;

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

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

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

@ -22,11 +22,11 @@ test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
tock-registers = { version = "0.7.x", default-features = false, features = ["register_types"], optional = true } 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 # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "6.x.x" } cortex-a = { version = "7.x.x" }
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
## Testing ## 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 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 --- 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 +++ 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 `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. /// - The HW state of EL1 must be prepared in a sound way.
#[inline(always)] #[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. // Enable timer counter registers for EL1.
CNTHCTL_EL2.write(CNTHCTL_EL2::EL1PCEN::SET + CNTHCTL_EL2::EL1PCTEN::SET); 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(). // 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] #[no_mangle]
pub unsafe extern "C" fn _start_rust( pub unsafe extern "C" fn _start_rust(
phys_kernel_tables_base_addr: u64, 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 // 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 /// `translation table tool` and patched into the kernel binary. This function just adds the mapping
/// record entries. /// record entries.
pub fn kernel_add_mapping_records_for_precomputed() { 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(); let virt_code_region = virt_code_region();
generic_mmu::kernel_add_mapping_record( generic_mmu::kernel_add_mapping_record(
"Kernel code and RO data", "Kernel code and RO data",
@@ -175,4 +167,12 @@ @@ -176,4 +168,12 @@
&kernel_virt_to_phys_region(virt_data_region), &kernel_virt_to_phys_region(virt_data_region),
&kernel_page_attributes(virt_data_region.start_page_addr()), &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 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 --- 15_virtual_mem_part3_precomputed_tables/src/lib.rs
+++ 16_virtual_mem_part4_higher_half_kernel/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 //! crate::cpu::boot::arch_boot
use crate::{memory, memory::Address}; use crate::{memory, memory::Address};
use core::arch::global_asm;
use cortex_a::{asm, registers::*}; use cortex_a::{asm, registers::*};
use tock_registers::interfaces::Writeable; use tock_registers::interfaces::Writeable;

@ -12,7 +12,7 @@
//! crate::exception::arch_exception //! crate::exception::arch_exception
use crate::{bsp, 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 cortex_a::{asm::barrier, registers::*};
use tock_registers::{ use tock_registers::{
interfaces::{Readable, Writeable}, interfaces::{Readable, Writeable},

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

@ -154,10 +154,8 @@ impl driver::interface::DeviceDriver for GICv2 {
unsafe fn init(&self) -> Result<(), &'static str> { unsafe fn init(&self) -> Result<(), &'static str> {
let remapped = self.is_mmio_remapped.load(Ordering::Relaxed); let remapped = self.is_mmio_remapped.load(Ordering::Relaxed);
if !remapped { if !remapped {
let mut virt_addr;
// GICD // 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()); self.gicd.set_mmio(virt_addr.as_usize());
// GICC // 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 /// 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, /// 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. /// the linker script and the Rust sources.
#[allow(clippy::needless_late_init)]
const fn kernel_virt_addr_space_size() -> usize { const fn kernel_virt_addr_space_size() -> usize {
let __kernel_virt_addr_space_size; let __kernel_virt_addr_space_size;

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

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

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

@ -27,5 +27,4 @@ tock-registers = { version = "0.7.x", default-features = false, features = ["reg
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.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