-
Notifications
You must be signed in to change notification settings - Fork 23
Strongly typed RISC-V Page Table & Hypervisor Extension #3
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
Strongly typed RISC-V Page Table & Hypervisor Extension #3
Conversation
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.
yyds!
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.
Wait. I found some bugs.
self.0.try_into().unwrap() | ||
} | ||
fn page_number(&self) -> usize { | ||
self.0.get_bits(12..64).try_into().unwrap() |
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.
should be 12..39
?
assert!(p3_index.get_bits(12..) == 0, "p3_index exceeding 11 bits"); | ||
assert!(p2_index.get_bits(10..) == 0, "p2_index exceeding 9 bits"); | ||
assert!(p1_index.get_bits(10..) == 0, "p1_index exceeding 9 bits"); |
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.
should be 9..
?
let mut addr = | ||
(p3_index << 12 << 9 << 9) | (p2_index << 12 << 9) | (p1_index << 12) | offset; | ||
if addr.get_bit(38) { | ||
addr.set_bits(39..64, 0xFFFF); |
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.
should be (1 << (64 - 39)) - 1
?
impl AddressX64 for VirtAddrSv39 { | ||
fn new_u64(addr: u64) -> Self { | ||
if addr.get_bit(38) { | ||
assert!(addr.get_bits(39..64) == 0xFFFF, "va 39..64 is not sext"); |
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.
should be (1 << (64 - 39)) - 1
?
assert!(p4_index.get_bits(10..) == 0, "p4_index exceeding 9 bits"); | ||
assert!(p3_index.get_bits(10..) == 0, "p3_index exceeding 9 bits"); | ||
assert!(p2_index.get_bits(10..) == 0, "p2_index exceeding 9 bits"); | ||
assert!(p1_index.get_bits(10..) == 0, "p1_index exceeding 9 bits"); |
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.
should be 9..
?
self.0.try_into().unwrap() | ||
} | ||
fn page_number(&self) -> usize { | ||
self.0.get_bits(12..64).try_into().unwrap() |
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.
should be 12..48
?
Uh oh!
There was an error while loading. Please reload this page.