diff --git a/src/arch/x86_64.rs b/src/arch/x86_64.rs index 6bc5022388..d8b44357cc 100644 --- a/src/arch/x86_64.rs +++ b/src/arch/x86_64.rs @@ -57,14 +57,7 @@ impl Arch for X8664Arch { // On x86_64, an address is valid if and only if it is canonical. It may still point to // unmapped memory, but will always be valid once translated via the page table has // suceeded. - address.is_canonical() - } -} - -impl VirtualAddress { - #[doc(cfg(target_arch = "x86_64"))] - pub fn is_canonical(self) -> bool { - let masked = self.data() & 0xFFFF_8000_0000_0000; + let masked = address.data() & 0xFFFF_8000_0000_0000; // TODO: 5-level paging masked == 0xFFFF_8000_0000_0000 || masked == 0 } @@ -96,10 +89,10 @@ mod tests { #[test] fn is_canonical() { fn yes(address: usize) { - assert!(VirtualAddress::new(address).is_canonical()); + assert!(X8664Arch::virt_is_valid(VirtualAddress::new(address))); } fn no(address: usize) { - assert!(!VirtualAddress::new(address).is_canonical()); + assert!(!X8664Arch::virt_is_valid(VirtualAddress::new(address))); } yes(0xFFFF_8000_1337_1337); diff --git a/src/lib.rs b/src/lib.rs index b0615774d7..0cc0beb2d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ #![cfg_attr(not(feature = "std"), no_std)] -#![feature(doc_cfg)] pub use crate::{allocator::*, arch::*, page::*};