-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support TTBR1 as well as TTBR0 #19
Conversation
Disable tests when building without debug assertions.
The checks can be done in RootTable.
src/paging.rs
Outdated
@@ -25,6 +25,17 @@ pub const PAGE_SIZE: usize = 1 << PAGE_SHIFT; | |||
/// page size. | |||
pub const BITS_PER_LEVEL: usize = PAGE_SHIFT - 3; | |||
|
|||
/// Which TTBR register to use for a page table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's easiest to use the register names, but you could alternatively be slightly more abstract and refer to the lower or upper VA range; that's the ARM ARM terminology.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/linearmap.rs
Outdated
|
||
// The first page in the region covered by TTBR1. | ||
assert_eq!( | ||
translation.virtual_to_physical(VirtualAddress(0xffffff8000000000)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add underscores to make these more readable - 0xffff_ff80_0000_0000? Or compute it some other way, so it's obvious? -GIB_512, perhaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/linearmap.rs
Outdated
@@ -318,10 +373,29 @@ mod tests { | |||
) | |||
} | |||
|
|||
#[test] | |||
fn virtual_address_range_ttbr1() { | |||
const GIB_512: isize = 512 * 1024 * 1024 * 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract to top level rather than repeating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linear map can by definition only be used with TTBR0 so this patch seems wrong or unnecessary at least?
Uh, why can't the linear map be used with |
Apologies, you're quite right - I got confused and read 'identity map' instead of 'linear map'. Ignore me ... |
src/paging.rs
Outdated
/// will be used with `TTBR0`. | ||
Lower, | ||
/// The page table covers the top of the virtual address space (ending at address | ||
/// 0xffffffffffffffff), so will be used with `TTBR1`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 0xffff_ffff_ffff_ffff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Fixes #14.