Update dependencies

register-rs 1.0.0 now uses UnsafeCell internally, which means we lost the Copy
derive on InMemoryRegister.

Therefore, a small set of changes was needed in the MMU driver to dance around
the static array init depending on a Copy type.
pull/88/head
Andre Richter 4 years ago
parent 537f8b0386
commit 2c3f705051
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -18,15 +18,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -18,5 +18,5 @@ bsp_rpi4 = []
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -20,7 +20,7 @@ diff -uNr 03_hacky_hello_world/Cargo.toml 04_zero_overhead_abstraction/Cargo.tom
+ +
+# Platform specific dependencies +# Platform specific dependencies
+[target.'cfg(target_arch = "aarch64")'.dependencies] +[target.'cfg(target_arch = "aarch64")'.dependencies]
+cortex-a = { version = "4.x.x" } +cortex-a = { version = "5.x.x" }
+ +
diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu/smp.rs 04_zero_overhead_abstraction/src/_arch/aarch64/cpu/smp.rs diff -uNr 03_hacky_hello_world/src/_arch/aarch64/cpu/smp.rs 04_zero_overhead_abstraction/src/_arch/aarch64/cpu/smp.rs

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -18,15 +18,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -18,5 +18,5 @@ bsp_rpi4 = []
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -19,15 +19,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -17,9 +17,9 @@ bsp_rpi4 = ["register"]
[dependencies] [dependencies]
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", optional = true } register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -121,11 +121,11 @@ diff -uNr 05_safe_globals/Cargo.toml 06_drivers_gpio_uart/Cargo.toml
[dependencies] [dependencies]
+# Optional dependencies +# Optional dependencies
+register = { version = "0.5.x", optional = true } +register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }
diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile diff -uNr 05_safe_globals/Makefile 06_drivers_gpio_uart/Makefile
--- 05_safe_globals/Makefile --- 05_safe_globals/Makefile

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -19,15 +19,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -17,9 +17,9 @@ bsp_rpi4 = ["register"]
[dependencies] [dependencies]
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", optional = true } register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -19,15 +19,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -17,9 +17,9 @@ bsp_rpi4 = ["register"]
[dependencies] [dependencies]
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", optional = true } register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -19,15 +19,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -17,9 +17,9 @@ bsp_rpi4 = ["register"]
[dependencies] [dependencies]
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", optional = true } register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -19,15 +19,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -17,9 +17,9 @@ bsp_rpi4 = ["register"]
[dependencies] [dependencies]
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", optional = true } register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -19,15 +19,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -17,9 +17,9 @@ bsp_rpi4 = ["register"]
[dependencies] [dependencies]
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", optional = true } register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -394,14 +394,14 @@ diff -uNr 10_privilege_level/src/_arch/aarch64/memory/mmu.rs 11_virtual_mem_part
+/// The output points to the next table. +/// The output points to the next table.
+#[derive(Copy, Clone)] +#[derive(Copy, Clone)]
+#[repr(transparent)] +#[repr(transparent)]
+struct TableDescriptor(InMemoryRegister<u64, STAGE1_TABLE_DESCRIPTOR::Register>); +struct TableDescriptor(u64);
+ +
+/// A page descriptor with 64 KiB aperture. +/// A page descriptor with 64 KiB aperture.
+/// +///
+/// The output points to physical memory. +/// The output points to physical memory.
+#[derive(Copy, Clone)] +#[derive(Copy, Clone)]
+#[repr(transparent)] +#[repr(transparent)]
+struct PageDescriptor(InMemoryRegister<u64, STAGE1_PAGE_DESCRIPTOR::Register>); +struct PageDescriptor(u64);
+ +
+/// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB +/// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB
+/// aligned, hence the "reverse" order of appearance. +/// aligned, hence the "reverse" order of appearance.
@ -472,7 +472,7 @@ diff -uNr 10_privilege_level/src/_arch/aarch64/memory/mmu.rs 11_virtual_mem_part
+ + STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64), + + STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64),
+ ); + );
+ +
+ TableDescriptor(val) + TableDescriptor(val.get())
+ } + }
+} +}
+ +
@ -524,7 +524,7 @@ diff -uNr 10_privilege_level/src/_arch/aarch64/memory/mmu.rs 11_virtual_mem_part
+ + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted), + + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted),
+ ); + );
+ +
+ Self(val) + Self(val.get())
+ } + }
+} +}
+ +
@ -534,8 +534,8 @@ diff -uNr 10_privilege_level/src/_arch/aarch64/memory/mmu.rs 11_virtual_mem_part
+ assert!(NUM_TABLES > 0); + assert!(NUM_TABLES > 0);
+ +
+ Self { + Self {
+ lvl3: [[PageDescriptor(InMemoryRegister::new(0)); 8192]; NUM_TABLES], + lvl3: [[PageDescriptor(0); 8192]; NUM_TABLES],
+ lvl2: [TableDescriptor(InMemoryRegister::new(0)); NUM_TABLES], + lvl2: [TableDescriptor(0); NUM_TABLES],
+ } + }
+ } + }
+} +}

