diff --git a/01_wait_forever/Cargo.lock b/01_wait_forever/Cargo.lock index 3e9c3111..aaed1825 100644 --- a/01_wait_forever/Cargo.lock +++ b/01_wait_forever/Cargo.lock @@ -1,6 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] -name = "kernel" +name = "mingo" version = "0.1.0" - diff --git a/01_wait_forever/Cargo.toml b/01_wait_forever/Cargo.toml index a7580996..2b46585e 100644 --- a/01_wait_forever/Cargo.toml +++ b/01_wait_forever/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "kernel" +name = "mingo" version = "0.1.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = [] bsp_rpi4 = [] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/02_runtime_init/Cargo.lock b/02_runtime_init/Cargo.lock index 3b926a34..090fdaee 100644 --- a/02_runtime_init/Cargo.lock +++ b/02_runtime_init/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.2.0" dependencies = [ "cortex-a", ] diff --git a/02_runtime_init/Cargo.toml b/02_runtime_init/Cargo.toml index 4a03b962..be6091a4 100644 --- a/02_runtime_init/Cargo.toml +++ b/02_runtime_init/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.2.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = [] bsp_rpi4 = [] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- @@ -21,3 +25,4 @@ bsp_rpi4 = [] # Platform specific dependencies [target.'cfg(target_arch = "aarch64")'.dependencies] cortex-a = { version = "5.x.x" } + diff --git a/02_runtime_init/README.md b/02_runtime_init/README.md index b294e2e1..dfa43562 100644 --- a/02_runtime_init/README.md +++ b/02_runtime_init/README.md @@ -31,7 +31,15 @@ diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml --- 01_wait_forever/Cargo.toml +++ 02_runtime_init/Cargo.toml -@@ -17,3 +17,7 @@ +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.1.0" ++version = "0.2.0" + authors = ["Andre Richter "] + edition = "2018" + +@@ -21,3 +21,8 @@ ##-------------------------------------------------------------------------------------------------- [dependencies] @@ -39,6 +47,7 @@ diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml +# Platform specific dependencies +[target.'cfg(target_arch = "aarch64")'.dependencies] +cortex-a = { version = "5.x.x" } ++ diff -uNr 01_wait_forever/Makefile 02_runtime_init/Makefile --- 01_wait_forever/Makefile diff --git a/03_hacky_hello_world/Cargo.lock b/03_hacky_hello_world/Cargo.lock index 3b926a34..09dfcc72 100644 --- a/03_hacky_hello_world/Cargo.lock +++ b/03_hacky_hello_world/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.3.0" dependencies = [ "cortex-a", ] diff --git a/03_hacky_hello_world/Cargo.toml b/03_hacky_hello_world/Cargo.toml index 5deb7010..6ed23060 100644 --- a/03_hacky_hello_world/Cargo.toml +++ b/03_hacky_hello_world/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.3.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = [] bsp_rpi4 = [] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/03_hacky_hello_world/README.md b/03_hacky_hello_world/README.md index a002a619..6958b8bc 100644 --- a/03_hacky_hello_world/README.md +++ b/03_hacky_hello_world/README.md @@ -31,11 +31,14 @@ Kernel panic: Stopping here. diff -uNr 02_runtime_init/Cargo.toml 03_hacky_hello_world/Cargo.toml --- 02_runtime_init/Cargo.toml +++ 03_hacky_hello_world/Cargo.toml -@@ -21,3 +21,4 @@ - # Platform specific dependencies - [target.'cfg(target_arch = "aarch64")'.dependencies] - cortex-a = { version = "5.x.x" } -+ +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.2.0" ++version = "0.3.0" + authors = ["Andre Richter "] + edition = "2018" + diff -uNr 02_runtime_init/Makefile 03_hacky_hello_world/Makefile --- 02_runtime_init/Makefile diff --git a/04_safe_globals/Cargo.lock b/04_safe_globals/Cargo.lock index 3b926a34..ccfbefbf 100644 --- a/04_safe_globals/Cargo.lock +++ b/04_safe_globals/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.4.0" dependencies = [ "cortex-a", ] diff --git a/04_safe_globals/Cargo.toml b/04_safe_globals/Cargo.toml index 5deb7010..16e4741d 100644 --- a/04_safe_globals/Cargo.toml +++ b/04_safe_globals/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.4.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = [] bsp_rpi4 = [] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/04_safe_globals/README.md b/04_safe_globals/README.md index 13b9e298..272edfce 100644 --- a/04_safe_globals/README.md +++ b/04_safe_globals/README.md @@ -46,14 +46,27 @@ implemntations in the [spin crate] or the [parking lot crate]. ```console $ make qemu [...] -[0] Hello from pure Rust! -[1] Chars written: 27 + +[0] Hello from Rust! +[1] Chars written: 22 [2] Stopping here. ``` ## Diff to previous ```diff +diff -uNr 03_hacky_hello_world/Cargo.toml 04_safe_globals/Cargo.toml +--- 03_hacky_hello_world/Cargo.toml ++++ 04_safe_globals/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.3.0" ++version = "0.4.0" + authors = ["Andre Richter "] + edition = "2018" + + diff -uNr 03_hacky_hello_world/src/bsp/raspberrypi/console.rs 04_safe_globals/src/bsp/raspberrypi/console.rs --- 03_hacky_hello_world/src/bsp/raspberrypi/console.rs +++ 04_safe_globals/src/bsp/raspberrypi/console.rs @@ -231,12 +244,11 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs /// /// - Only a single core must be active and running this function. unsafe fn kernel_init() -> ! { -- println!("[0] Hello from Rust!"); + use console::interface::Statistics; ++ + println!("[0] Hello from Rust!"); - panic!("Stopping here.") -+ println!("[0] Hello from pure Rust!"); -+ + println!( + "[1] Chars written: {}", + bsp::console::console().chars_written() diff --git a/04_safe_globals/src/main.rs b/04_safe_globals/src/main.rs index 579f90dd..48687ace 100644 --- a/04_safe_globals/src/main.rs +++ b/04_safe_globals/src/main.rs @@ -130,7 +130,7 @@ mod synchronization; unsafe fn kernel_init() -> ! { use console::interface::Statistics; - println!("[0] Hello from pure Rust!"); + println!("[0] Hello from Rust!"); println!( "[1] Chars written: {}", diff --git a/05_drivers_gpio_uart/Cargo.lock b/05_drivers_gpio_uart/Cargo.lock index a3d8bb9a..87044397 100644 --- a/05_drivers_gpio_uart/Cargo.lock +++ b/05_drivers_gpio_uart/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.5.0" dependencies = [ "cortex-a", "register", diff --git a/05_drivers_gpio_uart/Cargo.toml b/05_drivers_gpio_uart/Cargo.toml index df5f7f97..03ec9cdb 100644 --- a/05_drivers_gpio_uart/Cargo.toml +++ b/05_drivers_gpio_uart/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.5.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/05_drivers_gpio_uart/README.md b/05_drivers_gpio_uart/README.md index 4ecdd41a..9f4a8749 100644 --- a/05_drivers_gpio_uart/README.md +++ b/05_drivers_gpio_uart/README.md @@ -95,12 +95,13 @@ Miniterm 1.0 [MT] ⏳ Waiting for /dev/ttyUSB0 [MT] ✅ Serial connected -[0] Booting on: Raspberry Pi 3 -[1] Drivers loaded: +[0] mingo version 0.5.0 +[1] Booting on: Raspberry Pi 3 +[2] Drivers loaded: 1. BCM GPIO 2. BCM PL011 UART -[2] Chars written: 93 -[3] Echoing input now +[3] Chars written: 117 +[4] Echoing input now ``` 8. Exit by pressing ctrl-c. @@ -111,6 +112,14 @@ Miniterm 1.0 diff -uNr 04_safe_globals/Cargo.toml 05_drivers_gpio_uart/Cargo.toml --- 04_safe_globals/Cargo.toml +++ 05_drivers_gpio_uart/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.4.0" ++version = "0.5.0" + authors = ["Andre Richter "] + edition = "2018" + @@ -9,8 +9,8 @@ [features] @@ -120,9 +129,9 @@ diff -uNr 04_safe_globals/Cargo.toml 05_drivers_gpio_uart/Cargo.toml +bsp_rpi3 = ["register"] +bsp_rpi4 = ["register"] - ##-------------------------------------------------------------------------------------------------- - ## Dependencies -@@ -18,6 +18,9 @@ + [[bin]] + name = "kernel" +@@ -22,6 +22,9 @@ [dependencies] @@ -1329,7 +1338,7 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs mod memory; mod panic_wait; mod print; -@@ -127,16 +130,49 @@ +@@ -127,16 +130,54 @@ /// # Safety /// /// - Only a single core must be active and running this function. @@ -1338,7 +1347,7 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs - use console::interface::Statistics; + use driver::interface::DriverManager; -- println!("[0] Hello from pure Rust!"); +- println!("[0] Hello from Rust!"); + for i in bsp::driver::driver_manager().all_device_drivers().iter() { + if let Err(x) = i.init() { + panic!("Error loading driver: {}: {}", i.compatible(), x); @@ -1357,9 +1366,14 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs + use console::interface::All; + use driver::interface::DriverManager; + -+ println!("[0] Booting on: {}", bsp::board_name()); ++ println!( ++ "[0] {} version {}", ++ env!("CARGO_PKG_NAME"), ++ env!("CARGO_PKG_VERSION") ++ ); ++ println!("[1] Booting on: {}", bsp::board_name()); + -+ println!("[1] Drivers loaded:"); ++ println!("[2] Drivers loaded:"); + for (i, driver) in bsp::driver::driver_manager() + .all_device_drivers() + .iter() @@ -1370,10 +1384,10 @@ diff -uNr 04_safe_globals/src/main.rs 05_drivers_gpio_uart/src/main.rs println!( - "[1] Chars written: {}", -+ "[2] Chars written: {}", ++ "[3] Chars written: {}", bsp::console::console().chars_written() ); -+ println!("[3] Echoing input now"); ++ println!("[4] Echoing input now"); - println!("[2] Stopping here."); - cpu::wait_forever() diff --git a/05_drivers_gpio_uart/src/main.rs b/05_drivers_gpio_uart/src/main.rs index 0f3c493d..93d6ffef 100644 --- a/05_drivers_gpio_uart/src/main.rs +++ b/05_drivers_gpio_uart/src/main.rs @@ -152,9 +152,14 @@ fn kernel_main() -> ! { use console::interface::All; use driver::interface::DriverManager; - println!("[0] Booting on: {}", bsp::board_name()); + println!( + "[0] {} version {}", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION") + ); + println!("[1] Booting on: {}", bsp::board_name()); - println!("[1] Drivers loaded:"); + println!("[2] Drivers loaded:"); for (i, driver) in bsp::driver::driver_manager() .all_device_drivers() .iter() @@ -164,10 +169,10 @@ fn kernel_main() -> ! { } println!( - "[2] Chars written: {}", + "[3] Chars written: {}", bsp::console::console().chars_written() ); - println!("[3] Echoing input now"); + println!("[4] Echoing input now"); // Discard any spurious received characters before going into echo mode. console().clear_rx(); diff --git a/06_uart_chainloader/Cargo.lock b/06_uart_chainloader/Cargo.lock index a3d8bb9a..5d2602a8 100644 --- a/06_uart_chainloader/Cargo.lock +++ b/06_uart_chainloader/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.6.0" dependencies = [ "cortex-a", "register", diff --git a/06_uart_chainloader/Cargo.toml b/06_uart_chainloader/Cargo.toml index df5f7f97..0e1c5c28 100644 --- a/06_uart_chainloader/Cargo.toml +++ b/06_uart_chainloader/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.6.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/06_uart_chainloader/README.md b/06_uart_chainloader/README.md index 131dc19b..80aa2133 100644 --- a/06_uart_chainloader/README.md +++ b/06_uart_chainloader/README.md @@ -75,12 +75,13 @@ Minipush 1.0 [MP] ⏩ Pushing 6 KiB ==========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[0] Booting on: Raspberry Pi 3 -[1] Drivers loaded: +[0] mingo version 0.5.0 +[1] Booting on: Raspberry Pi 3 +[2] Drivers loaded: 1. BCM GPIO 2. BCM PL011 UART -[2] Chars written: 93 -[3] Echoing input now +[3] Chars written: 117 +[4] Echoing input now ``` In this tutorial, a version of the kernel from the previous tutorial is loaded for demo purposes. In @@ -118,6 +119,18 @@ IN: ## Diff to previous ```diff + +diff -uNr 05_drivers_gpio_uart/Cargo.toml 06_uart_chainloader/Cargo.toml +--- 05_drivers_gpio_uart/Cargo.toml ++++ 06_uart_chainloader/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.5.0" ++version = "0.6.0" + authors = ["Andre Richter "] + edition = "2018" + Binary files 05_drivers_gpio_uart/demo_payload_rpi3.img and 06_uart_chainloader/demo_payload_rpi3.img differ Binary files 05_drivers_gpio_uart/demo_payload_rpi4.img and 06_uart_chainloader/demo_payload_rpi4.img differ @@ -373,7 +386,7 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs #![feature(const_fn_fn_ptr_basics)] #![feature(format_args_nl)] #![feature(global_asm)] -@@ -146,33 +147,56 @@ +@@ -146,38 +147,56 @@ kernel_main() } @@ -389,15 +402,15 @@ 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] Booting on: {}", bsp::board_name()); -+ println!("{}", MINILOAD_LOGO); -+ println!("{:^37}", bsp::board_name()); -+ println!(); -+ println!("[ML] Requesting binary"); -+ console().flush(); - -- println!("[1] Drivers loaded:"); +- +- println!( +- "[0] {} version {}", +- env!("CARGO_PKG_NAME"), +- env!("CARGO_PKG_VERSION") +- ); +- println!("[1] Booting on: {}", bsp::board_name()); +- +- println!("[2] Drivers loaded:"); - for (i, driver) in bsp::driver::driver_manager() - .all_device_drivers() - .iter() @@ -405,24 +418,30 @@ diff -uNr 05_drivers_gpio_uart/src/main.rs 06_uart_chainloader/src/main.rs - { - println!(" {}. {}", i + 1, driver.compatible()); - } -+ // Discard any spurious received characters before starting with the loader protocol. -+ console().clear_rx(); - println!( -- "[2] Chars written: {}", +- "[3] Chars written: {}", - bsp::console::console().chars_written() - ); -- println!("[3] Echoing input now"); -+ // Notify `Minipush` to send the binary. -+ for _ in 0..3 { -+ console().write_char(3 as char); -+ } +- 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. -- console().clear_rx(); ++ // 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); ++ ++ // Notify `Minipush` to send the binary. ++ for _ in 0..3 { ++ console().write_char(3 as char); + } ++ + // 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; @@ -439,7 +458,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(); diff --git a/06_uart_chainloader/demo_payload_rpi3.img b/06_uart_chainloader/demo_payload_rpi3.img index 203ebb76..9b1cf35b 100755 Binary files a/06_uart_chainloader/demo_payload_rpi3.img and b/06_uart_chainloader/demo_payload_rpi3.img differ diff --git a/06_uart_chainloader/demo_payload_rpi4.img b/06_uart_chainloader/demo_payload_rpi4.img index b06166dc..2357ef5e 100755 Binary files a/06_uart_chainloader/demo_payload_rpi4.img and b/06_uart_chainloader/demo_payload_rpi4.img differ diff --git a/07_timestamps/Cargo.lock b/07_timestamps/Cargo.lock index a3d8bb9a..311b6c21 100644 --- a/07_timestamps/Cargo.lock +++ b/07_timestamps/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.7.0" dependencies = [ "cortex-a", "register", diff --git a/07_timestamps/Cargo.toml b/07_timestamps/Cargo.toml index df5f7f97..07aa0517 100644 --- a/07_timestamps/Cargo.toml +++ b/07_timestamps/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.7.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/07_timestamps/README.md b/07_timestamps/README.md index e221a12c..a5063cb6 100644 --- a/07_timestamps/README.md +++ b/07_timestamps/README.md @@ -27,22 +27,35 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 11 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 +[MP] ⏩ Pushing 12 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 0.543941] Booting on: Raspberry Pi 3 -[ 0.545059] Architectural timer resolution: 52 ns -[ 0.547358] Drivers loaded: -[ 0.548703] 1. BCM GPIO -[ 0.550135] 2. BCM PL011 UART -[W 0.551828] Spin duration smaller than architecturally supported, skipping -[ 0.555212] Spinning for 1 second -[ 1.556818] Spinning for 1 second -[ 2.557690] Spinning for 1 second +[ 0.140431] mingo version 0.7.0 +[ 0.140630] Booting on: Raspberry Pi 3 +[ 0.141085] Architectural timer resolution: 52 ns +[ 0.141660] Drivers loaded: +[ 0.141995] 1. BCM GPIO +[ 0.142353] 2. BCM PL011 UART +[W 0.142777] Spin duration smaller than architecturally supported, skipping +[ 0.143621] Spinning for 1 second +[ 1.144023] Spinning for 1 second +[ 2.144245] Spinning for 1 second ``` ## Diff to previous ```diff + +diff -uNr 06_uart_chainloader/Cargo.toml 07_timestamps/Cargo.toml +--- 06_uart_chainloader/Cargo.toml ++++ 07_timestamps/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.6.0" ++version = "0.7.0" + authors = ["Andre Richter "] + edition = "2018" + Binary files 06_uart_chainloader/demo_payload_rpi3.img and 07_timestamps/demo_payload_rpi3.img differ Binary files 06_uart_chainloader/demo_payload_rpi4.img and 07_timestamps/demo_payload_rpi4.img differ @@ -475,7 +488,7 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs /// Early init code. /// -@@ -147,56 +147,33 @@ +@@ -147,56 +147,38 @@ kernel_main() } @@ -506,8 +519,26 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs - // Notify `Minipush` to send the binary. - for _ in 0..3 { - console().write_char(3 as char); -- } ++ info!( ++ "{} version {}", ++ env!("CARGO_PKG_NAME"), ++ env!("CARGO_PKG_VERSION") ++ ); + info!("Booting on: {}", bsp::board_name()); ++ ++ info!( ++ "Architectural timer resolution: {} ns", ++ time::time_manager().resolution().as_nanos() ++ ); ++ ++ info!("Drivers loaded:"); ++ for (i, driver) in bsp::driver::driver_manager() ++ .all_device_drivers() ++ .iter() ++ .enumerate() ++ { ++ info!(" {}. {}", i + 1, driver.compatible()); + } - // Read the binary's size. - let mut size: u32 = u32::from(console().read_char() as u8); @@ -525,28 +556,16 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs - for i in 0..size { - core::ptr::write_volatile(kernel_addr.offset(i as isize), console().read_char() as u8) - } -+ info!( -+ "Architectural timer resolution: {} ns", -+ time::time_manager().resolution().as_nanos() -+ ); -+ -+ info!("Drivers loaded:"); -+ for (i, driver) in bsp::driver::driver_manager() -+ .all_device_drivers() -+ .iter() -+ .enumerate() -+ { -+ info!(" {}. {}", i + 1, driver.compatible()); - } +- } ++ // Test a failing timer case. ++ time::time_manager().spin_for(Duration::from_nanos(1)); - println!("[ML] Loaded! Executing the payload now\n"); - console().flush(); - - // Use black magic to create a function pointer. - let kernel: fn() -> ! = unsafe { core::mem::transmute(kernel_addr) }; -+ // Test a failing timer case. -+ time::time_manager().spin_for(Duration::from_nanos(1)); - +- - // Jump to loaded kernel! - kernel() + loop { diff --git a/07_timestamps/src/main.rs b/07_timestamps/src/main.rs index b7a74ea6..5f465cbf 100644 --- a/07_timestamps/src/main.rs +++ b/07_timestamps/src/main.rs @@ -153,6 +153,11 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use time::interface::TimeManager; + info!( + "{} version {}", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION") + ); info!("Booting on: {}", bsp::board_name()); info!( diff --git a/08_hw_debug_JTAG/Cargo.lock b/08_hw_debug_JTAG/Cargo.lock index a3d8bb9a..011adc0f 100644 --- a/08_hw_debug_JTAG/Cargo.lock +++ b/08_hw_debug_JTAG/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.8.0" dependencies = [ "cortex-a", "register", diff --git a/08_hw_debug_JTAG/Cargo.toml b/08_hw_debug_JTAG/Cargo.toml index df5f7f97..e84540ca 100644 --- a/08_hw_debug_JTAG/Cargo.toml +++ b/08_hw_debug_JTAG/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.8.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/08_hw_debug_JTAG/README.md b/08_hw_debug_JTAG/README.md index 03d16a4f..a30a296e 100644 --- a/08_hw_debug_JTAG/README.md +++ b/08_hw_debug_JTAG/README.md @@ -305,6 +305,18 @@ Thanks to [@naotaco](https://github.com/naotaco) for laying the groundwork for t ## Diff to previous ```diff +diff -uNr 07_timestamps/Cargo.toml 08_hw_debug_JTAG/Cargo.toml +--- 07_timestamps/Cargo.toml ++++ 08_hw_debug_JTAG/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.7.0" ++version = "0.8.0" + authors = ["Andre Richter "] + edition = "2018" + + diff -uNr 07_timestamps/Makefile 08_hw_debug_JTAG/Makefile --- 07_timestamps/Makefile +++ 08_hw_debug_JTAG/Makefile diff --git a/08_hw_debug_JTAG/src/main.rs b/08_hw_debug_JTAG/src/main.rs index b7a74ea6..5f465cbf 100644 --- a/08_hw_debug_JTAG/src/main.rs +++ b/08_hw_debug_JTAG/src/main.rs @@ -153,6 +153,11 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use time::interface::TimeManager; + info!( + "{} version {}", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION") + ); info!("Booting on: {}", bsp::board_name()); info!( diff --git a/09_privilege_level/Cargo.lock b/09_privilege_level/Cargo.lock index a3d8bb9a..753961f7 100644 --- a/09_privilege_level/Cargo.lock +++ b/09_privilege_level/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.9.0" dependencies = [ "cortex-a", "register", diff --git a/09_privilege_level/Cargo.toml b/09_privilege_level/Cargo.toml index df5f7f97..f6750ed4 100644 --- a/09_privilege_level/Cargo.toml +++ b/09_privilege_level/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.9.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/09_privilege_level/README.md b/09_privilege_level/README.md index b786bf33..869c3960 100644 --- a/09_privilege_level/README.md +++ b/09_privilege_level/README.md @@ -177,27 +177,40 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 13 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 +[MP] ⏩ Pushing 14 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 0.637617] Booting on: Raspberry Pi 3 -[ 0.638737] Current privilege level: EL1 -[ 0.640645] Exception handling state: -[ 0.642424] Debug: Masked -[ 0.643986] SError: Masked -[ 0.645548] IRQ: Masked -[ 0.647110] FIQ: Masked -[ 0.648672] Architectural timer resolution: 52 ns -[ 0.650971] Drivers loaded: -[ 0.652316] 1. BCM GPIO -[ 0.653748] 2. BCM PL011 UART -[ 0.655440] Timer test, spinning for 1 second -[ 1.657567] Echoing input now +[ 0.165757] mingo version 0.9.0 +[ 0.165957] Booting on: Raspberry Pi 3 +[ 0.166412] Current privilege level: EL1 +[ 0.166888] Exception handling state: +[ 0.167333] Debug: Masked +[ 0.167723] SError: Masked +[ 0.168112] IRQ: Masked +[ 0.168502] FIQ: Masked +[ 0.168893] Architectural timer resolution: 52 ns +[ 0.169467] Drivers loaded: +[ 0.169803] 1. BCM GPIO +[ 0.170160] 2. BCM PL011 UART +[ 0.170583] Timer test, spinning for 1 second +[ 1.171115] Echoing input now ``` ## Diff to previous ```diff +diff -uNr 08_hw_debug_JTAG/Cargo.toml 09_privilege_level/Cargo.toml +--- 08_hw_debug_JTAG/Cargo.toml ++++ 09_privilege_level/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.8.0" ++version = "0.9.0" + authors = ["Andre Richter "] + edition = "2018" + + 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 @@ -494,7 +507,7 @@ diff -uNr 08_hw_debug_JTAG/src/main.rs 09_privilege_level/src/main.rs mod memory; mod panic_wait; mod print; -@@ -149,12 +150,20 @@ +@@ -149,6 +150,8 @@ /// The main function running after the early init. fn kernel_main() -> ! { @@ -503,7 +516,8 @@ 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; - +@@ -160,6 +163,12 @@ + ); info!("Booting on: {}", bsp::board_name()); + let (_, privilege_level) = exception::current_privilege_level(); @@ -515,7 +529,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() -@@ -169,11 +178,15 @@ +@@ -174,11 +183,15 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/09_privilege_level/src/main.rs b/09_privilege_level/src/main.rs index 0c3a0648..83d96ca8 100644 --- a/09_privilege_level/src/main.rs +++ b/09_privilege_level/src/main.rs @@ -156,6 +156,11 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use time::interface::TimeManager; + info!( + "{} version {}", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION") + ); info!("Booting on: {}", bsp::board_name()); let (_, privilege_level) = exception::current_privilege_level(); diff --git a/10_virtual_mem_part1_identity_mapping/Cargo.lock b/10_virtual_mem_part1_identity_mapping/Cargo.lock index a3d8bb9a..5022ffad 100644 --- a/10_virtual_mem_part1_identity_mapping/Cargo.lock +++ b/10_virtual_mem_part1_identity_mapping/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.10.0" dependencies = [ "cortex-a", "register", diff --git a/10_virtual_mem_part1_identity_mapping/Cargo.toml b/10_virtual_mem_part1_identity_mapping/Cargo.toml index df5f7f97..8e54f2cd 100644 --- a/10_virtual_mem_part1_identity_mapping/Cargo.toml +++ b/10_virtual_mem_part1_identity_mapping/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.10.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/10_virtual_mem_part1_identity_mapping/README.md b/10_virtual_mem_part1_identity_mapping/README.md index 3161e6b0..ba2932a4 100644 --- a/10_virtual_mem_part1_identity_mapping/README.md +++ b/10_virtual_mem_part1_identity_mapping/README.md @@ -322,32 +322,45 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 64 KiB ========================================🦀 100% 32 KiB/s Time: 00:00:02 +[MP] ⏩ Pushing 64 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 3.175017] Booting on: Raspberry Pi 3 -[ 3.176100] MMU online. Special regions: -[ 3.178009] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data -[ 3.182088] 0x1fff0000 - 0x1fffffff | 64 KiB | Dev RW PXN | Remapped Device MMIO -[ 3.186036] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO -[ 3.189594] Current privilege level: EL1 -[ 3.191502] Exception handling state: -[ 3.193281] Debug: Masked -[ 3.194843] SError: Masked -[ 3.196405] IRQ: Masked -[ 3.197967] FIQ: Masked -[ 3.199529] Architectural timer resolution: 52 ns -[ 3.201828] Drivers loaded: -[ 3.203173] 1. BCM GPIO -[ 3.204605] 2. BCM PL011 UART -[ 3.206297] Timer test, spinning for 1 second +[ 1.034062] mingo version 0.10.0 +[ 1.034270] Booting on: Raspberry Pi 3 +[ 1.034725] MMU online. Special regions: +[ 1.035201] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data +[ 1.036220] 0x1fff0000 - 0x1fffffff | 64 KiB | Dev RW PXN | Remapped Device MMIO +[ 1.037205] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO +[ 1.038094] Current privilege level: EL1 +[ 1.038570] Exception handling state: +[ 1.039015] Debug: Masked +[ 1.039405] SError: Masked +[ 1.039794] IRQ: Masked +[ 1.040184] FIQ: Masked +[ 1.040575] Architectural timer resolution: 52 ns +[ 1.041148] Drivers loaded: +[ 1.041484] 1. BCM GPIO +[ 1.041842] 2. BCM PL011 UART +[ 1.042264] Timer test, spinning for 1 second [ !!! ] Writing through the remapped UART at 0x1FFF_1000 -[ 4.210458] Echoing input now +[ 2.043305] Echoing input now ``` ## Diff to previous ```diff +diff -uNr 09_privilege_level/Cargo.toml 10_virtual_mem_part1_identity_mapping/Cargo.toml +--- 09_privilege_level/Cargo.toml ++++ 10_virtual_mem_part1_identity_mapping/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.9.0" ++version = "0.10.0" + authors = ["Andre Richter "] + edition = "2018" + + diff -uNr 09_privilege_level/src/_arch/aarch64/memory/mmu/translation_table.rs 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/memory/mmu/translation_table.rs --- 09_privilege_level/src/_arch/aarch64/memory/mmu/translation_table.rs +++ 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/memory/mmu/translation_table.rs @@ -1058,8 +1071,8 @@ 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() { -@@ -158,6 +170,9 @@ - +@@ -163,6 +175,9 @@ + ); info!("Booting on: {}", bsp::board_name()); + info!("MMU online. Special regions:"); @@ -1068,7 +1081,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); -@@ -181,6 +196,13 @@ +@@ -186,6 +201,13 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/10_virtual_mem_part1_identity_mapping/src/main.rs b/10_virtual_mem_part1_identity_mapping/src/main.rs index 8ce5d3d9..74d49754 100644 --- a/10_virtual_mem_part1_identity_mapping/src/main.rs +++ b/10_virtual_mem_part1_identity_mapping/src/main.rs @@ -168,6 +168,11 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use time::interface::TimeManager; + info!( + "{} version {}", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION") + ); info!("Booting on: {}", bsp::board_name()); info!("MMU online. Special regions:"); diff --git a/11_exceptions_part1_groundwork/Cargo.lock b/11_exceptions_part1_groundwork/Cargo.lock index a3d8bb9a..c956c58c 100644 --- a/11_exceptions_part1_groundwork/Cargo.lock +++ b/11_exceptions_part1_groundwork/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.11.0" dependencies = [ "cortex-a", "register", diff --git a/11_exceptions_part1_groundwork/Cargo.toml b/11_exceptions_part1_groundwork/Cargo.toml index df5f7f97..764939bf 100644 --- a/11_exceptions_part1_groundwork/Cargo.toml +++ b/11_exceptions_part1_groundwork/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.11.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/11_exceptions_part1_groundwork/README.md b/11_exceptions_part1_groundwork/README.md index 878ea436..f9c70824 100644 --- a/11_exceptions_part1_groundwork/README.md +++ b/11_exceptions_part1_groundwork/README.md @@ -406,32 +406,33 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 64 KiB ========================================🦀 100% 32 KiB/s Time: 00:00:02 +[MP] ⏩ Pushing 64 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 3.091032] Booting on: Raspberry Pi 3 -[ 3.092116] MMU online. Special regions: -[ 3.094025] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data -[ 3.098103] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO -[ 3.101661] Current privilege level: EL1 -[ 3.103570] Exception handling state: -[ 3.105348] Debug: Masked -[ 3.106910] SError: Masked -[ 3.108472] IRQ: Masked -[ 3.110034] FIQ: Masked -[ 3.111596] Architectural timer resolution: 52 ns -[ 3.113895] Drivers loaded: -[ 3.115240] 1. BCM GPIO -[ 3.116672] 2. BCM PL011 UART -[ 3.118364] Timer test, spinning for 1 second -[ 4.120490] -[ 4.120494] Trying to read from address 8 GiB... -[ 4.122700] ************************************************ -[ 4.125476] Whoa! We recovered from a synchronous exception! -[ 4.128253] ************************************************ -[ 4.131030] -[ 4.131724] Let's try again -[ 4.133069] Trying to read from address 9 GiB... +[ 0.980247] mingo version 0.11.0 +[ 0.980454] Booting on: Raspberry Pi 3 +[ 0.980909] MMU online. Special regions: +[ 0.981386] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data +[ 0.982404] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO +[ 0.983293] Current privilege level: EL1 +[ 0.983769] Exception handling state: +[ 0.984213] Debug: Masked +[ 0.984604] SError: Masked +[ 0.984993] IRQ: Masked +[ 0.985383] FIQ: Masked +[ 0.985773] Architectural timer resolution: 52 ns +[ 0.986347] Drivers loaded: +[ 0.986684] 1. BCM GPIO +[ 0.987041] 2. BCM PL011 UART +[ 0.987463] Timer test, spinning for 1 second +[ 1.987994] +[ 1.987998] Trying to read from address 8 GiB... +[ 1.988547] ************************************************ +[ 1.989240] Whoa! We recovered from a synchronous exception! +[ 1.989933] ************************************************ +[ 1.990627] +[ 1.990800] Let's try again +[ 1.991136] Trying to read from address 9 GiB... Kernel panic: @@ -440,7 +441,7 @@ FAR_EL1: 0x0000000240000000 ESR_EL1: 0x96000004 Exception Class (EC) : 0x25 - Data Abort, current EL Instr Specific Syndrome (ISS): 0x4 -ELR_EL1: 0x0000000000081458 +ELR_EL1: 0x0000000000082578 SPSR_EL1: 0x600003c5 Flags: Negative (N): Not set @@ -455,27 +456,39 @@ SPSR_EL1: 0x600003c5 Illegal Execution State (IL): Not set General purpose register: - x0 : 0x0000000000000000 x1 : 0x0000000000085727 - x2 : 0x0000000000000027 x3 : 0x0000000000000000 - x4 : 0x0000000000000002 x5 : 0x3f27329c00000000 - x6 : 0x0000000000000000 x7 : 0xdbd1b90800000000 + x0 : 0x0000000000000000 x1 : 0x00000000000858c7 + x2 : 0x0000000000000027 x3 : 0x0000000000084cc4 + x4 : 0x0000000000000003 x5 : 0x3f27329400000000 + x6 : 0x0000000000000000 x7 : 0xd3d0b80800000000 x8 : 0x0000000240000000 x9 : 0x000000003f201000 - x10: 0x0000000000000019 x11: 0x00000000000819d0 - x12: 0x0000000000000000 x13: 0x0000000000000033 + x10: 0x0000000000000019 x11: 0x0000000000000000 + x12: 0x0000000000000001 x13: 0x0000000000000036 x14: 0x000000000007fc2d x15: 0x0000000000000000 - x16: 0x0000000000000040 x17: 0xfd7f702255f847d0 - x18: 0x0000000000000003 x19: 0x0000000000090008 - x20: 0x0000000000085510 x21: 0x000000003b9aca00 - x22: 0x00000000000003e8 x23: 0x0000000000081610 - x24: 0x0000000000082268 x25: 0x00000000000f4240 - x26: 0xffffffffc4653600 x27: 0x00000000000855f0 - x28: 0x0000000000083f80 x29: 0x0000000000086810 - lr : 0x000000000008144c + x16: 0x0000000000000040 x17: 0xfd39702255e846c0 + x18: 0x9cd47880832f1200 x19: 0x0000000000090008 + x20: 0x00000000000856b0 x21: 0x000000003b9aca00 + x22: 0x000000000008274c x23: 0x00000000000833d8 + x24: 0x00000000000003e8 x25: 0xffffffffc4653600 + x26: 0x00000000000f4240 x27: 0x0000000000085790 + x28: 0x0000000000086a50 x29: 0x00000000000867ed + lr : 0x000000000008256c ``` ## Diff to previous ```diff +diff -uNr 10_virtual_mem_part1_identity_mapping/Cargo.toml 11_exceptions_part1_groundwork/Cargo.toml +--- 10_virtual_mem_part1_identity_mapping/Cargo.toml ++++ 11_exceptions_part1_groundwork/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.10.0" ++version = "0.11.0" + authors = ["Andre Richter "] + edition = "2018" + + diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs 11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs --- 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs +++ 11_exceptions_part1_groundwork/src/_arch/aarch64/exception.rs @@ -963,7 +976,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 @@ +@@ -201,13 +203,28 @@ info!("Timer test, spinning for 1 second"); time::time_manager().spin_for(Duration::from_secs(1)); diff --git a/11_exceptions_part1_groundwork/src/main.rs b/11_exceptions_part1_groundwork/src/main.rs index 2af372ab..a1c5bc15 100644 --- a/11_exceptions_part1_groundwork/src/main.rs +++ b/11_exceptions_part1_groundwork/src/main.rs @@ -170,6 +170,11 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use time::interface::TimeManager; + info!( + "{} version {}", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION") + ); info!("Booting on: {}", bsp::board_name()); info!("MMU online. Special regions:"); diff --git a/12_integrated_testing/Cargo.lock b/12_integrated_testing/Cargo.lock index 06955920..9dac661b 100644 --- a/12_integrated_testing/Cargo.lock +++ b/12_integrated_testing/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.12.0" dependencies = [ "cortex-a", "qemu-exit", diff --git a/12_integrated_testing/Cargo.toml b/12_integrated_testing/Cargo.toml index 06c10cf0..4bb92ff4 100644 --- a/12_integrated_testing/Cargo.toml +++ b/12_integrated_testing/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.12.0" authors = ["Andre Richter "] edition = "2018" @@ -45,6 +45,7 @@ test = true # Disable unit tests for the kernel binary. [[bin]] name = "kernel" +path = "src/main.rs" test = false # List of tests without harness. diff --git a/12_integrated_testing/README.md b/12_integrated_testing/README.md index 600efa2a..4a5940d1 100644 --- a/12_integrated_testing/README.md +++ b/12_integrated_testing/README.md @@ -738,9 +738,8 @@ Believe it or not, that is all. There are three ways you can run tests: ```console $ make test [...] -RUSTFLAGS="-C link-arg=-Tsrc/bsp/raspberrypi/link.ld -C target-cpu=cortex-a53 -D warnings -D missing_docs" cargo test --target=aarch64-unknown-none-softfloat --features bsp_rpi3 --release - Finished release [optimized] target(s) in 0.01s - Running target/aarch64-unknown-none-softfloat/release/deps/libkernel-4cc6412ddf631982 + + Running unittests (target/aarch64-unknown-none-softfloat/release/deps/libkernel-836110ac5dd535ba) ------------------------------------------------------------------- 🦀 Running 8 tests ------------------------------------------------------------------- @@ -748,9 +747,9 @@ RUSTFLAGS="-C link-arg=-Tsrc/bsp/raspberrypi/link.ld -C target-cpu=cortex-a53 -D 1. virt_mem_layout_sections_are_64KiB_aligned................[ok] 2. virt_mem_layout_has_no_overlaps...........................[ok] 3. test_runner_executes_in_kernel_mode.......................[ok] - 4. size_of_tabledescriptor_equals_64_bit.....................[ok] - 5. size_of_pagedescriptor_equals_64_bit......................[ok] - 6. kernel_tables_in_bss......................................[ok] + 4. kernel_tables_in_bss......................................[ok] + 5. size_of_tabledescriptor_equals_64_bit.....................[ok] + 6. size_of_pagedescriptor_equals_64_bit......................[ok] 7. zero_volatile_works.......................................[ok] 8. bss_section_is_sane.......................................[ok] @@ -759,7 +758,7 @@ RUSTFLAGS="-C link-arg=-Tsrc/bsp/raspberrypi/link.ld -C target-cpu=cortex-a53 -D ------------------------------------------------------------------- - Running target/aarch64-unknown-none-softfloat/release/deps/00_console_sanity-557819b436f15a18 + Running tests/00_console_sanity.rs (target/aarch64-unknown-none-softfloat/release/deps/00_console_sanity-78c12c5472d40df7) ------------------------------------------------------------------- 🦀 Running 3 console-based tests ------------------------------------------------------------------- @@ -773,7 +772,7 @@ RUSTFLAGS="-C link-arg=-Tsrc/bsp/raspberrypi/link.ld -C target-cpu=cortex-a53 -D ------------------------------------------------------------------- - Running target/aarch64-unknown-none-softfloat/release/deps/01_timer_sanity-1e25e7d559a9009f + Running tests/01_timer_sanity.rs (target/aarch64-unknown-none-softfloat/release/deps/01_timer_sanity-4866734b14c83c9b) ------------------------------------------------------------------- 🦀 Running 3 tests ------------------------------------------------------------------- @@ -787,7 +786,7 @@ RUSTFLAGS="-C link-arg=-Tsrc/bsp/raspberrypi/link.ld -C target-cpu=cortex-a53 -D ------------------------------------------------------------------- - Running target/aarch64-unknown-none-softfloat/release/deps/02_exception_sync_page_fault-14172ce39b3fae1c + Running tests/02_exception_sync_page_fault.rs (target/aarch64-unknown-none-softfloat/release/deps/02_exception_sync_page_fault-f2d0885cada1105b) ------------------------------------------------------------------- 🦀 Testing synchronous exception handling by causing a page fault ------------------------------------------------------------------- @@ -819,7 +818,11 @@ diff -uNr 11_exceptions_part1_groundwork/.cargo/config.toml 12_integrated_testin diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo.toml --- 11_exceptions_part1_groundwork/Cargo.toml +++ 12_integrated_testing/Cargo.toml -@@ -4,24 +4,54 @@ +@@ -1,31 +1,58 @@ + [package] + name = "mingo" +-version = "0.11.0" ++version = "0.12.0" authors = ["Andre Richter "] edition = "2018" @@ -833,6 +836,10 @@ diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo. default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +- +-[[bin]] +-name = "kernel" +-path = "src/main.rs" +test_build = ["qemu-exit"] ##-------------------------------------------------------------------------------------------------- @@ -866,6 +873,7 @@ diff -uNr 11_exceptions_part1_groundwork/Cargo.toml 12_integrated_testing/Cargo. +# Disable unit tests for the kernel binary. +[[bin]] +name = "kernel" ++path = "src/main.rs" +test = false + +# List of tests without harness. @@ -1205,7 +1213,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,171 @@ +@@ -0,0 +1,184 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2018-2021 Andre Richter @@ -1348,6 +1356,19 @@ diff -uNr 11_exceptions_part1_groundwork/src/lib.rs 12_integrated_testing/src/li +pub mod time; + +//-------------------------------------------------------------------------------------------------- ++// Public Code ++//-------------------------------------------------------------------------------------------------- ++ ++/// Version string. ++pub fn version() -> &'static str { ++ concat!( ++ env!("CARGO_PKG_NAME"), ++ " version ", ++ env!("CARGO_PKG_VERSION") ++ ) ++} ++ ++//-------------------------------------------------------------------------------------------------- +// Testing +//-------------------------------------------------------------------------------------------------- + @@ -1522,7 +1543,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; -@@ -166,9 +49,7 @@ +@@ -166,15 +49,9 @@ fn kernel_main() -> ! { use bsp::console::console; use console::interface::All; @@ -1530,9 +1551,16 @@ diff -uNr 11_exceptions_part1_groundwork/src/main.rs 12_integrated_testing/src/m use driver::interface::DriverManager; - use time::interface::TimeManager; +- info!( +- "{} version {}", +- env!("CARGO_PKG_NAME"), +- env!("CARGO_PKG_VERSION") +- ); ++ info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); -@@ -195,31 +76,6 @@ + info!("MMU online. Special regions:"); +@@ -200,31 +77,6 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/12_integrated_testing/src/lib.rs b/12_integrated_testing/src/lib.rs index 745122f8..dc991fd1 100644 --- a/12_integrated_testing/src/lib.rs +++ b/12_integrated_testing/src/lib.rs @@ -139,6 +139,19 @@ pub mod memory; pub mod print; pub mod time; +//-------------------------------------------------------------------------------------------------- +// Public Code +//-------------------------------------------------------------------------------------------------- + +/// Version string. +pub fn version() -> &'static str { + concat!( + env!("CARGO_PKG_NAME"), + " version ", + env!("CARGO_PKG_VERSION") + ) +} + //-------------------------------------------------------------------------------------------------- // Testing //-------------------------------------------------------------------------------------------------- diff --git a/12_integrated_testing/src/main.rs b/12_integrated_testing/src/main.rs index 77c9d494..1daeb403 100644 --- a/12_integrated_testing/src/main.rs +++ b/12_integrated_testing/src/main.rs @@ -51,6 +51,7 @@ fn kernel_main() -> ! { use console::interface::All; use driver::interface::DriverManager; + info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); info!("MMU online. Special regions:"); diff --git a/13_exceptions_part2_peripheral_IRQs/Cargo.lock b/13_exceptions_part2_peripheral_IRQs/Cargo.lock index 06955920..922341af 100644 --- a/13_exceptions_part2_peripheral_IRQs/Cargo.lock +++ b/13_exceptions_part2_peripheral_IRQs/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.13.0" dependencies = [ "cortex-a", "qemu-exit", diff --git a/13_exceptions_part2_peripheral_IRQs/Cargo.toml b/13_exceptions_part2_peripheral_IRQs/Cargo.toml index 206dfc87..343bdfda 100644 --- a/13_exceptions_part2_peripheral_IRQs/Cargo.toml +++ b/13_exceptions_part2_peripheral_IRQs/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.13.0" authors = ["Andre Richter "] edition = "2018" @@ -43,6 +43,7 @@ test = true # Disable unit tests for the kernel binary. [[bin]] name = "kernel" +path = "src/main.rs" test = false # List of tests without harness. diff --git a/13_exceptions_part2_peripheral_IRQs/README.md b/13_exceptions_part2_peripheral_IRQs/README.md index 18b3cf81..4cb82c6b 100644 --- a/13_exceptions_part2_peripheral_IRQs/README.md +++ b/13_exceptions_part2_peripheral_IRQs/README.md @@ -675,28 +675,29 @@ Minipush 1.0 Raspberry Pi 3 [ML] Requesting binary -[MP] ⏩ Pushing 66 KiB ========================================🦀 100% 33 KiB/s Time: 00:00:02 +[MP] ⏩ Pushing 66 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 3.203172] Booting on: Raspberry Pi 3 -[ 3.204255] MMU online. Special regions: -[ 3.206164] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data -[ 3.210242] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO -[ 3.213800] Current privilege level: EL1 -[ 3.215709] Exception handling state: -[ 3.217487] Debug: Masked -[ 3.219049] SError: Masked -[ 3.220611] IRQ: Unmasked -[ 3.222260] FIQ: Masked -[ 3.223822] Architectural timer resolution: 52 ns -[ 3.226121] Drivers loaded: -[ 3.227466] 1. BCM GPIO -[ 3.228898] 2. BCM PL011 UART -[ 3.230590] 3. BCM Interrupt Controller -[ 3.232716] Registered IRQ handlers: -[ 3.234451] Peripheral handler: -[ 3.236232] 57. BCM PL011 UART -[ 3.238269] Echoing input now +[ 1.010579] mingo version 0.13.0 +[ 1.010787] Booting on: Raspberry Pi 3 +[ 1.011242] MMU online. Special regions: +[ 1.011718] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data +[ 1.012737] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO +[ 1.013625] Current privilege level: EL1 +[ 1.014102] Exception handling state: +[ 1.014546] Debug: Masked +[ 1.014936] SError: Masked +[ 1.015326] IRQ: Unmasked +[ 1.015738] FIQ: Masked +[ 1.016127] Architectural timer resolution: 52 ns +[ 1.016702] Drivers loaded: +[ 1.017038] 1. BCM GPIO +[ 1.017395] 2. BCM PL011 UART +[ 1.017817] 3. BCM Interrupt Controller +[ 1.018348] Registered IRQ handlers: +[ 1.018782] Peripheral handler: +[ 1.019228] 57. BCM PL011 UART +[ 1.019735] Echoing input now ``` Raspberry Pi 4: @@ -717,28 +718,29 @@ Minipush 1.0 Raspberry Pi 4 [ML] Requesting binary -[MP] ⏩ Pushing 73 KiB ========================================🦀 100% 24 KiB/s Time: 00:00:03 +[MP] ⏩ Pushing 73 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 3.486234] Booting on: Raspberry Pi 4 -[ 3.486623] MMU online. Special regions: -[ 3.488532] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data -[ 3.492610] 0xfe000000 - 0xff84ffff | 24 MiB | Dev RW PXN | Device MMIO -[ 3.496167] Current privilege level: EL1 -[ 3.498076] Exception handling state: -[ 3.499855] Debug: Masked -[ 3.501417] SError: Masked -[ 3.502979] IRQ: Unmasked -[ 3.504628] FIQ: Masked -[ 3.506189] Architectural timer resolution: 18 ns -[ 3.508489] Drivers loaded: -[ 3.509834] 1. BCM GPIO -[ 3.511266] 2. BCM PL011 UART -[ 3.512958] 3. GICv2 (ARM Generic Interrupt Controller v2) -[ 3.515908] Registered IRQ handlers: -[ 3.517643] Peripheral handler: -[ 3.519425] 153. BCM PL011 UART -[ 3.521463] Echoing input now +[ 1.030536] mingo version 0.13.0 +[ 1.030569] Booting on: Raspberry Pi 4 +[ 1.031024] MMU online. Special regions: +[ 1.031501] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data +[ 1.032519] 0xfe000000 - 0xff84ffff | 24 MiB | Dev RW PXN | Device MMIO +[ 1.033408] Current privilege level: EL1 +[ 1.033884] Exception handling state: +[ 1.034328] Debug: Masked +[ 1.034718] SError: Masked +[ 1.035108] IRQ: Unmasked +[ 1.035520] FIQ: Masked +[ 1.035910] Architectural timer resolution: 18 ns +[ 1.036484] Drivers loaded: +[ 1.036820] 1. BCM GPIO +[ 1.037178] 2. BCM PL011 UART +[ 1.037600] 3. GICv2 (ARM Generic Interrupt Controller v2) +[ 1.038337] Registered IRQ handlers: +[ 1.038770] Peripheral handler: +[ 1.039217] 153. BCM PL011 UART +[ 1.039725] Echoing input now ``` ## Diff to previous @@ -747,7 +749,11 @@ Minipush 1.0 diff -uNr 12_integrated_testing/Cargo.toml 13_exceptions_part2_peripheral_IRQs/Cargo.toml --- 12_integrated_testing/Cargo.toml +++ 13_exceptions_part2_peripheral_IRQs/Cargo.toml -@@ -4,10 +4,8 @@ +@@ -1,13 +1,11 @@ + [package] + name = "mingo" +-version = "0.12.0" ++version = "0.13.0" authors = ["Andre Richter "] edition = "2018" @@ -2444,9 +2450,9 @@ diff -uNr 12_integrated_testing/src/main.rs 13_exceptions_part2_peripheral_IRQs/ use driver::interface::DriverManager; + use exception::asynchronous::interface::IRQManager; + info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); - -@@ -76,12 +88,9 @@ +@@ -77,12 +89,9 @@ info!(" {}. {}", i + 1, driver.compatible()); } diff --git a/13_exceptions_part2_peripheral_IRQs/src/lib.rs b/13_exceptions_part2_peripheral_IRQs/src/lib.rs index c4e74460..3cc97329 100644 --- a/13_exceptions_part2_peripheral_IRQs/src/lib.rs +++ b/13_exceptions_part2_peripheral_IRQs/src/lib.rs @@ -141,6 +141,19 @@ pub mod print; pub mod state; pub mod time; +//-------------------------------------------------------------------------------------------------- +// Public Code +//-------------------------------------------------------------------------------------------------- + +/// Version string. +pub fn version() -> &'static str { + concat!( + env!("CARGO_PKG_NAME"), + " version ", + env!("CARGO_PKG_VERSION") + ) +} + //-------------------------------------------------------------------------------------------------- // Testing //-------------------------------------------------------------------------------------------------- diff --git a/13_exceptions_part2_peripheral_IRQs/src/main.rs b/13_exceptions_part2_peripheral_IRQs/src/main.rs index 6ec5a670..1dde3884 100644 --- a/13_exceptions_part2_peripheral_IRQs/src/main.rs +++ b/13_exceptions_part2_peripheral_IRQs/src/main.rs @@ -63,6 +63,7 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use exception::asynchronous::interface::IRQManager; + info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); info!("MMU online. Special regions:"); diff --git a/14_virtual_mem_part2_mmio_remap/Cargo.lock b/14_virtual_mem_part2_mmio_remap/Cargo.lock index 06955920..e1591cd4 100644 --- a/14_virtual_mem_part2_mmio_remap/Cargo.lock +++ b/14_virtual_mem_part2_mmio_remap/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.14.0" dependencies = [ "cortex-a", "qemu-exit", diff --git a/14_virtual_mem_part2_mmio_remap/Cargo.toml b/14_virtual_mem_part2_mmio_remap/Cargo.toml index 206dfc87..ad9a7815 100644 --- a/14_virtual_mem_part2_mmio_remap/Cargo.toml +++ b/14_virtual_mem_part2_mmio_remap/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.14.0" authors = ["Andre Richter "] edition = "2018" @@ -43,6 +43,7 @@ test = true # Disable unit tests for the kernel binary. [[bin]] name = "kernel" +path = "src/main.rs" test = false # List of tests without harness. diff --git a/14_virtual_mem_part2_mmio_remap/README.md b/14_virtual_mem_part2_mmio_remap/README.md index 4c1c940c..95042ed3 100644 --- a/14_virtual_mem_part2_mmio_remap/README.md +++ b/14_virtual_mem_part2_mmio_remap/README.md @@ -316,18 +316,19 @@ Minipush 1.0 [MP] ⏩ Pushing 67 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 0.789721] Booting on: Raspberry Pi 3 -[ 0.789994] MMU online: -[ 0.790286] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 0.792030] Virtual Physical Size Attr Entity -[ 0.793774] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 0.795520] 0x0000_0000_0008_0000..0x0000_0000_0008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data -[ 0.797134] 0x0000_0000_0009_0000..0x0000_0000_001b_ffff --> 0x00_0009_0000..0x00_001b_ffff | 1 MiB | C RW XN | Kernel data and bss -[ 0.798704] 0x0000_0000_001d_0000..0x0000_0000_0024_ffff --> 0x00_001d_0000..0x00_0024_ffff | 512 KiB | C RW XN | Kernel boot-core stack -[ 0.800307] 0x0000_0001_f000_0000..0x0000_0001_f000_ffff --> 0x00_3f20_0000..0x00_3f20_ffff | 64 KiB | Dev RW XN | BCM GPIO -[ 0.801759] | BCM PL011 UART -[ 0.803276] 0x0000_0001_f001_0000..0x0000_0001_f001_ffff --> 0x00_3f00_0000..0x00_3f00_ffff | 64 KiB | Dev RW XN | BCM Peripheral Interrupt Controller -[ 0.805020] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 0.785711] mingo version 0.14.0 +[ 0.785919] Booting on: Raspberry Pi 3 +[ 0.786374] MMU online: +[ 0.786666] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 0.788410] Virtual Physical Size Attr Entity +[ 0.790154] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 0.791902] 0x0000_0000_0008_0000..0x0000_0000_0008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data +[ 0.793515] 0x0000_0000_0009_0000..0x0000_0000_001b_ffff --> 0x00_0009_0000..0x00_001b_ffff | 1 MiB | C RW XN | Kernel data and bss +[ 0.795085] 0x0000_0000_001d_0000..0x0000_0000_0024_ffff --> 0x00_001d_0000..0x00_0024_ffff | 512 KiB | C RW XN | Kernel boot-core stack +[ 0.796688] 0x0000_0001_f000_0000..0x0000_0001_f000_ffff --> 0x00_3f20_0000..0x00_3f20_ffff | 64 KiB | Dev RW XN | BCM GPIO +[ 0.798139] | BCM PL011 UART +[ 0.799657] 0x0000_0001_f001_0000..0x0000_0001_f001_ffff --> 0x00_3f00_0000..0x00_3f00_ffff | 64 KiB | Dev RW XN | BCM Peripheral Interrupt Controller +[ 0.801400] ------------------------------------------------------------------------------------------------------------------------------------------- ``` Raspberry Pi 4: @@ -351,24 +352,37 @@ Minipush 1.0 [MP] ⏩ Pushing 74 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [ML] Loaded! Executing the payload now -[ 0.870371] Booting on: Raspberry Pi 4 -[ 0.870470] MMU online: -[ 0.870763] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 0.872507] Virtual Physical Size Attr Entity -[ 0.874251] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 0.875996] 0x0000_0000_0008_0000..0x0000_0000_0008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data -[ 0.877611] 0x0000_0000_0009_0000..0x0000_0000_001b_ffff --> 0x00_0009_0000..0x00_001b_ffff | 1 MiB | C RW XN | Kernel data and bss -[ 0.879181] 0x0000_0000_001d_0000..0x0000_0000_0024_ffff --> 0x00_001d_0000..0x00_0024_ffff | 512 KiB | C RW XN | Kernel boot-core stack -[ 0.880784] 0x0000_0001_f000_0000..0x0000_0001_f000_ffff --> 0x00_fe20_0000..0x00_fe20_ffff | 64 KiB | Dev RW XN | BCM GPIO -[ 0.882235] | BCM PL011 UART -[ 0.883752] 0x0000_0001_f001_0000..0x0000_0001_f001_ffff --> 0x00_ff84_0000..0x00_ff84_ffff | 64 KiB | Dev RW XN | GICD -[ 0.885160] | GICC -[ 0.886569] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 0.869392] mingo version 0.14.0 +[ 0.869425] Booting on: Raspberry Pi 4 +[ 0.869880] MMU online: +[ 0.870173] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 0.871917] Virtual Physical Size Attr Entity +[ 0.873661] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 0.875407] 0x0000_0000_0008_0000..0x0000_0000_0008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data +[ 0.877021] 0x0000_0000_0009_0000..0x0000_0000_001b_ffff --> 0x00_0009_0000..0x00_001b_ffff | 1 MiB | C RW XN | Kernel data and bss +[ 0.878591] 0x0000_0000_001d_0000..0x0000_0000_0024_ffff --> 0x00_001d_0000..0x00_0024_ffff | 512 KiB | C RW XN | Kernel boot-core stack +[ 0.880195] 0x0000_0001_f000_0000..0x0000_0001_f000_ffff --> 0x00_fe20_0000..0x00_fe20_ffff | 64 KiB | Dev RW XN | BCM GPIO +[ 0.881645] | BCM PL011 UART +[ 0.883163] 0x0000_0001_f001_0000..0x0000_0001_f001_ffff --> 0x00_ff84_0000..0x00_ff84_ffff | 64 KiB | Dev RW XN | GICD +[ 0.884570] | GICC +[ 0.885979] ------------------------------------------------------------------------------------------------------------------------------------------- ``` ## Diff to previous ```diff +diff -uNr 13_exceptions_part2_peripheral_IRQs/Cargo.toml 14_virtual_mem_part2_mmio_remap/Cargo.toml +--- 13_exceptions_part2_peripheral_IRQs/Cargo.toml ++++ 14_virtual_mem_part2_mmio_remap/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.13.0" ++version = "0.14.0" + authors = ["Andre Richter "] + edition = "2018" + + diff -uNr 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs --- 13_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/exception.rs +++ 14_virtual_mem_part2_mmio_remap/src/_arch/aarch64/exception.rs @@ -2184,8 +2198,8 @@ diff -uNr 13_exceptions_part2_peripheral_IRQs/src/main.rs 14_virtual_mem_part2_m // Let device drivers register and enable their handlers with the interrupt controller. for i in bsp::driver::driver_manager().all_device_drivers() { -@@ -65,8 +83,8 @@ - +@@ -66,8 +84,8 @@ + info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); - info!("MMU online. Special regions:"); diff --git a/14_virtual_mem_part2_mmio_remap/src/lib.rs b/14_virtual_mem_part2_mmio_remap/src/lib.rs index 3346134a..afa49506 100644 --- a/14_virtual_mem_part2_mmio_remap/src/lib.rs +++ b/14_virtual_mem_part2_mmio_remap/src/lib.rs @@ -144,6 +144,19 @@ pub mod print; pub mod state; pub mod time; +//-------------------------------------------------------------------------------------------------- +// Public Code +//-------------------------------------------------------------------------------------------------- + +/// Version string. +pub fn version() -> &'static str { + concat!( + env!("CARGO_PKG_NAME"), + " version ", + env!("CARGO_PKG_VERSION") + ) +} + //-------------------------------------------------------------------------------------------------- // Testing //-------------------------------------------------------------------------------------------------- diff --git a/14_virtual_mem_part2_mmio_remap/src/main.rs b/14_virtual_mem_part2_mmio_remap/src/main.rs index 0dd1c28d..3052db66 100644 --- a/14_virtual_mem_part2_mmio_remap/src/main.rs +++ b/14_virtual_mem_part2_mmio_remap/src/main.rs @@ -81,6 +81,7 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use exception::asynchronous::interface::IRQManager; + info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); info!("MMU online:"); diff --git a/15_virtual_mem_part3_precomputed_tables/Cargo.lock b/15_virtual_mem_part3_precomputed_tables/Cargo.lock index 06955920..62c78322 100644 --- a/15_virtual_mem_part3_precomputed_tables/Cargo.lock +++ b/15_virtual_mem_part3_precomputed_tables/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.15.0" dependencies = [ "cortex-a", "qemu-exit", diff --git a/15_virtual_mem_part3_precomputed_tables/Cargo.toml b/15_virtual_mem_part3_precomputed_tables/Cargo.toml index 206dfc87..4449da65 100644 --- a/15_virtual_mem_part3_precomputed_tables/Cargo.toml +++ b/15_virtual_mem_part3_precomputed_tables/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.15.0" authors = ["Andre Richter "] edition = "2018" @@ -43,6 +43,7 @@ test = true # Disable unit tests for the kernel binary. [[bin]] name = "kernel" +path = "src/main.rs" test = false # List of tests without harness. diff --git a/15_virtual_mem_part3_precomputed_tables/README.md b/15_virtual_mem_part3_precomputed_tables/README.md index 5329426a..459b65d2 100644 --- a/15_virtual_mem_part3_precomputed_tables/README.md +++ b/15_virtual_mem_part3_precomputed_tables/README.md @@ -743,23 +743,36 @@ Minipush 1.0 [MP] ⏩ Pushing 387 KiB =======================================🦀 100% 96 KiB/s Time: 00:00:04 [ML] Loaded! Executing the payload now -[ 4.319874] Booting on: Raspberry Pi 3 -[ 4.320147] MMU online: -[ 4.320439] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 4.322183] Virtual Physical Size Attr Entity -[ 4.323927] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 4.325674] 0x0000_0000_0008_0000..0x0000_0000_0008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data -[ 4.327288] 0x0000_0000_0009_0000..0x0000_0000_000e_ffff --> 0x00_0009_0000..0x00_000e_ffff | 384 KiB | C RW XN | Kernel data and bss -[ 4.328858] 0x0000_0000_0010_0000..0x0000_0000_0017_ffff --> 0x00_0010_0000..0x00_0017_ffff | 512 KiB | C RW XN | Kernel boot-core stack -[ 4.330461] 0x0000_0000_7000_0000..0x0000_0000_7000_ffff --> 0x00_3f20_0000..0x00_3f20_ffff | 64 KiB | Dev RW XN | BCM GPIO -[ 4.331912] | BCM PL011 UART -[ 4.333430] 0x0000_0000_7001_0000..0x0000_0000_7001_ffff --> 0x00_3f00_0000..0x00_3f00_ffff | 64 KiB | Dev RW XN | BCM Peripheral Interrupt Controller -[ 4.335173] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 4.324361] mingo version 0.15.0 +[ 4.324568] Booting on: Raspberry Pi 3 +[ 4.325023] MMU online: +[ 4.325316] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 4.327060] Virtual Physical Size Attr Entity +[ 4.328804] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 4.330551] 0x0000_0000_0008_0000..0x0000_0000_0008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data +[ 4.332164] 0x0000_0000_0009_0000..0x0000_0000_000e_ffff --> 0x00_0009_0000..0x00_000e_ffff | 384 KiB | C RW XN | Kernel data and bss +[ 4.333735] 0x0000_0000_0010_0000..0x0000_0000_0017_ffff --> 0x00_0010_0000..0x00_0017_ffff | 512 KiB | C RW XN | Kernel boot-core stack +[ 4.335338] 0x0000_0000_7000_0000..0x0000_0000_7000_ffff --> 0x00_3f20_0000..0x00_3f20_ffff | 64 KiB | Dev RW XN | BCM GPIO +[ 4.336788] | BCM PL011 UART +[ 4.338306] 0x0000_0000_7001_0000..0x0000_0000_7001_ffff --> 0x00_3f00_0000..0x00_3f00_ffff | 64 KiB | Dev RW XN | BCM Peripheral Interrupt Controller +[ 4.340050] ------------------------------------------------------------------------------------------------------------------------------------------- ``` ## Diff to previous ```diff +diff -uNr 14_virtual_mem_part2_mmio_remap/Cargo.toml 15_virtual_mem_part3_precomputed_tables/Cargo.toml +--- 14_virtual_mem_part2_mmio_remap/Cargo.toml ++++ 15_virtual_mem_part3_precomputed_tables/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.14.0" ++version = "0.15.0" + authors = ["Andre Richter "] + edition = "2018" + + diff -uNr 14_virtual_mem_part2_mmio_remap/Makefile 15_virtual_mem_part3_precomputed_tables/Makefile --- 14_virtual_mem_part2_mmio_remap/Makefile +++ 15_virtual_mem_part3_precomputed_tables/Makefile diff --git a/15_virtual_mem_part3_precomputed_tables/src/lib.rs b/15_virtual_mem_part3_precomputed_tables/src/lib.rs index 3346134a..afa49506 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/lib.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/lib.rs @@ -144,6 +144,19 @@ pub mod print; pub mod state; pub mod time; +//-------------------------------------------------------------------------------------------------- +// Public Code +//-------------------------------------------------------------------------------------------------- + +/// Version string. +pub fn version() -> &'static str { + concat!( + env!("CARGO_PKG_NAME"), + " version ", + env!("CARGO_PKG_VERSION") + ) +} + //-------------------------------------------------------------------------------------------------- // Testing //-------------------------------------------------------------------------------------------------- diff --git a/15_virtual_mem_part3_precomputed_tables/src/main.rs b/15_virtual_mem_part3_precomputed_tables/src/main.rs index c317bb96..421dcbec 100644 --- a/15_virtual_mem_part3_precomputed_tables/src/main.rs +++ b/15_virtual_mem_part3_precomputed_tables/src/main.rs @@ -72,6 +72,7 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use exception::asynchronous::interface::IRQManager; + info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); info!("MMU online:"); diff --git a/16_virtual_mem_part4_higher_half_kernel/Cargo.lock b/16_virtual_mem_part4_higher_half_kernel/Cargo.lock index 06955920..ba2e9eb5 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Cargo.lock +++ b/16_virtual_mem_part4_higher_half_kernel/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.16.0" dependencies = [ "cortex-a", "qemu-exit", diff --git a/16_virtual_mem_part4_higher_half_kernel/Cargo.toml b/16_virtual_mem_part4_higher_half_kernel/Cargo.toml index 206dfc87..f7147ecd 100644 --- a/16_virtual_mem_part4_higher_half_kernel/Cargo.toml +++ b/16_virtual_mem_part4_higher_half_kernel/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.16.0" authors = ["Andre Richter "] edition = "2018" @@ -43,6 +43,7 @@ test = true # Disable unit tests for the kernel binary. [[bin]] name = "kernel" +path = "src/main.rs" test = false # List of tests without harness. diff --git a/16_virtual_mem_part4_higher_half_kernel/README.md b/16_virtual_mem_part4_higher_half_kernel/README.md index ddce63fc..4f701442 100644 --- a/16_virtual_mem_part4_higher_half_kernel/README.md +++ b/16_virtual_mem_part4_higher_half_kernel/README.md @@ -163,18 +163,19 @@ Minipush 1.0 [MP] ⏩ Pushing 387 KiB =======================================🦀 100% 96 KiB/s Time: 00:00:04 [ML] Loaded! Executing the payload now -[ 4.320829] Booting on: Raspberry Pi 3 -[ 4.321102] MMU online: -[ 4.321394] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 4.323138] Virtual Physical Size Attr Entity -[ 4.324882] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 4.326629] 0xffff_ffff_8008_0000..0xffff_ffff_8008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data -[ 4.328243] 0xffff_ffff_8009_0000..0xffff_ffff_800e_ffff --> 0x00_0009_0000..0x00_000e_ffff | 384 KiB | C RW XN | Kernel data and bss -[ 4.329813] 0xffff_ffff_8010_0000..0xffff_ffff_8017_ffff --> 0x00_0010_0000..0x00_0017_ffff | 512 KiB | C RW XN | Kernel boot-core stack -[ 4.331416] 0xffff_ffff_f000_0000..0xffff_ffff_f000_ffff --> 0x00_3f20_0000..0x00_3f20_ffff | 64 KiB | Dev RW XN | BCM GPIO -[ 4.332867] | BCM PL011 UART -[ 4.334385] 0xffff_ffff_f001_0000..0xffff_ffff_f001_ffff --> 0x00_3f00_0000..0x00_3f00_ffff | 64 KiB | Dev RW XN | BCM Peripheral Interrupt Controller -[ 4.336128] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 4.316420] mingo version 0.16.0 +[ 4.316627] Booting on: Raspberry Pi 3 +[ 4.317082] MMU online: +[ 4.317375] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 4.319119] Virtual Physical Size Attr Entity +[ 4.320863] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 4.322610] 0xffff_ffff_8008_0000..0xffff_ffff_8008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data +[ 4.324223] 0xffff_ffff_8009_0000..0xffff_ffff_800e_ffff --> 0x00_0009_0000..0x00_000e_ffff | 384 KiB | C RW XN | Kernel data and bss +[ 4.325793] 0xffff_ffff_8010_0000..0xffff_ffff_8017_ffff --> 0x00_0010_0000..0x00_0017_ffff | 512 KiB | C RW XN | Kernel boot-core stack +[ 4.327397] 0xffff_ffff_f000_0000..0xffff_ffff_f000_ffff --> 0x00_3f20_0000..0x00_3f20_ffff | 64 KiB | Dev RW XN | BCM GPIO +[ 4.328847] | BCM PL011 UART +[ 4.330365] 0xffff_ffff_f001_0000..0xffff_ffff_f001_ffff --> 0x00_3f00_0000..0x00_3f00_ffff | 64 KiB | Dev RW XN | BCM Peripheral Interrupt Controller +[ 4.332108] ------------------------------------------------------------------------------------------------------------------------------------------- ``` Raspberry Pi 4: @@ -211,24 +212,37 @@ Minipush 1.0 [MP] ⏩ Pushing 449 KiB ======================================🦀 100% 112 KiB/s Time: 00:00:04 [ML] Loaded! Executing the payload now -[ 5.011490] Booting on: Raspberry Pi 4 -[ 5.011588] MMU online: -[ 5.011881] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 5.013625] Virtual Physical Size Attr Entity -[ 5.015369] ------------------------------------------------------------------------------------------------------------------------------------------- -[ 5.017115] 0xffff_ffff_8008_0000..0xffff_ffff_8008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data -[ 5.018730] 0xffff_ffff_8009_0000..0xffff_ffff_800f_ffff --> 0x00_0009_0000..0x00_000f_ffff | 448 KiB | C RW XN | Kernel data and bss -[ 5.020299] 0xffff_ffff_8011_0000..0xffff_ffff_8018_ffff --> 0x00_0011_0000..0x00_0018_ffff | 512 KiB | C RW XN | Kernel boot-core stack -[ 5.021903] 0xffff_ffff_f000_0000..0xffff_ffff_f000_ffff --> 0x00_fe20_0000..0x00_fe20_ffff | 64 KiB | Dev RW XN | BCM GPIO -[ 5.023354] | BCM PL011 UART -[ 5.024871] 0xffff_ffff_f001_0000..0xffff_ffff_f001_ffff --> 0x00_ff84_0000..0x00_ff84_ffff | 64 KiB | Dev RW XN | GICD -[ 5.026279] | GICC -[ 5.027687] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 5.009551] mingo version 0.16.0 +[ 5.009585] Booting on: Raspberry Pi 4 +[ 5.010040] MMU online: +[ 5.010332] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 5.012077] Virtual Physical Size Attr Entity +[ 5.013821] ------------------------------------------------------------------------------------------------------------------------------------------- +[ 5.015566] 0xffff_ffff_8008_0000..0xffff_ffff_8008_ffff --> 0x00_0008_0000..0x00_0008_ffff | 64 KiB | C RO X | Kernel code and RO data +[ 5.017181] 0xffff_ffff_8009_0000..0xffff_ffff_800f_ffff --> 0x00_0009_0000..0x00_000f_ffff | 448 KiB | C RW XN | Kernel data and bss +[ 5.018751] 0xffff_ffff_8011_0000..0xffff_ffff_8018_ffff --> 0x00_0011_0000..0x00_0018_ffff | 512 KiB | C RW XN | Kernel boot-core stack +[ 5.020354] 0xffff_ffff_f000_0000..0xffff_ffff_f000_ffff --> 0x00_fe20_0000..0x00_fe20_ffff | 64 KiB | Dev RW XN | BCM GPIO +[ 5.021805] | BCM PL011 UART +[ 5.023322] 0xffff_ffff_f001_0000..0xffff_ffff_f001_ffff --> 0x00_ff84_0000..0x00_ff84_ffff | 64 KiB | Dev RW XN | GICD +[ 5.024730] | GICC +[ 5.026138] ------------------------------------------------------------------------------------------------------------------------------------------- ``` ## Diff to previous ```diff +diff -uNr 15_virtual_mem_part3_precomputed_tables/Cargo.toml 16_virtual_mem_part4_higher_half_kernel/Cargo.toml +--- 15_virtual_mem_part3_precomputed_tables/Cargo.toml ++++ 16_virtual_mem_part4_higher_half_kernel/Cargo.toml +@@ -1,6 +1,6 @@ + [package] + name = "mingo" +-version = "0.15.0" ++version = "0.16.0" + authors = ["Andre Richter "] + edition = "2018" + + 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 diff --git a/16_virtual_mem_part4_higher_half_kernel/src/lib.rs b/16_virtual_mem_part4_higher_half_kernel/src/lib.rs index 3346134a..afa49506 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/lib.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/lib.rs @@ -144,6 +144,19 @@ pub mod print; pub mod state; pub mod time; +//-------------------------------------------------------------------------------------------------- +// Public Code +//-------------------------------------------------------------------------------------------------- + +/// Version string. +pub fn version() -> &'static str { + concat!( + env!("CARGO_PKG_NAME"), + " version ", + env!("CARGO_PKG_VERSION") + ) +} + //-------------------------------------------------------------------------------------------------- // Testing //-------------------------------------------------------------------------------------------------- diff --git a/16_virtual_mem_part4_higher_half_kernel/src/main.rs b/16_virtual_mem_part4_higher_half_kernel/src/main.rs index c317bb96..421dcbec 100644 --- a/16_virtual_mem_part4_higher_half_kernel/src/main.rs +++ b/16_virtual_mem_part4_higher_half_kernel/src/main.rs @@ -72,6 +72,7 @@ fn kernel_main() -> ! { use driver::interface::DriverManager; use exception::asynchronous::interface::IRQManager; + info!("{}", libkernel::version()); info!("Booting on: {}", bsp::board_name()); info!("MMU online:"); diff --git a/X1_JTAG_boot/Cargo.lock b/X1_JTAG_boot/Cargo.lock index a3d8bb9a..011adc0f 100644 --- a/X1_JTAG_boot/Cargo.lock +++ b/X1_JTAG_boot/Cargo.lock @@ -12,8 +12,8 @@ dependencies = [ ] [[package]] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.8.0" dependencies = [ "cortex-a", "register", diff --git a/X1_JTAG_boot/Cargo.toml b/X1_JTAG_boot/Cargo.toml index df5f7f97..e84540ca 100644 --- a/X1_JTAG_boot/Cargo.toml +++ b/X1_JTAG_boot/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "kernel" -version = "0.1.0" +name = "mingo" +version = "0.8.0" authors = ["Andre Richter "] edition = "2018" @@ -12,6 +12,10 @@ default = [] bsp_rpi3 = ["register"] bsp_rpi4 = ["register"] +[[bin]] +name = "kernel" +path = "src/main.rs" + ##-------------------------------------------------------------------------------------------------- ## Dependencies ##-------------------------------------------------------------------------------------------------- diff --git a/X1_JTAG_boot/jtag_boot_rpi3.img b/X1_JTAG_boot/jtag_boot_rpi3.img index 53be6bb3..30ce719c 100755 Binary files a/X1_JTAG_boot/jtag_boot_rpi3.img and b/X1_JTAG_boot/jtag_boot_rpi3.img differ