Skip to content

Commit fde06f8

Browse files
authored
Merge pull request #27 from google/pagetable
Fix TCR default value for different exception levels
2 parents da55ff9 + 3980680 commit fde06f8

File tree

3 files changed

+179
-71
lines changed

3 files changed

+179
-71
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
## Unreleased
44

5+
### Breaking changes
6+
7+
- Changed order of parameters to `initial-pagetable` macro, to make `TCR` last.
8+
59
### Improvements
610

711
- If the `initial-pagetable` or `exceptions` features are specified without any of the `elX`
812
features, then the exception level will be checked at runtime and the appropriate registers for
913
the current EL will be used. The `el1` feature is no longer enabled by default, as this runtime
10-
detection should work instead.
14+
detection should work instead. Note that different ELs have different TCR registers which aren't
15+
laid out entirely the same, so different values must be specified for TCR for each EL.
16+
- Exposed `enable_mmu!` macro to allow the MMU and caches to be enbled with an arbitrary initial
17+
pagetable, rather than using `initial_pagetable!` to declare the static.
1118

1219
### Bugfixes
1320

src/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@ use core::arch::global_asm;
3232
#[cfg(not(feature = "initial-pagetable"))]
3333
use core::arch::naked_asm;
3434
pub use entry::secondary_entry;
35+
#[cfg(all(feature = "initial-pagetable", feature = "el1"))]
36+
pub use pagetable::DEFAULT_TCR_EL1 as DEFAULT_TCR;
37+
#[cfg(all(feature = "initial-pagetable", feature = "el2"))]
38+
pub use pagetable::DEFAULT_TCR_EL2 as DEFAULT_TCR;
39+
#[cfg(all(feature = "initial-pagetable", feature = "el3"))]
40+
pub use pagetable::DEFAULT_TCR_EL3 as DEFAULT_TCR;
3541
#[cfg(feature = "initial-pagetable")]
36-
pub use pagetable::{DEFAULT_MAIR, DEFAULT_SCTLR, DEFAULT_TCR, InitialPagetable};
42+
pub use pagetable::{
43+
DEFAULT_MAIR, DEFAULT_SCTLR, DEFAULT_TCR_EL1, DEFAULT_TCR_EL2, DEFAULT_TCR_EL3,
44+
InitialPagetable,
45+
};
3746

3847
#[cfg(not(feature = "initial-pagetable"))]
3948
#[unsafe(naked)]

0 commit comments

Comments
 (0)