@ -89,14 +89,14 @@ const FIVETWELVE_MIB_SHIFT: usize = 29; // log2(512 * 1024 * 1024)
/// The output points to the next table. /// The output points to the next table.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct TableDescriptor(InMemoryRegister<u64, STAGE1_TABLE_DESCRIPTOR::Register>); struct TableDescriptor(u64);
/// A page descriptor with 64 KiB aperture. /// A page descriptor with 64 KiB aperture.
/// ///
/// The output points to physical memory. /// The output points to physical memory.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct PageDescriptor(InMemoryRegister<u64, STAGE1_PAGE_DESCRIPTOR::Register>); struct PageDescriptor(u64);
/// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB /// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB
/// aligned, hence the "reverse" order of appearance. /// aligned, hence the "reverse" order of appearance.
@ -167,7 +167,7 @@ impl convert::From<usize> for TableDescriptor {
+ STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64), + STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64),
); );
TableDescriptor(val) TableDescriptor(val.get())
} }
} }
@ -219,7 +219,7 @@ impl PageDescriptor {
+ STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted), + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted),
); );
Self(val) Self(val.get())
} }
} }
@ -229,8 +229,8 @@ impl<const NUM_TABLES: usize> FixedSizeTranslationTable<{ NUM_TABLES }> {
assert!(NUM_TABLES > 0); assert!(NUM_TABLES > 0);
Self { Self {
lvl3: [[PageDescriptor(InMemoryRegister::new(0)); 8192]; NUM_TABLES], lvl3: [[PageDescriptor(0); 8192]; NUM_TABLES],
lvl2: [TableDescriptor(InMemoryRegister::new(0)); NUM_TABLES], lvl2: [TableDescriptor(0); NUM_TABLES],
} }
} }
} }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -19,15 +19,15 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"

@ -17,9 +17,9 @@ bsp_rpi4 = ["register"]
[dependencies] [dependencies]
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", optional = true } register = { version = "1.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 = "4.x.x" } cortex-a = { version = "5.x.x" }

@ -89,14 +89,14 @@ const FIVETWELVE_MIB_SHIFT: usize = 29; // log2(512 * 1024 * 1024)
/// The output points to the next table. /// The output points to the next table.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct TableDescriptor(InMemoryRegister<u64, STAGE1_TABLE_DESCRIPTOR::Register>); struct TableDescriptor(u64);
/// A page descriptor with 64 KiB aperture. /// A page descriptor with 64 KiB aperture.
/// ///
/// The output points to physical memory. /// The output points to physical memory.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct PageDescriptor(InMemoryRegister<u64, STAGE1_PAGE_DESCRIPTOR::Register>); struct PageDescriptor(u64);
/// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB /// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB
/// aligned, hence the "reverse" order of appearance. /// aligned, hence the "reverse" order of appearance.
@ -167,7 +167,7 @@ impl convert::From<usize> for TableDescriptor {
+ STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64), + STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64),
); );
TableDescriptor(val) TableDescriptor(val.get())
} }
} }
@ -219,7 +219,7 @@ impl PageDescriptor {
+ STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted), + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted),
); );
Self(val) Self(val.get())
} }
} }
@ -229,8 +229,8 @@ impl<const NUM_TABLES: usize> FixedSizeTranslationTable<{ NUM_TABLES }> {
assert!(NUM_TABLES > 0); assert!(NUM_TABLES > 0);
Self { Self {
lvl3: [[PageDescriptor(InMemoryRegister::new(0)); 8192]; NUM_TABLES], lvl3: [[PageDescriptor(0); 8192]; NUM_TABLES],
lvl2: [TableDescriptor(InMemoryRegister::new(0)); NUM_TABLES], lvl2: [TableDescriptor(0); NUM_TABLES],
} }
} }
} }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -46,18 +46,18 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.48" version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" checksum = "443b4178719c5a851e1bde36ce12da21d74a0e60b4d982ec3385a933c812f0f6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -80,9 +80,9 @@ version = "0.1.0"
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"

