use kernel_arch::{mem::KernelTableManager, KernelTableManagerImpl};
pub use libk_mm_interface::address::{AsPhysicalAddress, PhysicalAddress};

pub trait Virtualize {
    fn virtualize(self) -> usize;
    fn from_virtualized(value: usize) -> Self;
}

impl Virtualize for PhysicalAddress {
    fn virtualize(self) -> usize {
        KernelTableManagerImpl::virtualize(self.into_u64())
    }

    fn from_virtualized(value: usize) -> Self {
        PhysicalAddress::from_u64(KernelTableManagerImpl::physicalize(value))
    }
}
