diff --git a/os/src/mm/address.rs b/os/src/mm/address.rs index dc5d08a8..cf147a08 100644 --- a/os/src/mm/address.rs +++ b/os/src/mm/address.rs @@ -83,7 +83,11 @@ impl From for usize { } impl From for usize { fn from(v: VirtAddr) -> Self { - v.0 + if v.0 >= (1 << (VA_WIDTH_SV39 - 1)) { + v.0 | (!((1 << VA_WIDTH_SV39) - 1)) + } else { + v.0 + } } } impl From for usize {