@ -15,15 +15,15 @@ bsp_rpi4 = ["register"]
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
[dependencies] [dependencies]
qemu-exit = "1.0.x" qemu-exit = "1.x.x"
test-types = { path = "test-types" } test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } register = { version = "1.x.x", features = ["no_std_unit_tests"], optional = true }
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "4.x.x" } cortex-a = { version = "5.x.x" }
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
## Testing ## Testing

@ -801,16 +801,16 @@ diff -uNr 12_exceptions_part1_groundwork/Cargo.toml 13_integrated_testing/Cargo.
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
[dependencies] [dependencies]
+qemu-exit = "1.0.x" +qemu-exit = "1.x.x"
+test-types = { path = "test-types" } +test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
-register = { version = "0.5.x", optional = true } -register = { version = "1.x.x", optional = true }
+register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } +register = { version = "1.x.x", features = ["no_std_unit_tests"], optional = true }
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "4.x.x" } cortex-a = { version = "5.x.x" }
+##-------------------------------------------------------------------------------------------------- +##--------------------------------------------------------------------------------------------------
+## Testing +## Testing

@ -89,14 +89,14 @@ const FIVETWELVE_MIB_SHIFT: usize = 29; // log2(512 * 1024 * 1024)
/// The output points to the next table. /// The output points to the next table.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct TableDescriptor(InMemoryRegister<u64, STAGE1_TABLE_DESCRIPTOR::Register>); struct TableDescriptor(u64);
/// A page descriptor with 64 KiB aperture. /// A page descriptor with 64 KiB aperture.
/// ///
/// The output points to physical memory. /// The output points to physical memory.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct PageDescriptor(InMemoryRegister<u64, STAGE1_PAGE_DESCRIPTOR::Register>); struct PageDescriptor(u64);
/// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB /// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB
/// aligned, hence the "reverse" order of appearance. /// aligned, hence the "reverse" order of appearance.
@ -167,7 +167,7 @@ impl convert::From<usize> for TableDescriptor {
+ STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64), + STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64),
); );
TableDescriptor(val) TableDescriptor(val.get())
} }
} }
@ -219,7 +219,7 @@ impl PageDescriptor {
+ STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted), + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted),
); );
Self(val) Self(val.get())
} }
} }
@ -229,8 +229,8 @@ impl<const NUM_TABLES: usize> FixedSizeTranslationTable<{ NUM_TABLES }> {
assert!(NUM_TABLES > 0); assert!(NUM_TABLES > 0);
Self { Self {
lvl3: [[PageDescriptor(InMemoryRegister::new(0)); 8192]; NUM_TABLES], lvl3: [[PageDescriptor(0); 8192]; NUM_TABLES],
lvl2: [TableDescriptor(InMemoryRegister::new(0)); NUM_TABLES], lvl2: [TableDescriptor(0); NUM_TABLES],
} }
} }
} }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -46,18 +46,18 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.48" version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" checksum = "443b4178719c5a851e1bde36ce12da21d74a0e60b4d982ec3385a933c812f0f6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -80,9 +80,9 @@ version = "0.1.0"
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"

