This commit is contained in:
Yifan Wu 2022-05-13 01:01:07 -07:00
parent 8c92e66f6a
commit 3fd8b8e94d

View File

@ -80,8 +80,12 @@ impl From<PhysPageNum> for usize {
}
impl From<VirtAddr> for usize {
fn from(v: VirtAddr) -> Self {
if v.0 >= (1 << (VA_WIDTH_SV39 - 1)) {
v.0 | (!((1 << VA_WIDTH_SV39) - 1))
} else {
v.0
}
}
}
impl From<VirtPageNum> for usize {
fn from(v: VirtPageNum) -> Self {