Skip to content

Commit

Permalink
Fix: VirtAddrNotValid and PhysAddrNotValid should contain the who…
Browse files Browse the repository at this point in the history
…le address

Not just the invalid higher bits. We made the internal fields public in #340, but fortunately we didn't release this change yet, so this fix is still non-breaking.
  • Loading branch information
phil-opp committed Mar 1, 2022
1 parent a143355 commit b40eac1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl VirtAddr {
match addr.get_bits(47..64) {
0 | 0x1ffff => Ok(VirtAddr(addr)), // address is canonical
1 => Ok(VirtAddr::new_truncate(addr)), // address needs sign extension
other => Err(VirtAddrNotValid(other)),
_ => Err(VirtAddrNotValid(addr)),
}
}

Expand Down Expand Up @@ -367,7 +367,7 @@ impl PhysAddr {
pub fn try_new(addr: u64) -> Result<PhysAddr, PhysAddrNotValid> {
match addr.get_bits(52..64) {
0 => Ok(PhysAddr(addr)), // address is valid
other => Err(PhysAddrNotValid(other)),
_ => Err(PhysAddrNotValid(addr)),
}
}

Expand Down

0 comments on commit b40eac1

Please sign in to comment.