@ -15,15 +15,15 @@ bsp_rpi4 = ["register"]
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
[dependencies] [dependencies]
qemu-exit = "1.0.x" qemu-exit = "1.x.x"
test-types = { path = "test-types" } test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } register = { version = "1.x.x", features = ["no_std_unit_tests"], optional = true }
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "4.x.x" } cortex-a = { version = "5.x.x" }
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
## Testing ## Testing

@ -89,14 +89,14 @@ const FIVETWELVE_MIB_SHIFT: usize = 29; // log2(512 * 1024 * 1024)
/// The output points to the next table. /// The output points to the next table.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct TableDescriptor(InMemoryRegister<u64, STAGE1_TABLE_DESCRIPTOR::Register>); struct TableDescriptor(u64);
/// A page descriptor with 64 KiB aperture. /// A page descriptor with 64 KiB aperture.
/// ///
/// The output points to physical memory. /// The output points to physical memory.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct PageDescriptor(InMemoryRegister<u64, STAGE1_PAGE_DESCRIPTOR::Register>); struct PageDescriptor(u64);
/// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB /// Big monolithic struct for storing the translation tables. Individual levels must be 64 KiB
/// aligned, hence the "reverse" order of appearance. /// aligned, hence the "reverse" order of appearance.
@ -167,7 +167,7 @@ impl convert::From<usize> for TableDescriptor {
+ STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64), + STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64),
); );
TableDescriptor(val) TableDescriptor(val.get())
} }
} }
@ -219,7 +219,7 @@ impl PageDescriptor {
+ STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted), + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted),
); );
Self(val) Self(val.get())
} }
} }
@ -229,8 +229,8 @@ impl<const NUM_TABLES: usize> FixedSizeTranslationTable<{ NUM_TABLES }> {
assert!(NUM_TABLES > 0); assert!(NUM_TABLES > 0);
Self { Self {
lvl3: [[PageDescriptor(InMemoryRegister::new(0)); 8192]; NUM_TABLES], lvl3: [[PageDescriptor(0); 8192]; NUM_TABLES],
lvl2: [TableDescriptor(InMemoryRegister::new(0)); NUM_TABLES], lvl2: [TableDescriptor(0); NUM_TABLES],
} }
} }
} }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "626fdbb0f6fa1e6be6df0e94795998894c4ad08d3221e12209a6c0b4f546a0c4"
dependencies = [ dependencies = [
"register", "register",
] ]
@ -46,18 +46,18 @@ dependencies = [
[[package]] [[package]]
name = "register" name = "register"
version = "0.5.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaba5b0e477d21f61a57504bb5cef4a1e86de30300b457d38971c1cfc98b815" checksum = "185fff3cbc031a1d17b86a980f8014002da35f9187cf4370728e0eb1eeff6829"
dependencies = [ dependencies = [
"tock-registers", "tock-registers",
] ]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.48" version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" checksum = "443b4178719c5a851e1bde36ce12da21d74a0e60b4d982ec3385a933c812f0f6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -80,9 +80,9 @@ version = "0.1.0"
[[package]] [[package]]
name = "tock-registers" name = "tock-registers"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70323afdb8082186c0986da0e10f6e4ed103d681c921c00597e98d9806dac20f" checksum = "f521a79accce68c417c9c77ce22108056b626126da1932f7e2e9b5bbffee0cea"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"

@ -15,15 +15,15 @@ bsp_rpi4 = ["register"]
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
[dependencies] [dependencies]
qemu-exit = "1.0.x" qemu-exit = "1.x.x"
test-types = { path = "test-types" } test-types = { path = "test-types" }
# Optional dependencies # Optional dependencies
register = { version = "0.5.x", features = ["no_std_unit_tests"], optional = true } register = { version = "1.x.x", features = ["no_std_unit_tests"], optional = true }
# Platform specific dependencies # Platform specific dependencies
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
cortex-a = { version = "4.x.x" } cortex-a = { version = "5.x.x" }
##-------------------------------------------------------------------------------------------------- ##--------------------------------------------------------------------------------------------------
## Testing ## Testing

@ -367,7 +367,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
/// The output points to the next table. /// The output points to the next table.
@@ -98,36 +105,65 @@ @@ -98,36 +105,65 @@
#[repr(transparent)] #[repr(transparent)]
struct PageDescriptor(InMemoryRegister<u64, STAGE1_PAGE_DESCRIPTOR::Register>); struct PageDescriptor(u64);
+#[derive(Copy, Clone)] +#[derive(Copy, Clone)]
+enum Granule512MiB {} +enum Granule512MiB {}
@ -488,7 +488,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
val.write( val.write(
STAGE1_TABLE_DESCRIPTOR::VALID::True STAGE1_TABLE_DESCRIPTOR::VALID::True
+ STAGE1_TABLE_DESCRIPTOR::TYPE::Table + STAGE1_TABLE_DESCRIPTOR::TYPE::Table
@@ -207,23 +246,32 @@ @@ -207,23 +246,33 @@
impl PageDescriptor { impl PageDescriptor {
/// Create an instance. /// Create an instance.
@ -507,12 +507,13 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
+ STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted), + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted),
); );
Self(val) Self(val.get())
} }
+ +
+ /// Returns the valid bit. + /// Returns the valid bit.
+ fn is_valid(&self) -> bool { + fn is_valid(&self) -> bool {
+ self.0.is_set(STAGE1_PAGE_DESCRIPTOR::VALID) + InMemoryRegister::<u64, STAGE1_PAGE_DESCRIPTOR::Register>::new(self.0)
+ .is_set(STAGE1_PAGE_DESCRIPTOR::VALID)
+ } + }
} }
@ -524,10 +525,10 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
/// Create an instance. /// Create an instance.
pub const fn new() -> Self { pub const fn new() -> Self {
assert!(NUM_TABLES > 0); assert!(NUM_TABLES > 0);
@@ -231,7 +279,55 @@ @@ -231,7 +280,55 @@
Self { Self {
lvl3: [[PageDescriptor(InMemoryRegister::new(0)); 8192]; NUM_TABLES], lvl3: [[PageDescriptor(0); 8192]; NUM_TABLES],
lvl2: [TableDescriptor(InMemoryRegister::new(0)); NUM_TABLES], lvl2: [TableDescriptor(0); NUM_TABLES],
+ cur_l3_mmio_index: 0, + cur_l3_mmio_index: 0,
+ initialized: false, + initialized: false,
+ } + }
@ -580,7 +581,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
} }
} }
@@ -248,28 +344,6 @@ @@ -248,28 +345,6 @@
); );
} }
@ -609,7 +610,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
/// Configure various settings of stage 1 of the EL1 translation regime. /// Configure various settings of stage 1 of the EL1 translation regime.
fn configure_translation_control() { fn configure_translation_control() {
let ips = ID_AA64MMFR0_EL1.read(ID_AA64MMFR0_EL1::PARange); let ips = ID_AA64MMFR0_EL1.read(ID_AA64MMFR0_EL1::PARange);
@@ -282,7 +356,7 @@ @@ -282,7 +357,7 @@
+ TCR_EL1::ORGN0::WriteBack_ReadAlloc_WriteAlloc_Cacheable + TCR_EL1::ORGN0::WriteBack_ReadAlloc_WriteAlloc_Cacheable
+ TCR_EL1::IRGN0::WriteBack_ReadAlloc_WriteAlloc_Cacheable + TCR_EL1::IRGN0::WriteBack_ReadAlloc_WriteAlloc_Cacheable
+ TCR_EL1::EPD0::EnableTTBR0Walks + TCR_EL1::EPD0::EnableTTBR0Walks
@ -618,7 +619,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
); );
} }
@@ -290,17 +364,126 @@ @@ -290,17 +365,126 @@
// Public Code // Public Code
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -748,7 +749,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
// Fail early if translation granule is not supported. Both RPis support it, though. // Fail early if translation granule is not supported. Both RPis support it, though.
if !ID_AA64MMFR0_EL1.matches_all(ID_AA64MMFR0_EL1::TGran64::Supported) { if !ID_AA64MMFR0_EL1.matches_all(ID_AA64MMFR0_EL1::TGran64::Supported) {
return Err("Translation granule not supported in HW"); return Err("Translation granule not supported in HW");
@@ -309,11 +492,8 @@ @@ -309,11 +493,8 @@
// Prepare the memory attribute indirection register. // Prepare the memory attribute indirection register.
set_up_mair(); set_up_mair();
@ -761,7 +762,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
configure_translation_control(); configure_translation_control();
@@ -337,6 +517,9 @@ @@ -337,6 +518,9 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
#[cfg(test)] #[cfg(test)]
@ -771,7 +772,7 @@ diff -uNr 14_exceptions_part2_peripheral_IRQs/src/_arch/aarch64/memory/mmu.rs 15
mod tests { mod tests {
use super::*; use super::*;
use test_macros::kernel_test; use test_macros::kernel_test;
@@ -363,7 +546,7 @@ @@ -363,7 +547,7 @@
#[kernel_test] #[kernel_test]
fn kernel_tables_in_bss() { fn kernel_tables_in_bss() {
let bss_range = bsp::memory::bss_range_inclusive(); let bss_range = bsp::memory::bss_range_inclusive();

@ -96,14 +96,14 @@ register_bitfields! {u64,
/// The output points to the next table. /// The output points to the next table.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct TableDescriptor(InMemoryRegister<u64, STAGE1_TABLE_DESCRIPTOR::Register>); struct TableDescriptor(u64);
/// A page descriptor with 64 KiB aperture. /// A page descriptor with 64 KiB aperture.
/// ///
/// The output points to physical memory. /// The output points to physical memory.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(transparent)] #[repr(transparent)]
struct PageDescriptor(InMemoryRegister<u64, STAGE1_PAGE_DESCRIPTOR::Register>); struct PageDescriptor(u64);
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
enum Granule512MiB {} enum Granule512MiB {}
@ -206,7 +206,7 @@ impl convert::From<usize> for TableDescriptor {
+ STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64), + STAGE1_TABLE_DESCRIPTOR::NEXT_LEVEL_TABLE_ADDR_64KiB.val(shifted as u64),
); );
TableDescriptor(val) TableDescriptor(val.get())
} }
} }
@ -258,12 +258,13 @@ impl PageDescriptor {
+ STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted), + STAGE1_PAGE_DESCRIPTOR::OUTPUT_ADDR_64KiB.val(shifted),
); );
Self(val) Self(val.get())
} }
/// Returns the valid bit. /// Returns the valid bit.
fn is_valid(&self) -> bool { fn is_valid(&self) -> bool {
self.0.is_set(STAGE1_PAGE_DESCRIPTOR::VALID) InMemoryRegister::<u64, STAGE1_PAGE_DESCRIPTOR::Register>::new(self.0)
.is_set(STAGE1_PAGE_DESCRIPTOR::VALID)
} }
} }
@ -277,8 +278,8 @@ impl<const NUM_TABLES: usize> FixedSizeTranslationTable<{ NUM_TABLES }> {
assert!(NUM_TABLES > 0); assert!(NUM_TABLES > 0);
Self { Self {
lvl3: [[PageDescriptor(InMemoryRegister::new(0)); 8192]; NUM_TABLES], lvl3: [[PageDescriptor(0); 8192]; NUM_TABLES],
lvl2: [TableDescriptor(InMemoryRegister::new(0)); NUM_TABLES], lvl2: [TableDescriptor(0); NUM_TABLES],
cur_l3_mmio_index: 0, cur_l3_mmio_index: 0,
initialized: false, initialized: false,
} }

@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "cortex-a" name = "cortex-a"
version = "4.0.0" version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda21b8ec67b82099401559fe28cea4508eb1e33217b4dacf60ba22e39b486b1" checksum = "a389514c1229e12a03c0e8de8b357671b71e1d1bdab3a4f5b591abc94169cba8"
dependencies = [ dependencies = [
"register", "register",
] ]

Binary file not shown.
Loading…
Cancel
Save